Skip to content

Commit d82adc2

Browse files
committed
style: add laravel pint
1 parent 4e760aa commit d82adc2

File tree

7 files changed

+39
-38
lines changed

7 files changed

+39
-38
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,9 @@ updates:
66
directory: "/"
77
schedule:
88
interval: weekly
9-
time: "11:00"
10-
labels:
11-
- actions
12-
- dependencies
13-
- auto-squash
149

1510
# Maintain dependencies for Composer
1611
- package-ecosystem: composer
1712
directory: "/"
1813
schedule:
1914
interval: weekly
20-
time: "07:00"
21-
open-pull-requests-limit: 10
22-
versioning-strategy: lockfile-only
23-
labels:
24-
- php
25-
- dependencies
26-
- auto-squash

.github/workflows/lint.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Lint files
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
concurrency:
8+
group: Lint files ${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
php:
13+
name: Lint PHP files
14+
uses: monicahq/workflows/.github/workflows/lint_php.yml@v2

.styleci.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

composer.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
},
2626
"require-dev": {
2727
"guzzlehttp/guzzle": "^6.3 || ^7.0",
28-
"mockery/mockery": "^1.4",
28+
"jschaedl/composer-git-hooks": "^4.0",
2929
"larastan/larastan": "^1.0 || ^2.4",
30+
"laravel/pint": "^1.15",
31+
"mockery/mockery": "^1.4",
3032
"ocramius/package-versions": "^1.5 || ^2.1",
3133
"orchestra/testbench": "^6.0 || ^7.0 || ^8.0 || ^9.0",
3234
"phpstan/phpstan-deprecation-rules": "^1.0",
@@ -50,8 +52,23 @@
5052
"providers": [
5153
"Monicahq\\Cloudflare\\TrustedProxyServiceProvider"
5254
]
55+
},
56+
"hooks": {
57+
"config": {
58+
"stop-on-failure": [
59+
"pre-commit"
60+
]
61+
},
62+
"pre-commit": [
63+
"files=$(git diff --staged --name-only);\"$(dirname \"$0\")/../../vendor/bin/pint\" $files; git add $files"
64+
]
5365
}
5466
},
67+
"scripts": {
68+
"cghooks": "vendor/bin/cghooks",
69+
"post-install-cmd": "cghooks add --ignore-lock",
70+
"post-update-cmd": "cghooks update"
71+
},
5572
"suggest": {
5673
"guzzlehttp/guzzle": "Required to get cloudflares ip addresses (^6.5.5|^7.0)."
5774
},

src/CloudflareProxies.php

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,13 @@ class CloudflareProxies
1616

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

19-
/**
20-
* The config repository instance.
21-
*
22-
* @var Repository
23-
*/
24-
protected $config;
25-
26-
/**
27-
* The http factory instance.
28-
*
29-
* @var HttpClient
30-
*/
31-
protected $http;
32-
3319
/**
3420
* Create a new instance of CloudflareProxies.
3521
*/
36-
public function __construct(Repository $config, HttpClient $http)
37-
{
38-
$this->config = $config;
39-
$this->http = $http;
22+
public function __construct(
23+
protected Repository $config,
24+
protected HttpClient $http
25+
) {
4026
}
4127

4228
/**

src/LaravelCloudflare.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ final class LaravelCloudflare
1919
*/
2020
public static function getProxies(): array
2121
{
22-
if (static::$getProxiesCallback !== null) {
23-
return call_user_func(static::$getProxiesCallback);
22+
if (self::$getProxiesCallback !== null) {
23+
return call_user_func(self::$getProxiesCallback);
2424
}
2525

2626
return CloudflareProxies::load();
@@ -31,6 +31,6 @@ public static function getProxies(): array
3131
*/
3232
public static function getProxiesUsing(?Closure $callback): void
3333
{
34-
static::$getProxiesCallback = $callback;
34+
self::$getProxiesCallback = $callback;
3535
}
3636
}

tests/Unit/Http/Middleware/TrustProxiesTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Illuminate\Http\Request;
66
use Illuminate\Support\Facades\Cache;
7-
use Illuminate\Support\Facades\Route;
87
use Monicahq\Cloudflare\Http\Middleware\TrustProxies;
98
use Monicahq\Cloudflare\LaravelCloudflare;
109
use Monicahq\Cloudflare\Tests\FeatureTestCase;

0 commit comments

Comments
 (0)