diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 2fd73ad..115a506 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -1,6 +1,5 @@ -ARG BASE_IMAGE=php:8.1-cli-alpine3.14 +ARG BASE_IMAGE=php:8.1-cli-alpine FROM ${BASE_IMAGE} RUN php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer -RUN apk add --no-cache python3 \ - && ln -s /usr/bin/python3 /usr/bin/python +RUN apk add --no-cache python3 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e0ecfcc..4038ef8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ jobs: - { php: 8.1, dependencies: "highest" } - { php: 8.2, dependencies: "highest" } - { php: 8.3, dependencies: "highest" } + - { php: 8.4, dependencies: "highest" } steps: - name: Checkout uses: actions/checkout@v2 @@ -39,8 +40,10 @@ jobs: - { phpunit: 10, php: 8.1 } - { phpunit: 10, php: 8.2 } - { phpunit: 10, php: 8.3 } + - { phpunit: 10, php: 8.4 } - { phpunit: 11, php: 8.2 } - { phpunit: 11, php: 8.3 } + - { phpunit: 11, php: 8.4 } steps: - name: Checkout uses: actions/checkout@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c0c6aa..51c0e0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ The project follows [semantic versioning](http://semver.org/). `BC` stands for a ## [Unreleased] ### Added -* Support for PHP 8.2 +* Support for PHP 8.2, 8.3, 8.4 ### Removed * Support for PHP < 8.1 * Support for PHPUnit < 10 diff --git a/Makefile b/Makefile index 8a68b93..50e3a74 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,15 @@ .PHONY: run-php-8.1 run-php-8.1: - docker-compose run php-8.1 sh + docker compose run php-8.1 sh .PHONY: run-php-8.2 run-php-8.2: - docker-compose run php-8.2 sh + docker compose run php-8.2 sh + +.PHONY: run-php-8.3 +run-php-8.3: + docker compose run php-8.3 sh + +.PHONY: run-php-8.4 +run-php-8.4: + docker compose run php-8.4 sh diff --git a/README.md b/README.md index fa579b7..773a00b 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ In property-based testing, several properties that the System Under Test must re ## Compatibility -- PHP 8.1, 8.2, 8.3 +- PHP 8.1, 8.2, 8.3, 8.4 - PHPUnit 10.x, 11.x ## Installation diff --git a/docker-compose.yml b/docker-compose.yml index 5affdb1..1975ad6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,7 +9,7 @@ services: build: context: .docker args: - BASE_IMAGE: php:8.1-cli-alpine3.14 + BASE_IMAGE: php:8.1-cli-alpine volumes: - .:/usr/src/eris user: 1000:1000 @@ -18,7 +18,25 @@ services: build: context: .docker args: - BASE_IMAGE: php:8.2-cli-alpine3.16 + BASE_IMAGE: php:8.2-cli-alpine + volumes: + - .:/usr/src/eris + user: 1000:1000 + working_dir: /usr/src/eris + php-8.3: + build: + context: .docker + args: + BASE_IMAGE: php:8.3-cli-alpine + volumes: + - .:/usr/src/eris + user: 1000:1000 + working_dir: /usr/src/eris + php-8.4: + build: + context: .docker + args: + BASE_IMAGE: php:8.4-cli-alpine volumes: - .:/usr/src/eris user: 1000:1000 diff --git a/src/Generator/IntegerGenerator.php b/src/Generator/IntegerGenerator.php index 8a50fad..2083372 100644 --- a/src/Generator/IntegerGenerator.php +++ b/src/Generator/IntegerGenerator.php @@ -47,7 +47,7 @@ class IntegerGenerator implements Generator { private $mapFn; - public function __construct(callable $mapFn = null) + public function __construct(?callable $mapFn = null) { if (is_null($mapFn)) { $this->mapFn = $this->identity(); diff --git a/src/Listener.php b/src/Listener.php index 380e3d7..e1dd451 100644 --- a/src/Listener.php +++ b/src/Listener.php @@ -18,7 +18,7 @@ public function startPropertyVerification(); * @param null|Exception $exception tells if the test has failed and specifies the exact exception * @return void */ - public function endPropertyVerification($ordinaryEvaluations, $iterations, Exception $exception = null); + public function endPropertyVerification($ordinaryEvaluations, $iterations, ?Exception $exception = null); /** * @param array $generation of mixed values diff --git a/src/Listener/CollectFrequencies.php b/src/Listener/CollectFrequencies.php index 25b63e8..8718429 100644 --- a/src/Listener/CollectFrequencies.php +++ b/src/Listener/CollectFrequencies.php @@ -9,7 +9,7 @@ /** * @see Listeners::collectFrequencies() */ -function collectFrequencies(callable $collectFunction = null) +function collectFrequencies(?callable $collectFunction = null) { return Listeners::collectFrequencies($collectFunction); } @@ -40,7 +40,7 @@ public function __construct($collectFunction = null) $this->collectFunction = $collectFunction; } - public function endPropertyVerification($ordinaryEvaluations, $iterations, Exception $exception = null) + public function endPropertyVerification($ordinaryEvaluations, $iterations, ?Exception $exception = null) { arsort($this->collectedValues, SORT_NUMERIC); echo PHP_EOL; diff --git a/src/Listener/EmptyListener.php b/src/Listener/EmptyListener.php index 2cdbb29..d11afea 100644 --- a/src/Listener/EmptyListener.php +++ b/src/Listener/EmptyListener.php @@ -10,7 +10,7 @@ public function startPropertyVerification() { } - public function endPropertyVerification($ordinaryEvaluations, $iterations, Exception $exception = null) + public function endPropertyVerification($ordinaryEvaluations, $iterations, ?Exception $exception = null) { } diff --git a/src/Listener/Log.php b/src/Listener/Log.php index 4d846b5..c11325b 100644 --- a/src/Listener/Log.php +++ b/src/Listener/Log.php @@ -40,7 +40,7 @@ public function newGeneration(array $generation, $iteration) )); } - public function endPropertyVerification($ordinaryEvaluations, $iterations, Exception $exception = null) + public function endPropertyVerification($ordinaryEvaluations, $iterations, ?Exception $exception = null) { fclose($this->fp); } diff --git a/src/Listener/MinimumEvaluations.php b/src/Listener/MinimumEvaluations.php index e8bbe46..8e09872 100644 --- a/src/Listener/MinimumEvaluations.php +++ b/src/Listener/MinimumEvaluations.php @@ -23,7 +23,7 @@ private function __construct($threshold) $this->threshold = $threshold; } - public function endPropertyVerification($ordinaryEvaluations, $iterations, Exception $exception = null) + public function endPropertyVerification($ordinaryEvaluations, $iterations, ?Exception $exception = null) { if ($exception) { return; diff --git a/src/Listeners.php b/src/Listeners.php index ca87a60..48872fc 100644 --- a/src/Listeners.php +++ b/src/Listeners.php @@ -7,7 +7,7 @@ final class Listeners { - public static function collectFrequencies(callable $collectFunction = null) + public static function collectFrequencies(?callable $collectFunction = null) { return new CollectFrequencies($collectFunction); } diff --git a/src/TestTrait.php b/src/TestTrait.php index 7bfe58a..4bd2be6 100644 --- a/src/TestTrait.php +++ b/src/TestTrait.php @@ -57,13 +57,13 @@ public function getTestCaseAttributes() } $methodAttributes = []; - foreach($reflectionClass->getMethods() as $method) { - if($method->getName() !== $this->name()) { + foreach ($reflectionClass->getMethods() as $method) { + if ($method->getName() !== $this->name()) { continue; } $attributes = $method->getAttributes(); - if(!empty($attributes)) { + if (!empty($attributes)) { foreach ($attributes as $attribute) { $methodAttributes[$attribute->getName()] = ($attribute)->newInstance(); }