-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from karriereat/dev/php-82
Add PHP 8.2. Support
- Loading branch information
Showing
23 changed files
with
467 additions
and
460 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
|
||
strategy: | ||
fail-fast: true | ||
matrix: | ||
php: [ "8.0", "8.1", "8.2" ] | ||
|
||
runs-on: ubuntu-latest | ||
name: PHP@${{ matrix.php }} | ||
|
||
steps: | ||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Validate composer.json and composer.lock | ||
run: composer validate | ||
|
||
- name: Install dependencies | ||
run: composer install --prefer-dist --no-progress --no-suggest | ||
|
||
- name: Lint code | ||
run: composer run-script lint | ||
|
||
- name: Analyse code | ||
run: composer run-script analyse | ||
|
||
- name: Test code | ||
run: composer run-script test |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,5 @@ build/ | |
coverage/ | ||
coverage.xml | ||
composer.lock | ||
.php_cs.cache | ||
.phpunit.result.cache | ||
.phpunit.result.cache | ||
junit.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# Upgrade Guide | ||
|
||
## v2 to v3 | ||
Most likely this new major version does not contain any breaking changes. Only potential for breaking changes | ||
are return types and type hints. | ||
|
||
### Constructor signature changes | ||
|
||
#### State.php | ||
```php | ||
// Before | ||
public function __construct($identifier, $name, $data) {} | ||
|
||
// After | ||
public function __construct(private string $identifier, private string $name, private array $data) {} | ||
``` | ||
|
||
#### Stores/CacheStore.php | ||
```php | ||
// Before | ||
public function __construct($statePrefix, CacheItemPoolInterface $cacheItemPool, $expiresAfter = 300) {} | ||
|
||
// After | ||
public function __construct( | ||
string $statePrefix, | ||
private CacheItemPoolInterface $cacheItemPool, | ||
private int $expiresAfter = 300, | ||
) {} | ||
``` | ||
|
||
#### Stores/SessionStore.php | ||
```php | ||
// Before | ||
public function __construct($statePrefix, Session $session) {} | ||
|
||
// After | ||
public function __construct(string $statePrefix, private Session $session) {} | ||
``` | ||
|
||
#### Stores/Store.php | ||
```php | ||
// Before | ||
public function __construct($statePrefix) {} | ||
|
||
// After | ||
public function __construct(protected string $statePrefix) {} | ||
``` | ||
|
||
### Signature changes of public methods | ||
|
||
#### Factories/StateFactory.php | ||
```php | ||
// Before | ||
public function build($name, $data) {} | ||
|
||
// After | ||
public function build(string $name, array $data): State {} | ||
``` | ||
|
||
#### State.php | ||
```php | ||
// Before | ||
public function identifier() {} | ||
public function name() {} | ||
public function hasName($name) {} | ||
public function set($data) {} | ||
public function isEmpty() {} | ||
public function raw() {} | ||
public function collection() {} | ||
|
||
// After | ||
public function identifier(): string {} | ||
public function name(): string {} | ||
public function hasName(string $name): bool {} | ||
public function set(array $data): void {} | ||
public function isEmpty(): bool {} | ||
public function raw(): array {} | ||
public function collection(): Collection {} | ||
``` | ||
|
||
#### All "Store classes" (`Stores/*Store.php`) | ||
```php | ||
// Before | ||
public function put(State $state) {} | ||
public function get($identifier, $keepState = false) {} | ||
protected function getStoreKey($identifier) {} | ||
|
||
// After | ||
public function put(State $state): void {} | ||
public function get(string $identifier, bool $keepState = false): State {} | ||
protected function getStoreKey(string $identifier): string {} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
parameters: | ||
paths: | ||
- src | ||
level: max | ||
checkGenericClassInNonGenericObjectType: false | ||
excludePaths: | ||
- src/StateServiceProvider.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
verbose="true" | ||
convertDeprecationsToExceptions="true" | ||
> | ||
<testsuites> | ||
<testsuite name="State Test Suite"> | ||
<directory suffix="Test.php">./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<coverage processUncoveredFiles="true"> | ||
<include> | ||
<directory suffix=".php">./src</directory> | ||
</include> | ||
<exclude> | ||
<file>./src/StateServiceProvider.php</file> | ||
<file>./src/StoreFacade.php</file> | ||
</exclude> | ||
</coverage> | ||
</phpunit> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.