Skip to content

Commit e46b973

Browse files
authored
Merge pull request #126 from Sammyjo20/fix/php-8.2-support
Fix | Support PHP 8.2
2 parents a9db690 + 348cd06 commit e46b973

File tree

6 files changed

+38
-23
lines changed

6 files changed

+38
-23
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
release:
1212
types: [ released ]
1313

14+
permissions:
15+
contents: write
16+
1417
jobs:
1518
php-cs-fixer:
1619
runs-on: ubuntu-latest
@@ -24,8 +27,8 @@ jobs:
2427
- name: Run PHP CS Fixer
2528
uses: docker://oskarstark/php-cs-fixer-ga
2629
with:
27-
args: --config=.php-cs-fixer.dist.php
30+
args: --config=.php-cs-fixer.dist.php --allow-risky=yes
2831
- name: Commit changes
2932
uses: stefanzweifel/git-auto-commit-action@v4
3033
with:
31-
commit_message: Apply Code Style Fixes
34+
commit_message: 🪄 Code Style Fixes

.github/workflows/tests.yml

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,36 +11,39 @@ on:
1111
release:
1212
types: [ released ]
1313

14+
permissions:
15+
contents: read
16+
1417
jobs:
1518
tests:
16-
runs-on: ubuntu-latest
19+
runs-on: ${{ matrix.os }}
1720
strategy:
1821
fail-fast: true
1922
matrix:
20-
php: [ 8.1, 8.0 ]
21-
dependency-version: [ prefer-lowest, prefer-stable ]
23+
os: [ ubuntu-latest, windows-latest ]
24+
php: [ 8.0, 8.1, 8.2 ]
25+
stability: [ prefer-lowest, prefer-stable ]
2226

23-
name: PHP ${{ matrix.php }} - ${{ matrix.dependency-version }}
27+
name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}
2428

2529
steps:
2630
- name: Checkout code
27-
uses: actions/checkout@v2
28-
29-
- name: Cache dependencies
30-
uses: actions/cache@v2
31-
with:
32-
path: ~/.composer/cache/files
33-
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
31+
uses: actions/checkout@v3
3432

3533
- name: Setup PHP
3634
uses: shivammathur/setup-php@v2
3735
with:
3836
php-version: ${{ matrix.php }}
37+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
3938
coverage: none
4039

41-
- name: Install composer dependencies
40+
- name: Setup problem matchers
4241
run: |
43-
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
42+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
43+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
4444
45+
- name: Install dependencies
46+
run: |
47+
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
4548
- name: Execute tests
46-
run: composer test
49+
run: vendor/bin/pest

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
"homepage": "https://github.com/sammyjo20/saloon",
2121
"require": {
2222
"php": "^8.0",
23-
"guzzlehttp/guzzle": "^7.4",
23+
"guzzlehttp/guzzle": "^7.5",
2424
"illuminate/support": "^8.0 || ^9.0",
25-
"nesbot/carbon": "^2.58"
25+
"nesbot/carbon": "^2.64"
2626
},
2727
"require-dev": {
2828
"friendsofphp/php-cs-fixer": "^3.5",

tests/Fixtures/Connectors/TestConnector.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ class TestConnector extends SaloonConnector
99
{
1010
use AcceptsJson;
1111

12+
public bool $unique = false;
13+
1214
/**
1315
* Define the base url of the api.
1416
*

tests/Fixtures/Requests/NoTrailingSlashRequest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88

99
class NoTrailingSlashRequest extends SaloonRequest
1010
{
11+
/**
12+
* @var bool
13+
*/
14+
public bool $addTrailingSlashAfterBaseUrl = false;
15+
1116
/**
1217
* Define the method that the request will use.
1318
*

tests/Unit/StorageTest.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,15 @@
5252
$filesystem->deleteDirectory('/');
5353
$filesystem->createDirectory('/');
5454

55-
$storage = new Storage('tests/Fixtures/Saloon');
55+
$path = 'some' . DIRECTORY_SEPARATOR . 'other' . DIRECTORY_SEPARATOR . 'directories' . DIRECTORY_SEPARATOR . 'example.txt';
56+
57+
$storage = new Storage('tests' . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'Saloon');
5658

57-
expect($storage->exists('some/other/directories/example.txt'))->toBeFalse();
59+
expect($storage->exists($path))->toBeFalse();
5860

59-
$storage->put('some/other/directories/example.txt', 'Hello World');
61+
$storage->put($path, 'Hello World');
6062

61-
expect($storage->exists('some/other/directories/example.txt'))->toBeTrue();
63+
expect($storage->exists($path))->toBeTrue();
6264

63-
expect($storage->get('some/other/directories/example.txt'))->toEqual('Hello World');
65+
expect($storage->get($path))->toEqual('Hello World');
6466
});

0 commit comments

Comments
 (0)