From 1a6d385f2b71e7b185f4cc7f267e82a7be84e476 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Wed, 1 Dec 2021 13:16:28 -0600 Subject: [PATCH 1/2] feat: prepare for PHP 8.1 support - Add 8.1.0 to list of PHP constraints - Bump laminas-db constraint - Bump PHPUnit constraint - Switch from laminas-zendframework-bridge + replace rule to conflict rule Signed-off-by: Matthew Weier O'Phinney --- composer.json | 13 ++++++------- composer.lock | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 0d63af6b..6033e6d6 100644 --- a/composer.json +++ b/composer.json @@ -25,18 +25,17 @@ } }, "require": { - "php": "^7.4 || ~8.0.0", + "php": "^7.4 || ~8.0.0 || ~8.1.0", "laminas/laminas-filter": "^2.9.1", "laminas/laminas-servicemanager": "^3.3.1", "laminas/laminas-stdlib": "^3.0", - "laminas/laminas-validator": "^2.11", - "laminas/laminas-zendframework-bridge": "^1.0" + "laminas/laminas-validator": "^2.11" }, "require-dev": { "laminas/laminas-coding-standard": "~2.2.1", - "laminas/laminas-db": "^2.12", + "laminas/laminas-db": "^2.13.4", "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.4.2", + "phpunit/phpunit": "^9.5.5", "psalm/plugin-phpunit": "^0.15.1", "psr/http-message": "^1.0", "vimeo/psalm": "^4.6" @@ -65,7 +64,7 @@ "test-coverage": "phpunit --colors=always --coverage-clover clover.xml", "static-analysis": "psalm --shepherd --stats" }, - "replace": { - "zendframework/zend-inputfilter": "^2.10.1" + "conflict": { + "zendframework/zend-inputfilter": "*" } } diff --git a/composer.lock b/composer.lock index 822b78b2..fdbc8bbe 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "93baa8c57365cf18ab53eb43734820ed", + "content-hash": "75e06fef19934e72f535114105926545", "packages": [ { "name": "container-interop/container-interop", @@ -4730,7 +4730,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.4 || ~8.0.0" + "php": "^7.4 || ~8.0.0 || ~8.1.0" }, "platform-dev": [], "plugin-api-version": "2.1.0" From 640e0d471b04132e9205f7f081a58624d6595c65 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 2 Dec 2021 08:37:08 -0600 Subject: [PATCH 2/2] feat: provide PHP 8.1 support - Bump laminas-filter to 2.13 - Bump laminas-validator to 2.15 - Bump Prophecy to 1.14 - Ignore UnusedClass errors that reference ZF classes - Add `#[ReturnTypeWillChange]` attribute to `BaseInputFilter::count()` implementation - Ignore platform requirements when testing for PHP 8.1 (primarily due to laminas-coding-standard version) Signed-off-by: Matthew Weier O'Phinney --- .laminas-ci.json | 5 ++ composer.json | 5 +- composer.lock | 127 ++++++++++------------------------------ phpunit.xml.dist | 28 +++++---- psalm-baseline.xml | 6 -- psalm.xml.dist | 9 +++ src/BaseInputFilter.php | 3 + 7 files changed, 68 insertions(+), 115 deletions(-) create mode 100644 .laminas-ci.json diff --git a/.laminas-ci.json b/.laminas-ci.json new file mode 100644 index 00000000..bce3fa21 --- /dev/null +++ b/.laminas-ci.json @@ -0,0 +1,5 @@ +{ + "ignore_php_platform_requirements": { + "8.1": true + } +} diff --git a/composer.json b/composer.json index 6033e6d6..b90bd415 100644 --- a/composer.json +++ b/composer.json @@ -26,14 +26,15 @@ }, "require": { "php": "^7.4 || ~8.0.0 || ~8.1.0", - "laminas/laminas-filter": "^2.9.1", + "laminas/laminas-filter": "^2.13", "laminas/laminas-servicemanager": "^3.3.1", "laminas/laminas-stdlib": "^3.0", - "laminas/laminas-validator": "^2.11" + "laminas/laminas-validator": "^2.15" }, "require-dev": { "laminas/laminas-coding-standard": "~2.2.1", "laminas/laminas-db": "^2.13.4", + "phpspec/prophecy": "^1.14", "phpspec/prophecy-phpunit": "^2.0", "phpunit/phpunit": "^9.5.5", "psalm/plugin-phpunit": "^0.15.1", diff --git a/composer.lock b/composer.lock index fdbc8bbe..6628266f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "75e06fef19934e72f535114105926545", + "content-hash": "1d244764861f19f547e5d2fb9a6162ce", "packages": [ { "name": "container-interop/container-interop", @@ -44,40 +44,37 @@ }, { "name": "laminas/laminas-filter", - "version": "2.12.0", + "version": "2.13.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-filter.git", - "reference": "0fc5dcd27dc22dba1a2544123684c67768fc5f88" + "reference": "67d88c471cb7016f495aeb1d3fd03edaa9bd9e70" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-filter/zipball/0fc5dcd27dc22dba1a2544123684c67768fc5f88", - "reference": "0fc5dcd27dc22dba1a2544123684c67768fc5f88", + "url": "https://api.github.com/repos/laminas/laminas-filter/zipball/67d88c471cb7016f495aeb1d3fd03edaa9bd9e70", + "reference": "67d88c471cb7016f495aeb1d3fd03edaa9bd9e70", "shasum": "" }, "require": { - "laminas/laminas-stdlib": "^3.3", - "laminas/laminas-zendframework-bridge": "^1.0", - "php": "^7.3 || ~8.0.0" + "laminas/laminas-stdlib": "^3.6.1", + "php": "^7.4 || ~8.0.0 || ~8.1.0" }, "conflict": { - "laminas/laminas-validator": "<2.10.1" - }, - "replace": { - "zendframework/zend-filter": "^2.9.2" + "laminas/laminas-validator": "<2.10.1", + "zendframework/zend-filter": "*" }, "require-dev": { - "laminas/laminas-coding-standard": "~1.0.0", - "laminas/laminas-crypt": "^3.2.1", - "laminas/laminas-servicemanager": "^3.3", - "laminas/laminas-uri": "^2.6", - "pear/archive_tar": "^1.4.3", - "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.3", - "psalm/plugin-phpunit": "^0.15.1", - "psr/http-factory": "^1.0", - "vimeo/psalm": "^4.6" + "laminas/laminas-coding-standard": "^2.3.0", + "laminas/laminas-crypt": "^3.5.1", + "laminas/laminas-servicemanager": "^3.7.0", + "laminas/laminas-uri": "^2.9.1", + "pear/archive_tar": "^1.4.14", + "phpspec/prophecy-phpunit": "^2.0.1", + "phpunit/phpunit": "^9.5.10", + "psalm/plugin-phpunit": "^0.15.2", + "psr/http-factory": "^1.0.1", + "vimeo/psalm": "^4.13.1" }, "suggest": { "laminas/laminas-crypt": "Laminas\\Crypt component, for encryption filters", @@ -122,7 +119,7 @@ "type": "community_bridge" } ], - "time": "2021-10-24T21:01:15+00:00" + "time": "2021-12-02T14:12:59+00:00" }, { "name": "laminas/laminas-servicemanager", @@ -271,16 +268,16 @@ }, { "name": "laminas/laminas-validator", - "version": "2.15.0", + "version": "2.15.1", "source": { "type": "git", "url": "https://github.com/laminas/laminas-validator.git", - "reference": "270380e87904f5a1a1fba3059989d4ca157e16a9" + "reference": "fbd87f30c0a27aaeeee8adb2f934c14fb6046c80" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-validator/zipball/270380e87904f5a1a1fba3059989d4ca157e16a9", - "reference": "270380e87904f5a1a1fba3059989d4ca157e16a9", + "url": "https://api.github.com/repos/laminas/laminas-validator/zipball/fbd87f30c0a27aaeeee8adb2f934c14fb6046c80", + "reference": "fbd87f30c0a27aaeeee8adb2f934c14fb6046c80", "shasum": "" }, "require": { @@ -357,69 +354,7 @@ "type": "community_bridge" } ], - "time": "2021-09-08T23:16:56+00:00" - }, - { - "name": "laminas/laminas-zendframework-bridge", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/laminas/laminas-zendframework-bridge.git", - "reference": "bf180a382393e7db5c1e8d0f2ec0c4af9c724baf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/bf180a382393e7db5c1e8d0f2ec0c4af9c724baf", - "reference": "bf180a382393e7db5c1e8d0f2ec0c4af9c724baf", - "shasum": "" - }, - "require": { - "php": "^7.3 || ~8.0.0 || ~8.1.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3", - "psalm/plugin-phpunit": "^0.15.1", - "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "^4.6" - }, - "type": "library", - "extra": { - "laminas": { - "module": "Laminas\\ZendFrameworkBridge" - } - }, - "autoload": { - "files": [ - "src/autoload.php" - ], - "psr-4": { - "Laminas\\ZendFrameworkBridge\\": "src//" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Alias legacy ZF class names to Laminas Project equivalents.", - "keywords": [ - "ZendFramework", - "autoloading", - "laminas", - "zf" - ], - "support": { - "forum": "https://discourse.laminas.dev/", - "issues": "https://github.com/laminas/laminas-zendframework-bridge/issues", - "rss": "https://github.com/laminas/laminas-zendframework-bridge/releases.atom", - "source": "https://github.com/laminas/laminas-zendframework-bridge" - }, - "funding": [ - { - "url": "https://funding.communitybridge.org/projects/laminas-project", - "type": "community_bridge" - } - ], - "time": "2021-09-03T17:53:30+00:00" + "time": "2021-12-02T14:23:06+00:00" }, { "name": "psr/container", @@ -1996,16 +1931,16 @@ }, { "name": "phpunit/php-file-iterator", - "version": "3.0.5", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8" + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/aa4be8575f26070b100fccb67faabb28f21f66f8", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", "shasum": "" }, "require": { @@ -2044,7 +1979,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.5" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" }, "funding": [ { @@ -2052,7 +1987,7 @@ "type": "github" } ], - "time": "2020-09-28T05:57:25+00:00" + "time": "2021-12-02T12:48:52+00:00" }, { "name": "phpunit/php-invoker", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 7b10e0ed..461e8156 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,13 +1,19 @@ - - - - src - - - - - ./test - - + + + + src + + + + + + ./test + + diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 2a1e51dd..faf1d867 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1547,10 +1547,4 @@ addServiceManager - - - => - fn - - diff --git a/psalm.xml.dist b/psalm.xml.dist index c098e320..54aed230 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -28,6 +28,15 @@ + + + + + + + + + diff --git a/src/BaseInputFilter.php b/src/BaseInputFilter.php index 4b93cb9d..e3dcf61d 100644 --- a/src/BaseInputFilter.php +++ b/src/BaseInputFilter.php @@ -4,6 +4,8 @@ use Laminas\Stdlib\ArrayUtils; use Laminas\Stdlib\InitializableInterface; +// phpcs:ignore SlevomatCodingStandard.Namespaces.UnusedUses.UnusedUse +use ReturnTypeWillChange; use Traversable; use function array_diff; @@ -62,6 +64,7 @@ public function init() * * @return int */ + #[ReturnTypeWillChange] public function count() { return count($this->inputs);