diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 4cb1fa7..1dd735c 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-version: [8.1] + php-version: [8.2] steps: - name: Checkout sources @@ -44,7 +44,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-version: [8.1] + php-version: [8.2] steps: - name: Checkout sources diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 90af591..cce8fb5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,9 +15,9 @@ on: - created env: - default-php-version: '8.1' - default-laravel-version: '8.*' - semantic-node-version: 16 + default-php-version: '8.2' + default-laravel-version: '9.*' + semantic-node-version: 18 jobs: @@ -26,11 +26,8 @@ jobs: strategy: fail-fast: false matrix: - php-version: ['7.4', '8.0', '8.1'] + php-version: ['8.0', '8.1', '8.2'] laravel_version: [8.*, 9.*] - exclude: - - php-version: 7.4 - laravel_version: 9.* name: PHP ${{ matrix.php-version }} | Illuminate ${{ matrix.laravel_version }} steps: @@ -41,7 +38,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} - coverage: none + coverage: pcov - name: Check PHP Version run: php -v - name: Check Composer Version @@ -73,7 +70,7 @@ jobs: composer update --no-interaction --no-progress --prefer-dist - name: Run test suite - run: phpdbg -dmemory_limit=4G -qrr vendor/bin/phpunit -c phpunit.xml --log-junit ./results/results.xml --coverage-clover ./results/coverage.xml + run: vendor/bin/phpunit -c phpunit.xml --log-junit ./results/results.xml --coverage-clover ./results/coverage.xml - name: Fix results files run: sed -i -e "s%$GITHUB_WORKSPACE/%%g" *.xml diff --git a/src/CloudflareProxies.php b/src/CloudflareProxies.php index 1c8e34a..61d32a9 100644 --- a/src/CloudflareProxies.php +++ b/src/CloudflareProxies.php @@ -4,6 +4,7 @@ use Illuminate\Contracts\Config\Repository; use Illuminate\Http\Client\Factory as HttpClient; +use Illuminate\Support\Facades\Http; use Illuminate\Support\Str; use UnexpectedValueException; @@ -74,7 +75,7 @@ protected function retrieve($name): array try { $url = Str::of($this->config->get('laravelcloudflare.url'))->finish('/').$name; - $response = $this->http->get($url)->throw(); + $response = Http::get($url)->throw(); } catch (\Exception $e) { throw new UnexpectedValueException('Failed to load trust proxies from Cloudflare server.', 1, $e); } diff --git a/src/Commands/Reload.php b/src/Commands/Reload.php index 868f223..f647a1e 100644 --- a/src/Commands/Reload.php +++ b/src/Commands/Reload.php @@ -19,7 +19,7 @@ class Reload extends Command /** * The console command description. * - * @var string + * @var string|null */ protected $description = 'Reload trust proxies IPs and store in cache.'; diff --git a/src/Commands/View.php b/src/Commands/View.php index 69d4837..d63e3fa 100644 --- a/src/Commands/View.php +++ b/src/Commands/View.php @@ -18,7 +18,7 @@ class View extends Command /** * The console command description. * - * @var string + * @var string|null */ protected $description = 'View list of trust proxies IPs stored in cache.'; diff --git a/src/Http/Middleware/TrustProxies.php b/src/Http/Middleware/TrustProxies.php index a6670ef..5cdfb32 100644 --- a/src/Http/Middleware/TrustProxies.php +++ b/src/Http/Middleware/TrustProxies.php @@ -36,7 +36,7 @@ protected function setTrustedProxyCloudflare(Request $request): void $cacheKey = Config::get('laravelcloudflare.cache'); $cachedProxies = Cache::rememberForever($cacheKey, fn () => LaravelCloudflare::getProxies()); - if (is_array($cachedProxies) && count($cachedProxies) > 0) { + if (count($cachedProxies) > 0) { $this->proxies = array_merge((array) $this->proxies, $cachedProxies); } }