Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for PHP 8.2 #70

Merged
merged 5 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/.docker export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/.phpstan.neon export-ignore
/docker-compose.yml export-ignore
/docs export-ignore
/phpunit.xml export-ignore
Expand Down
34 changes: 8 additions & 26 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,30 @@ on:
jobs:

tests:
name: Run with PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }}
name: Run PHPStan with PHP ${{ matrix.php }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
operating-system: ['ubuntu-latest']
php-versions: ['7.4', '8.0', '8.1']
php: ['8.2']

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2

- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."

- name: Setup PHP, with composer and extensions
- name: Setup PHP with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite
php-version: ${{ matrix.php }}
coverage: xdebug

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
tools: none

- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
uses: "ramsey/composer-install@v2"

- name: Run PHPStan
run: vendor/bin/phpstan.phar analyze src --level 8

- run: echo "🍏 This job's status is ${{ job.status }}."
run: composer run phpstan
39 changes: 14 additions & 25 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,37 @@ on:
jobs:

tests:
name: Tests (PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }})
name: Tests (PHP ${{ matrix.php }})
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
operating-system: ['ubuntu-latest']
php-versions: ['7.4', '8.0', '8.1']
php: ['7.4', '8.0', '8.1', '8.2', '8.3']

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2

- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."

- name: Setup PHP, with composer and extensions
- name: Setup PHP with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite
php-version: ${{ matrix.php }}
coverage: xdebug
tools: none

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: "Install Composer dependencies"
if: ${{ matrix.php < '8.3' }}
uses: "ramsey/composer-install@v2"

- name: Cache composer dependencies
uses: actions/cache@v2
- name: "Install Composer dependencies (PHP 8.3)"
if: ${{ matrix.php >= '8.3' }}
uses: "ramsey/composer-install@v2"
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
composer-options: --ignore-platform-reqs

- name: Run tests
run: vendor/bin/phpunit --coverage-text

- run: echo "🍏 This job's status is ${{ job.status }}."
run: composer run phpunit -- --coverage-text
29 changes: 29 additions & 0 deletions .phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
parameters:
level: 8

paths:
- src/

scanDirectories:
- vendor

ignoreErrors:
-
message: "#^Class Art4\\\\JsonApiClient\\\\Helper\\\\AccessKey extends generic class SplStack but does not specify its types\\: TValue$#"
count: 1
path: src/Helper/AccessKey.php

-
message: "#^Property Art4\\\\JsonApiClient\\\\V1\\\\ResourceNull\\:\\:\\$data is never read, only written\\.$#"
count: 1
path: src/V1/ResourceNull.php

-
message: "#^Property Art4\\\\JsonApiClient\\\\V1\\\\ResourceNull\\:\\:\\$manager is never read, only written\\.$#"
count: 1
path: src/V1/ResourceNull.php

-
message: "#^Property Art4\\\\JsonApiClient\\\\V1\\\\ResourceNull\\:\\:\\$parent is never read, only written\\.$#"
count: 1
path: src/V1/ResourceNull.php
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,25 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased](https://github.com/Art4/json-api-client/compare/1.1.0...v1.x)

### Added

- Add support for PHP 8.2

## [1.1.0 - 2021-10-05](https://github.com/Art4/json-api-client/compare/1.0.0...1.1.0)

### Added

- Added type hints for parameters and return types in internal and final classes
- New tests for improving backward compatibility in interfaces
- Support for PHP 8.1 is added in CI tests
- Add support for PHP 8.1

### Changed

- Switched from Travis-CI to Github Actions

### Deprecated

- `\Art4\JsonApiClient\Accessable::has()` will add `bool` as a native return type declaration in v2.0, do the same in your implementation now to avoid errors.
- `\Art4\JsonApiClient\Accessable::has()` will add `bool` as a native return type declaration in v2.0, do the same in your implementation now to avoid errors.
- `\Art4\JsonApiClient\Accessable::getKeys()` will add `array` as a native return type declaration in v2.0, do the same in your implementation now to avoid errors.
- `\Art4\JsonApiClient\Exception\Exception` will extend `\Throwable` in v2.0, do the same in your implementation now to avoid errors.
- `\Art4\JsonApiClient\Factory::make()` methods first parameter signature will be `string` in v2.0.
Expand Down
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
}
],
"require": {
"php": "^7.4 || ^8.0"
"php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.2",
"phpstan/phpstan": "^0.12.99",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9"
},
"autoload": {
Expand All @@ -30,10 +30,11 @@
"Art4\\JsonApiClient\\Tests\\": "tests"
}
},
"scripts": {
"phpstan": "phpstan analyze --memory-limit 512M --configuration .phpstan.neon",
"phpunit": "phpunit"
},
"config": {
"//platform": {
"php": "7.4"
},
"sort-packages": true
}
}
2 changes: 1 addition & 1 deletion src/V1/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ final class Factory implements FactoryInterface
];

/**
* @param array<string, string> $overload specs to be overloaded with custom classes
* @param array<string, class-string> $overload specs to be overloaded with custom classes
*/
public function __construct(array $overload = [])
{
Expand Down
1 change: 1 addition & 0 deletions tests/Fixtures/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

namespace Art4\JsonApiClient\Tests\Fixtures;

#[\AllowDynamicProperties]
class TestCase extends \PHPUnit\Framework\TestCase
{
/**
Expand Down