Skip to content

Commit

Permalink
style: add laravel pint
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin committed Mar 30, 2024
1 parent 4e760aa commit d82adc2
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 38 deletions.
12 changes: 0 additions & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,9 @@ updates:
directory: "/"
schedule:
interval: weekly
time: "11:00"
labels:
- actions
- dependencies
- auto-squash

# Maintain dependencies for Composer
- package-ecosystem: composer
directory: "/"
schedule:
interval: weekly
time: "07:00"
open-pull-requests-limit: 10
versioning-strategy: lockfile-only
labels:
- php
- dependencies
- auto-squash
14 changes: 14 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Lint files

on:
pull_request:
types: [opened, synchronize, reopened]

concurrency:
group: Lint files ${{ github.ref }}
cancel-in-progress: true

jobs:
php:
name: Lint PHP files
uses: monicahq/workflows/.github/workflows/lint_php.yml@v2
3 changes: 0 additions & 3 deletions .styleci.yml

This file was deleted.

19 changes: 18 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
},
"require-dev": {
"guzzlehttp/guzzle": "^6.3 || ^7.0",
"mockery/mockery": "^1.4",
"jschaedl/composer-git-hooks": "^4.0",
"larastan/larastan": "^1.0 || ^2.4",
"laravel/pint": "^1.15",
"mockery/mockery": "^1.4",
"ocramius/package-versions": "^1.5 || ^2.1",
"orchestra/testbench": "^6.0 || ^7.0 || ^8.0 || ^9.0",
"phpstan/phpstan-deprecation-rules": "^1.0",
Expand All @@ -50,8 +52,23 @@
"providers": [
"Monicahq\\Cloudflare\\TrustedProxyServiceProvider"
]
},
"hooks": {
"config": {
"stop-on-failure": [
"pre-commit"
]
},
"pre-commit": [
"files=$(git diff --staged --name-only);\"$(dirname \"$0\")/../../vendor/bin/pint\" $files; git add $files"
]
}
},
"scripts": {
"cghooks": "vendor/bin/cghooks",
"post-install-cmd": "cghooks add --ignore-lock",
"post-update-cmd": "cghooks update"
},
"suggest": {
"guzzlehttp/guzzle": "Required to get cloudflares ip addresses (^6.5.5|^7.0)."
},
Expand Down
22 changes: 4 additions & 18 deletions src/CloudflareProxies.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,13 @@ class CloudflareProxies

public const IP_VERSION_ANY = self::IP_VERSION_4 | self::IP_VERSION_6;

/**
* The config repository instance.
*
* @var Repository
*/
protected $config;

/**
* The http factory instance.
*
* @var HttpClient
*/
protected $http;

/**
* Create a new instance of CloudflareProxies.
*/
public function __construct(Repository $config, HttpClient $http)
{
$this->config = $config;
$this->http = $http;
public function __construct(
protected Repository $config,
protected HttpClient $http
) {
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/LaravelCloudflare.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ final class LaravelCloudflare
*/
public static function getProxies(): array
{
if (static::$getProxiesCallback !== null) {
return call_user_func(static::$getProxiesCallback);
if (self::$getProxiesCallback !== null) {
return call_user_func(self::$getProxiesCallback);
}

return CloudflareProxies::load();
Expand All @@ -31,6 +31,6 @@ public static function getProxies(): array
*/
public static function getProxiesUsing(?Closure $callback): void
{
static::$getProxiesCallback = $callback;
self::$getProxiesCallback = $callback;
}
}
1 change: 0 additions & 1 deletion tests/Unit/Http/Middleware/TrustProxiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Route;
use Monicahq\Cloudflare\Http\Middleware\TrustProxies;
use Monicahq\Cloudflare\LaravelCloudflare;
use Monicahq\Cloudflare\Tests\FeatureTestCase;
Expand Down

0 comments on commit d82adc2

Please sign in to comment.