Skip to content

Commit 634be16

Browse files
authored
Feature | PHP 8.5 Support (#525)
* Feature | PHP 8.5 Support * 🪄 Code Style Fixes * Code style fixer * Updated workflows * Fixed typo * Revert "🪄 Code Style Fixes" This reverts commit 68e068a. * Revert "Code style fixer" This reverts commit 65de90e. * Added PHP CS Fixer with PHP 8.2 * Updated --allow-risky value * Remove front-end step * Fixed tests * 🪄 Code Style Fixes * Trigger build --------- Co-authored-by: Sammyjo20 <[email protected]>
1 parent 339cfe7 commit 634be16

File tree

5 files changed

+48
-20
lines changed

5 files changed

+48
-20
lines changed

.github/workflows/php-cs-fixer.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,25 @@ concurrency:
1818
cancel-in-progress: true
1919

2020
jobs:
21-
php-cs-fixer:
21+
lint:
2222
runs-on: ubuntu-latest
23-
2423
steps:
25-
- name: Checkout code
26-
uses: actions/checkout@v3
27-
- name: Run PHP CS Fixer
28-
uses: docker://oskarstark/php-cs-fixer-ga
24+
- uses: actions/checkout@v4
25+
26+
- name: Setup PHP
27+
uses: shivammathur/setup-php@v2
2928
with:
30-
args: --config=.php-cs-fixer.dist.php --allow-risky=yes
31-
- name: Commit changes
32-
uses: stefanzweifel/git-auto-commit-action@v4
29+
php-version: '8.2'
30+
31+
- name: Install Dependencies
32+
run: |
33+
composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
34+
35+
- name: Run PHP CS Fixer
36+
run: ./vendor/bin/php-cs-fixer fix --allow-risky=yes
37+
38+
- name: Commit Changes
39+
uses: stefanzweifel/git-auto-commit-action@v5
3340
with:
3441
commit_message: 🪄 Code Style Fixes
42+
commit_options: '--no-verify'

.github/workflows/phpstan.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ jobs:
1919
name: phpstan
2020
runs-on: ubuntu-latest
2121
steps:
22-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
2323

2424
- name: Setup PHP
2525
uses: shivammathur/setup-php@v2
2626
with:
27-
php-version: '8.4'
27+
php-version: '8.5'
2828
coverage: none
2929

3030
- name: Install composer dependencies

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ jobs:
2424
fail-fast: true
2525
matrix:
2626
os: [ ubuntu-latest, windows-latest ]
27-
php: [ 8.1, 8.2, 8.3, 8.4 ]
27+
php: [ 8.2, 8.3, 8.4, 8.5 ]
2828
stability: [ prefer-lowest, prefer-stable ]
2929

3030
name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}
3131

3232
steps:
3333
- name: Checkout code
34-
uses: actions/checkout@v3
34+
uses: actions/checkout@v4
3535

3636
- name: Setup PHP
3737
uses: shivammathur/setup-php@v2

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
],
2020
"homepage": "https://github.com/saloonphp/saloon",
2121
"require": {
22-
"php": "^8.1",
22+
"php": "^8.2",
2323
"guzzlehttp/guzzle": "^7.6",
2424
"guzzlehttp/promises": "^1.5 || ^2.0",
2525
"guzzlehttp/psr7": "^2.0",
@@ -29,12 +29,12 @@
2929
"require-dev": {
3030
"ext-simplexml": "*",
3131
"friendsofphp/php-cs-fixer": "^3.5",
32-
"illuminate/collections": "^9.39 || ^10.0",
32+
"illuminate/collections": "^10.0 || ^11.0 || ^12.0",
3333
"league/flysystem": "^3.0",
34-
"pestphp/pest": "^2.36.0 || ^3.8.2",
34+
"pestphp/pest": "^2.36.0 || ^3.8.2 || ^4.1.4",
3535
"phpstan/phpstan": "^2.1.13",
3636
"saloonphp/xml-wrangler": "^1.1",
37-
"spatie/ray": "^1.33",
37+
"spatie/invade": "^2.1",
3838
"symfony/dom-crawler": "^6.0 || ^7.0",
3939
"symfony/var-dumper": "^6.3 || ^7.0"
4040
},

tests/Feature/GuzzleSenderTest.php

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use GuzzleHttp\Utils;
66
use GuzzleHttp\Client;
77
use GuzzleHttp\Psr7\Uri;
8+
use Illuminate\Support\Arr;
89
use GuzzleHttp\HandlerStack;
910
use GuzzleHttp\Psr7\Response;
1011
use Saloon\Http\Senders\GuzzleSender;
@@ -76,9 +77,20 @@
7677

7778
$handlerStack = $sender->getHandlerStack();
7879

79-
// The HandlerStack::create() loads important default middleware
80+
$saloonStack = invade($handlerStack)->stack;
81+
$defaultStack = invade(HandlerStack::create())->stack;
8082

81-
expect($handlerStack)->toEqual(HandlerStack::create());
83+
expect($saloonStack)->toHaveSameSize($defaultStack)->toHaveCount(4);
84+
85+
expect($saloonStack[0][1])->toBe($defaultStack[0][1]);
86+
expect($saloonStack[1][1])->toBe($defaultStack[1][1]);
87+
expect($saloonStack[2][1])->toBe($defaultStack[2][1]);
88+
expect($saloonStack[3][1])->toBe($defaultStack[3][1]);
89+
90+
expect($saloonStack[0][0])->toBeCallable();
91+
expect($saloonStack[1][0])->toBeCallable();
92+
expect($saloonStack[2][0])->toBeCallable();
93+
expect($saloonStack[3][0])->toBeCallable();
8294
});
8395

8496
test('the guzzle sender has default options configured', function () {
@@ -96,7 +108,15 @@
96108
'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT,
97109
]);
98110

99-
expect($freshClient->getConfig())->toEqual($client->getConfig());
111+
$saloonConfig = $client->getConfig();
112+
$defaultConfig = $freshClient->getConfig();
113+
114+
expect(Arr::except($saloonConfig, 'handler'))->toEqual(Arr::except($defaultConfig, 'handler'));
115+
116+
$saloonStack = invade($saloonConfig['handler'])->stack;
117+
$defaultStack = invade($defaultConfig['handler'])->stack;
118+
119+
expect($saloonStack)->toHaveSameSize($defaultStack)->toHaveCount(4);
100120
});
101121

102122
test('you can set a custom handler stack on the guzzle sender', function () {

0 commit comments

Comments
 (0)