Skip to content

Commit

Permalink
feat: support php 8.2 and drop php 7.4 support (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin authored Feb 7, 2023
1 parent 85cddce commit 6909f64
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [8.1]
php-version: [8.2]

steps:
- name: Checkout sources
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [8.1]
php-version: [8.2]

steps:
- name: Checkout sources
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/CloudflareProxies.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Reload.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.';

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.';

Expand Down
2 changes: 1 addition & 1 deletion src/Http/Middleware/TrustProxies.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 6909f64

Please sign in to comment.