diff --git a/.gitignore b/.gitignore index b640e945..03e91160 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /.phpunit.result.cache +/.phpcs-cache /.psalm-cache /clover.xml /coveralls-upload.json diff --git a/composer.json b/composer.json index 2f428aec..cb97d0d4 100644 --- a/composer.json +++ b/composer.json @@ -25,20 +25,20 @@ } }, "require": { - "php": "^7.3 || ~8.0.0", - "laminas/laminas-stdlib": "^3.3" + "php": "^7.4 || ~8.0.0 || ~8.1.0", + "laminas/laminas-stdlib": "^3.6.1" }, "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" }, "conflict": { "laminas/laminas-validator": "<2.10.1", diff --git a/composer.lock b/composer.lock index 4db8c52c..7b8f6a5c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,33 +4,34 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0ff030dfd97d51ddf2ad711c00dbb420", + "content-hash": "3d877c48543a78c9413ca5e7e6ef01ac", "packages": [ { "name": "laminas/laminas-stdlib", - "version": "3.3.1", + "version": "3.6.1", "source": { "type": "git", "url": "https://github.com/laminas/laminas-stdlib.git", - "reference": "d81c7ffe602ed0e6ecb18691019111c0f4bf1efe" + "reference": "db581851a092246ad99e12d4fddf105184924c71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-stdlib/zipball/d81c7ffe602ed0e6ecb18691019111c0f4bf1efe", - "reference": "d81c7ffe602ed0e6ecb18691019111c0f4bf1efe", + "url": "https://api.github.com/repos/laminas/laminas-stdlib/zipball/db581851a092246ad99e12d4fddf105184924c71", + "reference": "db581851a092246ad99e12d4fddf105184924c71", "shasum": "" }, "require": { - "laminas/laminas-zendframework-bridge": "^1.0", - "php": "^7.3 || ^8.0" + "php": "^7.3 || ~8.0.0 || ~8.1.0" }, - "replace": { - "zendframework/zend-stdlib": "^3.2.1" + "conflict": { + "zendframework/zend-stdlib": "*" }, "require-dev": { - "laminas/laminas-coding-standard": "~1.0.0", + "laminas/laminas-coding-standard": "~2.3.0", "phpbench/phpbench": "^0.17.1", - "phpunit/phpunit": "~9.3.7" + "phpunit/phpunit": "~9.3.7", + "psalm/plugin-phpunit": "^0.16.0", + "vimeo/psalm": "^4.7" }, "type": "library", "autoload": { @@ -62,95 +63,33 @@ "type": "community_bridge" } ], - "time": "2020-11-19T20:18:59+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-11-10T11:33:52+00:00" } ], "packages-dev": [ { "name": "amphp/amp", - "version": "v2.5.2", + "version": "v2.6.1", "source": { "type": "git", "url": "https://github.com/amphp/amp.git", - "reference": "efca2b32a7580087adb8aabbff6be1dc1bb924a9" + "reference": "c5fc66a78ee38d7ac9195a37bacaf940eb3f65ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/amp/zipball/efca2b32a7580087adb8aabbff6be1dc1bb924a9", - "reference": "efca2b32a7580087adb8aabbff6be1dc1bb924a9", + "url": "https://api.github.com/repos/amphp/amp/zipball/c5fc66a78ee38d7ac9195a37bacaf940eb3f65ae", + "reference": "c5fc66a78ee38d7ac9195a37bacaf940eb3f65ae", "shasum": "" }, "require": { - "php": ">=7" + "php": ">=7.1" }, "require-dev": { "amphp/php-cs-fixer-config": "dev-master", "amphp/phpunit-util": "^1", "ext-json": "*", "jetbrains/phpstorm-stubs": "^2019.3", - "phpunit/phpunit": "^6.0.9 | ^7", + "phpunit/phpunit": "^7 | ^8 | ^9", "psalm/phar": "^3.11@dev", "react/promise": "^2" }, @@ -207,7 +146,7 @@ "support": { "irc": "irc://irc.freenode.org/amphp", "issues": "https://github.com/amphp/amp/issues", - "source": "https://github.com/amphp/amp/tree/v2.5.2" + "source": "https://github.com/amphp/amp/tree/v2.6.1" }, "funding": [ { @@ -215,20 +154,20 @@ "type": "github" } ], - "time": "2021-01-10T17:06:37+00:00" + "time": "2021-09-23T18:43:08+00:00" }, { "name": "amphp/byte-stream", - "version": "v1.8.0", + "version": "v1.8.1", "source": { "type": "git", "url": "https://github.com/amphp/byte-stream.git", - "reference": "f0c20cf598a958ba2aa8c6e5a71c697d652c7088" + "reference": "acbd8002b3536485c997c4e019206b3f10ca15bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/byte-stream/zipball/f0c20cf598a958ba2aa8c6e5a71c697d652c7088", - "reference": "f0c20cf598a958ba2aa8c6e5a71c697d652c7088", + "url": "https://api.github.com/repos/amphp/byte-stream/zipball/acbd8002b3536485c997c4e019206b3f10ca15bd", + "reference": "acbd8002b3536485c997c4e019206b3f10ca15bd", "shasum": "" }, "require": { @@ -284,22 +223,28 @@ "support": { "irc": "irc://irc.freenode.org/amphp", "issues": "https://github.com/amphp/byte-stream/issues", - "source": "https://github.com/amphp/byte-stream/tree/master" + "source": "https://github.com/amphp/byte-stream/tree/v1.8.1" }, - "time": "2020-06-29T18:35:05+00:00" + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2021-03-30T17:13:30+00:00" }, { "name": "composer/package-versions-deprecated", - "version": "1.11.99.1", + "version": "1.11.99.4", "source": { "type": "git", "url": "https://github.com/composer/package-versions-deprecated.git", - "reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6" + "reference": "b174585d1fe49ceed21928a945138948cb394600" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/7413f0b55a051e89485c5cb9f765fe24bb02a7b6", - "reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6", + "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b174585d1fe49ceed21928a945138948cb394600", + "reference": "b174585d1fe49ceed21928a945138948cb394600", "shasum": "" }, "require": { @@ -343,7 +288,7 @@ "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", "support": { "issues": "https://github.com/composer/package-versions-deprecated/issues", - "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.1" + "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.4" }, "funding": [ { @@ -359,20 +304,20 @@ "type": "tidelift" } ], - "time": "2020-11-11T10:22:58+00:00" + "time": "2021-09-13T08:41:34+00:00" }, { "name": "composer/semver", - "version": "3.2.4", + "version": "3.2.6", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "a02fdf930a3c1c3ed3a49b5f63859c0c20e10464" + "reference": "83e511e247de329283478496f7a1e114c9517506" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/a02fdf930a3c1c3ed3a49b5f63859c0c20e10464", - "reference": "a02fdf930a3c1c3ed3a49b5f63859c0c20e10464", + "url": "https://api.github.com/repos/composer/semver/zipball/83e511e247de329283478496f7a1e114c9517506", + "reference": "83e511e247de329283478496f7a1e114c9517506", "shasum": "" }, "require": { @@ -424,7 +369,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.2.4" + "source": "https://github.com/composer/semver/tree/3.2.6" }, "funding": [ { @@ -440,28 +385,29 @@ "type": "tidelift" } ], - "time": "2020-11-13T08:59:24+00:00" + "time": "2021-10-25T11:34:17+00:00" }, { "name": "composer/xdebug-handler", - "version": "1.4.5", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "f28d44c286812c714741478d968104c5e604a1d4" + "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/f28d44c286812c714741478d968104c5e604a1d4", - "reference": "f28d44c286812c714741478d968104c5e604a1d4", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/84674dd3a7575ba617f5a76d7e9e29a7d3891339", + "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0" + "psr/log": "^1 || ^2 || ^3" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" + "phpstan/phpstan": "^0.12.55", + "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", "autoload": { @@ -487,7 +433,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/1.4.5" + "source": "https://github.com/composer/xdebug-handler/tree/2.0.2" }, "funding": [ { @@ -503,7 +449,7 @@ "type": "tidelift" } ], - "time": "2020-11-13T08:04:11+00:00" + "time": "2021-07-31T17:03:58+00:00" }, { "name": "container-interop/container-interop", @@ -541,6 +487,76 @@ "abandoned": "psr/container", "time": "2017-02-14T19:40:03+00:00" }, + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v0.7.1", + "source": { + "type": "git", + "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", + "reference": "fe390591e0241955f22eb9ba327d137e501c771c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/fe390591e0241955f22eb9ba327d137e501c771c", + "reference": "fe390591e0241955f22eb9ba327d137e501c771c", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0 || ^2.0", + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2.0 || ^3.0 || ^4.0" + }, + "require-dev": { + "composer/composer": "*", + "phpcompatibility/php-compatibility": "^9.0", + "sensiolabs/security-checker": "^4.1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "autoload": { + "psr-4": { + "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "franck.nijhof@dealerdirect.com", + "homepage": "http://www.frenck.nl", + "role": "Developer / IT Manager" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "homepage": "http://www.dealerdirect.com", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "support": { + "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", + "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" + }, + "time": "2020-12-07T18:04:37+00:00" + }, { "name": "dnoegel/php-xdg-base-dir", "version": "v0.1.1", @@ -649,20 +665,20 @@ }, { "name": "felixfbecker/advanced-json-rpc", - "version": "v3.2.0", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/felixfbecker/php-advanced-json-rpc.git", - "reference": "06f0b06043c7438959dbdeed8bb3f699a19be22e" + "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/06f0b06043c7438959dbdeed8bb3f699a19be22e", - "reference": "06f0b06043c7438959dbdeed8bb3f699a19be22e", + "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/b5f37dbff9a8ad360ca341f3240dc1c168b45447", + "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447", "shasum": "" }, "require": { - "netresearch/jsonmapper": "^1.0 || ^2.0", + "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", "php": "^7.1 || ^8.0", "phpdocumentor/reflection-docblock": "^4.3.4 || ^5.0.0" }, @@ -688,9 +704,9 @@ "description": "A more advanced JSONRPC implementation", "support": { "issues": "https://github.com/felixfbecker/php-advanced-json-rpc/issues", - "source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/v3.2.0" + "source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/v3.2.1" }, - "time": "2021-01-10T17:48:47+00:00" + "time": "2021-06-11T22:34:44+00:00" }, { "name": "felixfbecker/language-server-protocol", @@ -750,31 +766,36 @@ }, { "name": "laminas/laminas-coding-standard", - "version": "1.0.0", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-coding-standard.git", - "reference": "08880ce2fbfe62d471cd3cb766a91da630b32539" + "reference": "bcf6e07fe4690240be7beb6d884d0b0fafa6a251" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-coding-standard/zipball/08880ce2fbfe62d471cd3cb766a91da630b32539", - "reference": "08880ce2fbfe62d471cd3cb766a91da630b32539", + "url": "https://api.github.com/repos/laminas/laminas-coding-standard/zipball/bcf6e07fe4690240be7beb6d884d0b0fafa6a251", + "reference": "bcf6e07fe4690240be7beb6d884d0b0fafa6a251", "shasum": "" }, "require": { - "laminas/laminas-zendframework-bridge": "^1.0", - "squizlabs/php_codesniffer": "^2.7" + "dealerdirect/phpcodesniffer-composer-installer": "^0.7", + "php": "^7.3 || ^8.0", + "slevomat/coding-standard": "^7.0", + "squizlabs/php_codesniffer": "^3.6", + "webimpress/coding-standard": "^1.2" }, - "replace": { - "zendframework/zend-coding-standard": "self.version" + "type": "phpcodesniffer-standard", + "autoload": { + "psr-4": { + "LaminasCodingStandard\\": "src/LaminasCodingStandard/" + } }, - "type": "library", "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "description": "Laminas coding standard", + "description": "Laminas Coding Standard", "homepage": "https://laminas.dev", "keywords": [ "Coding Standard", @@ -788,29 +809,35 @@ "rss": "https://github.com/laminas/laminas-coding-standard/releases.atom", "source": "https://github.com/laminas/laminas-coding-standard" }, - "time": "2019-12-31T16:28:26+00:00" + "funding": [ + { + "url": "https://funding.communitybridge.org/projects/laminas-project", + "type": "community_bridge" + } + ], + "time": "2021-05-29T15:53:59+00:00" }, { "name": "laminas/laminas-crypt", - "version": "3.4.0", + "version": "3.5.1", "source": { "type": "git", "url": "https://github.com/laminas/laminas-crypt.git", - "reference": "a058eeb2fe57824b958ac56753faff790a649e18" + "reference": "026fe31aa5c9d68679267e5473d64d96f4576020" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-crypt/zipball/a058eeb2fe57824b958ac56753faff790a649e18", - "reference": "a058eeb2fe57824b958ac56753faff790a649e18", + "url": "https://api.github.com/repos/laminas/laminas-crypt/zipball/026fe31aa5c9d68679267e5473d64d96f4576020", + "reference": "026fe31aa5c9d68679267e5473d64d96f4576020", "shasum": "" }, "require": { "container-interop/container-interop": "^1.2", "ext-mbstring": "*", - "laminas/laminas-math": "^3.0", - "laminas/laminas-stdlib": "^2.7.7 || ^3.1", + "laminas/laminas-math": "^3.4", + "laminas/laminas-stdlib": "^3.6", "laminas/laminas-zendframework-bridge": "^1.0", - "php": "^7.3 || ~8.0.0" + "php": "^7.3 || ~8.0.0 || ~8.1.0" }, "replace": { "zendframework/zend-crypt": "^3.3.1" @@ -852,31 +879,30 @@ "type": "community_bridge" } ], - "time": "2021-02-11T19:40:03+00:00" + "time": "2021-11-28T16:04:24+00:00" }, { "name": "laminas/laminas-escaper", - "version": "2.7.0", + "version": "2.9.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-escaper.git", - "reference": "5e04bc5ae5990b17159d79d331055e2c645e5cc5" + "reference": "891ad70986729e20ed2e86355fcf93c9dc238a5f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-escaper/zipball/5e04bc5ae5990b17159d79d331055e2c645e5cc5", - "reference": "5e04bc5ae5990b17159d79d331055e2c645e5cc5", + "url": "https://api.github.com/repos/laminas/laminas-escaper/zipball/891ad70986729e20ed2e86355fcf93c9dc238a5f", + "reference": "891ad70986729e20ed2e86355fcf93c9dc238a5f", "shasum": "" }, "require": { - "laminas/laminas-zendframework-bridge": "^1.0", - "php": "^7.3 || ~8.0.0" + "php": "^7.3 || ~8.0.0 || ~8.1.0" }, - "replace": { - "zendframework/zend-escaper": "^2.6.1" + "conflict": { + "zendframework/zend-escaper": "*" }, "require-dev": { - "laminas/laminas-coding-standard": "~1.0.0", + "laminas/laminas-coding-standard": "~2.3.0", "phpunit/phpunit": "^9.3", "psalm/plugin-phpunit": "^0.12.2", "vimeo/psalm": "^3.16" @@ -915,33 +941,33 @@ "type": "community_bridge" } ], - "time": "2020-11-17T21:26:43+00:00" + "time": "2021-09-02T17:10:53+00:00" }, { "name": "laminas/laminas-math", - "version": "3.3.2", + "version": "3.4.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-math.git", - "reference": "188456530923a449470963837c25560f1fdd8a60" + "reference": "79f6453a47a5774cf3736c5c66cb4818486681da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-math/zipball/188456530923a449470963837c25560f1fdd8a60", - "reference": "188456530923a449470963837c25560f1fdd8a60", + "url": "https://api.github.com/repos/laminas/laminas-math/zipball/79f6453a47a5774cf3736c5c66cb4818486681da", + "reference": "79f6453a47a5774cf3736c5c66cb4818486681da", "shasum": "" }, "require": { "ext-mbstring": "*", "laminas/laminas-zendframework-bridge": "^1.0", - "php": "^7.3 || ~8.0.0" + "php": "^7.3 || ~8.0.0 || ~8.1.0" }, "replace": { "zendframework/zend-math": "^3.2.0" }, "require-dev": { "laminas/laminas-coding-standard": "~1.0.0", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.5.5" }, "suggest": { "ext-bcmath": "If using the bcmath functionality", @@ -983,50 +1009,49 @@ "type": "community_bridge" } ], - "time": "2021-02-16T15:46:01+00:00" + "time": "2021-10-09T15:15:23+00:00" }, { "name": "laminas/laminas-servicemanager", - "version": "3.6.4", + "version": "3.10.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-servicemanager.git", - "reference": "b1445e1a7077c21b0fad0974a1b7a11b9dbe0828" + "reference": "e52b985909e0940bf22d34f322eb3f48bbef6bd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/b1445e1a7077c21b0fad0974a1b7a11b9dbe0828", - "reference": "b1445e1a7077c21b0fad0974a1b7a11b9dbe0828", + "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/e52b985909e0940bf22d34f322eb3f48bbef6bd1", + "reference": "e52b985909e0940bf22d34f322eb3f48bbef6bd1", "shasum": "" }, "require": { "container-interop/container-interop": "^1.2", "laminas/laminas-stdlib": "^3.2.1", - "laminas/laminas-zendframework-bridge": "^1.0", - "php": "^7.3 || ~8.0.0", + "php": "~7.4.0 || ~8.0.0 || ~8.1.0", "psr/container": "^1.0" }, "conflict": { "laminas/laminas-code": "<3.3.1", - "zendframework/zend-code": "<3.3.1" + "zendframework/zend-code": "<3.3.1", + "zendframework/zend-servicemanager": "*" }, "provide": { "container-interop/container-interop-implementation": "^1.2", "psr/container-implementation": "^1.0" }, - "replace": { - "zendframework/zend-servicemanager": "^3.4.0" - }, "require-dev": { "composer/package-versions-deprecated": "^1.0", - "laminas/laminas-coding-standard": "~1.0.0", + "laminas/laminas-coding-standard": "~2.2.1", "laminas/laminas-container-config-test": "^0.3", - "laminas/laminas-dependency-plugin": "^2.1", - "mikey179/vfsstream": "^1.6.8", - "ocramius/proxy-manager": "^2.2.3", - "phpbench/phpbench": "^1.0.0-alpha3", + "laminas/laminas-dependency-plugin": "^2.1.2", + "mikey179/vfsstream": "^1.6.10@alpha", + "ocramius/proxy-manager": "^2.11", + "phpbench/phpbench": "^1.1", "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.4" + "phpunit/phpunit": "^9.5.5", + "psalm/plugin-phpunit": "^0.16.1", + "vimeo/psalm": "^4.8" }, "suggest": { "ocramius/proxy-manager": "ProxyManager ^2.1.1 to handle lazy initialization of services" @@ -1070,34 +1095,33 @@ "type": "community_bridge" } ], - "time": "2021-02-03T08:44:41+00:00" + "time": "2021-09-18T20:19:36+00:00" }, { "name": "laminas/laminas-uri", - "version": "2.8.1", + "version": "2.9.1", "source": { "type": "git", "url": "https://github.com/laminas/laminas-uri.git", - "reference": "79bd4c614c8cf9a6ba715a49fca8061e84933d87" + "reference": "7e837dc15c8fd3949df7d1213246fd7c8640032b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-uri/zipball/79bd4c614c8cf9a6ba715a49fca8061e84933d87", - "reference": "79bd4c614c8cf9a6ba715a49fca8061e84933d87", + "url": "https://api.github.com/repos/laminas/laminas-uri/zipball/7e837dc15c8fd3949df7d1213246fd7c8640032b", + "reference": "7e837dc15c8fd3949df7d1213246fd7c8640032b", "shasum": "" }, "require": { - "laminas/laminas-escaper": "^2.5", - "laminas/laminas-validator": "^2.10", - "laminas/laminas-zendframework-bridge": "^1.0", - "php": "^7.3 || ~8.0.0" + "laminas/laminas-escaper": "^2.9", + "laminas/laminas-validator": "^2.15", + "php": "^7.3 || ~8.0.0 || ~8.1.0" }, - "replace": { - "zendframework/zend-uri": "^2.7.1" + "conflict": { + "zendframework/zend-uri": "*" }, "require-dev": { - "laminas/laminas-coding-standard": "^2.1", - "phpunit/phpunit": "^9.3" + "laminas/laminas-coding-standard": "~2.2.1", + "phpunit/phpunit": "^9.5.5" }, "type": "library", "autoload": { @@ -1129,35 +1153,33 @@ "type": "community_bridge" } ], - "time": "2021-02-17T21:53:05+00:00" + "time": "2021-09-09T18:37:15+00:00" }, { "name": "laminas/laminas-validator", - "version": "2.14.4", + "version": "2.15.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-validator.git", - "reference": "e370c4695db1c81e6dfad38d8c4dbdb37b23d776" + "reference": "270380e87904f5a1a1fba3059989d4ca157e16a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-validator/zipball/e370c4695db1c81e6dfad38d8c4dbdb37b23d776", - "reference": "e370c4695db1c81e6dfad38d8c4dbdb37b23d776", + "url": "https://api.github.com/repos/laminas/laminas-validator/zipball/270380e87904f5a1a1fba3059989d4ca157e16a9", + "reference": "270380e87904f5a1a1fba3059989d4ca157e16a9", "shasum": "" }, "require": { "container-interop/container-interop": "^1.1", - "laminas/laminas-stdlib": "^3.3", - "laminas/laminas-zendframework-bridge": "^1.0", - "php": "^7.3 || ~8.0.0" + "laminas/laminas-stdlib": "^3.6", + "php": "^7.3 || ~8.0.0 || ~8.1.0" }, - "replace": { - "zendframework/zend-validator": "^2.13.0" + "conflict": { + "zendframework/zend-validator": "*" }, "require-dev": { "laminas/laminas-cache": "^2.6.1", - "laminas/laminas-coding-standard": "~1.0.0", - "laminas/laminas-config": "^2.6", + "laminas/laminas-coding-standard": "~2.2.1", "laminas/laminas-db": "^2.7", "laminas/laminas-filter": "^2.6", "laminas/laminas-http": "^2.14.2", @@ -1167,7 +1189,7 @@ "laminas/laminas-session": "^2.8", "laminas/laminas-uri": "^2.7", "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.3", + "phpunit/phpunit": "^9.5.5", "psalm/plugin-phpunit": "^0.15.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", @@ -1221,7 +1243,69 @@ "type": "community_bridge" } ], - "time": "2021-01-24T20:45:49+00:00" + "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" }, { "name": "myclabs/deep-copy", @@ -1283,16 +1367,16 @@ }, { "name": "netresearch/jsonmapper", - "version": "v2.1.0", + "version": "v4.0.0", "source": { "type": "git", "url": "https://github.com/cweiske/jsonmapper.git", - "reference": "e0f1e33a71587aca81be5cffbb9746510e1fe04e" + "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/e0f1e33a71587aca81be5cffbb9746510e1fe04e", - "reference": "e0f1e33a71587aca81be5cffbb9746510e1fe04e", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d", + "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d", "shasum": "" }, "require": { @@ -1300,10 +1384,10 @@ "ext-pcre": "*", "ext-reflection": "*", "ext-spl": "*", - "php": ">=5.6" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "~4.8.35 || ~5.7 || ~6.4 || ~7.0", + "phpunit/phpunit": "~7.5 || ~8.0 || ~9.0", "squizlabs/php_codesniffer": "~3.5" }, "type": "library", @@ -1328,22 +1412,22 @@ "support": { "email": "cweiske@cweiske.de", "issues": "https://github.com/cweiske/jsonmapper/issues", - "source": "https://github.com/cweiske/jsonmapper/tree/master" + "source": "https://github.com/cweiske/jsonmapper/tree/v4.0.0" }, - "time": "2020-04-16T18:48:43+00:00" + "time": "2020-12-01T19:48:11+00:00" }, { "name": "nikic/php-parser", - "version": "v4.10.4", + "version": "v4.13.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e" + "reference": "210577fe3cf7badcc5814d99455df46564f3c077" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c6d052fc58cb876152f89f532b95a8d7907e7f0e", - "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", + "reference": "210577fe3cf7badcc5814d99455df46564f3c077", "shasum": "" }, "require": { @@ -1384,9 +1468,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.10.4" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" }, - "time": "2020-12-20T10:01:03+00:00" + "time": "2021-11-30T19:35:32+00:00" }, { "name": "openlss/lib-array2xml", @@ -1574,16 +1658,16 @@ }, { "name": "pear/pear-core-minimal", - "version": "v1.10.10", + "version": "v1.10.11", "source": { "type": "git", "url": "https://github.com/pear/pear-core-minimal.git", - "reference": "625a3c429d9b2c1546438679074cac1b089116a7" + "reference": "68d0d32ada737153b7e93b8d3c710ebe70ac867d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pear/pear-core-minimal/zipball/625a3c429d9b2c1546438679074cac1b089116a7", - "reference": "625a3c429d9b2c1546438679074cac1b089116a7", + "url": "https://api.github.com/repos/pear/pear-core-minimal/zipball/68d0d32ada737153b7e93b8d3c710ebe70ac867d", + "reference": "68d0d32ada737153b7e93b8d3c710ebe70ac867d", "shasum": "" }, "require": { @@ -1618,7 +1702,7 @@ "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=PEAR", "source": "https://github.com/pear/pear-core-minimal" }, - "time": "2019-11-19T19:00:24+00:00" + "time": "2021-08-10T22:31:03+00:00" }, { "name": "pear/pear_exception", @@ -1681,16 +1765,16 @@ }, { "name": "phar-io/manifest", - "version": "2.0.1", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133" + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", - "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", "shasum": "" }, "require": { @@ -1735,9 +1819,9 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/master" + "source": "https://github.com/phar-io/manifest/tree/2.0.3" }, - "time": "2020-06-27T14:33:11+00:00" + "time": "2021-07-20T11:28:43+00:00" }, { "name": "phar-io/version", @@ -1845,16 +1929,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.2.2", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", "shasum": "" }, "require": { @@ -1865,7 +1949,8 @@ "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.2" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -1895,22 +1980,22 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" }, - "time": "2020-09-03T19:13:55+00:00" + "time": "2021-10-19T17:43:47+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.4.0", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" + "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae", + "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae", "shasum": "" }, "require": { @@ -1918,7 +2003,8 @@ "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "*" + "ext-tokenizer": "*", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -1944,39 +2030,39 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1" }, - "time": "2020-09-17T18:55:26+00:00" + "time": "2021-10-02T14:08:47+00:00" }, { "name": "phpspec/prophecy", - "version": "1.12.2", + "version": "1.14.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "245710e971a030f42e08f4912863805570f23d39" + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/245710e971a030f42e08f4912863805570f23d39", - "reference": "245710e971a030f42e08f4912863805570f23d39", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.1", + "php": "^7.2 || ~8.0, <8.2", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^6.0", + "phpspec/phpspec": "^6.0 || ^7.0", "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -2011,9 +2097,9 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.12.2" + "source": "https://github.com/phpspec/prophecy/tree/1.14.0" }, - "time": "2020-12-19T10:15:11+00:00" + "time": "2021-09-10T09:02:12+00:00" }, { "name": "phpspec/prophecy-phpunit", @@ -2067,25 +2153,74 @@ }, "time": "2020-07-09T08:33:42+00:00" }, + { + "name": "phpstan/phpdoc-parser", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "dbc093d7af60eff5cd575d2ed761b15ed40bd08e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/dbc093d7af60eff5cd575d2ed761b15ed40bd08e", + "reference": "dbc093d7af60eff5cd575d2ed761b15ed40bd08e", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "symfony/process": "^5.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.2.0" + }, + "time": "2021-09-16T20:46:02+00:00" + }, { "name": "phpunit/php-code-coverage", - "version": "9.2.5", + "version": "9.2.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1" + "reference": "f301eb1453c9e7a1bc912ee8b0ea9db22c60223b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f3e026641cc91909d421802dd3ac7827ebfd97e1", - "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f301eb1453c9e7a1bc912ee8b0ea9db22c60223b", + "reference": "f301eb1453c9e7a1bc912ee8b0ea9db22c60223b", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.10.2", + "nikic/php-parser": "^4.13.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -2134,7 +2269,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.5" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.9" }, "funding": [ { @@ -2142,20 +2277,20 @@ "type": "github" } ], - "time": "2020-11-28T06:44:49+00:00" + "time": "2021-11-19T15:21:02+00:00" }, { "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": { @@ -2194,7 +2329,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": [ { @@ -2202,7 +2337,7 @@ "type": "github" } ], - "time": "2020-09-28T05:57:25+00:00" + "time": "2021-12-02T12:48:52+00:00" }, { "name": "phpunit/php-invoker", @@ -2387,16 +2522,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.2", + "version": "9.5.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4" + "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f661659747f2f87f9e72095bb207bceb0f151cb4", - "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c814a05837f2edb0d1471d6e3f4ab3501ca3899a", + "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a", "shasum": "" }, "require": { @@ -2408,11 +2543,11 @@ "ext-xml": "*", "ext-xmlwriter": "*", "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.1", + "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.3", + "phpunit/php-code-coverage": "^9.2.7", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -2426,7 +2561,7 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3", + "sebastian/type": "^2.3.4", "sebastian/version": "^3.0.2" }, "require-dev": { @@ -2474,7 +2609,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.2" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.10" }, "funding": [ { @@ -2486,20 +2621,20 @@ "type": "github" } ], - "time": "2021-02-02T14:45:58+00:00" + "time": "2021-09-25T07:38:51+00:00" }, { "name": "psalm/plugin-phpunit", - "version": "0.15.1", + "version": "0.15.2", "source": { "type": "git", "url": "https://github.com/psalm/psalm-plugin-phpunit.git", - "reference": "30ca25ce069bf4943c36e59b7df6954f6af05e64" + "reference": "31d15bbc0169a3c454e495e03fd8a6ccb663661b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/psalm/psalm-plugin-phpunit/zipball/30ca25ce069bf4943c36e59b7df6954f6af05e64", - "reference": "30ca25ce069bf4943c36e59b7df6954f6af05e64", + "url": "https://api.github.com/repos/psalm/psalm-plugin-phpunit/zipball/31d15bbc0169a3c454e495e03fd8a6ccb663661b", + "reference": "31d15bbc0169a3c454e495e03fd8a6ccb663661b", "shasum": "" }, "require": { @@ -2544,26 +2679,26 @@ "description": "Psalm plugin for PHPUnit", "support": { "issues": "https://github.com/psalm/psalm-plugin-phpunit/issues", - "source": "https://github.com/psalm/psalm-plugin-phpunit/tree/0.15.1" + "source": "https://github.com/psalm/psalm-plugin-phpunit/tree/0.15.2" }, - "time": "2021-01-23T00:19:07+00:00" + "time": "2021-05-29T19:11:38+00:00" }, { "name": "psr/container", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", "shasum": "" }, "require": { - "php": ">=7.2.0" + "php": ">=7.4.0" }, "type": "library", "autoload": { @@ -2592,9 +2727,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.1" + "source": "https://github.com/php-fig/container/tree/1.1.2" }, - "time": "2021-03-05T17:36:06+00:00" + "time": "2021-11-05T16:50:12+00:00" }, { "name": "psr/http-factory", @@ -2706,16 +2841,16 @@ }, { "name": "psr/log", - "version": "1.1.3", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", "shasum": "" }, "require": { @@ -2739,7 +2874,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for logging libraries", @@ -2750,9 +2885,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.3" + "source": "https://github.com/php-fig/log/tree/1.1.4" }, - "time": "2020-03-23T09:12:05+00:00" + "time": "2021-05-03T11:20:27+00:00" }, { "name": "sebastian/cli-parser", @@ -3183,16 +3318,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.3", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65" + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d89cc98761b8cb5a1a235a6b703ae50d34080e65", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", "shasum": "" }, "require": { @@ -3241,14 +3376,14 @@ } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", + "homepage": "https://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" }, "funding": [ { @@ -3256,20 +3391,20 @@ "type": "github" } ], - "time": "2020-09-28T05:24:23+00:00" + "time": "2021-11-11T14:18:36+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.2", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "a90ccbddffa067b51f574dea6eb25d5680839455" + "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/a90ccbddffa067b51f574dea6eb25d5680839455", - "reference": "a90ccbddffa067b51f574dea6eb25d5680839455", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", + "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", "shasum": "" }, "require": { @@ -3312,7 +3447,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.2" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3" }, "funding": [ { @@ -3320,7 +3455,7 @@ "type": "github" } ], - "time": "2020-10-26T15:55:19+00:00" + "time": "2021-06-11T13:31:12+00:00" }, { "name": "sebastian/lines-of-code", @@ -3611,16 +3746,16 @@ }, { "name": "sebastian/type", - "version": "2.3.1", + "version": "2.3.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2" + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/81cd61ab7bbf2de744aba0ea61fae32f721df3d2", - "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", "shasum": "" }, "require": { @@ -3655,7 +3790,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.1" + "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" }, "funding": [ { @@ -3663,7 +3798,7 @@ "type": "github" } ], - "time": "2020-10-26T13:18:59+00:00" + "time": "2021-06-15T12:49:02+00:00" }, { "name": "sebastian/version", @@ -3718,66 +3853,100 @@ ], "time": "2020-09-28T06:39:44+00:00" }, + { + "name": "slevomat/coding-standard", + "version": "7.0.16", + "source": { + "type": "git", + "url": "https://github.com/slevomat/coding-standard.git", + "reference": "14c324b2f2f0072933036c2f3abaeda16a56dcd3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/14c324b2f2f0072933036c2f3abaeda16a56dcd3", + "reference": "14c324b2f2f0072933036c2f3abaeda16a56dcd3", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7", + "php": "^7.1 || ^8.0", + "phpstan/phpdoc-parser": "^1.0.0", + "squizlabs/php_codesniffer": "^3.6.1" + }, + "require-dev": { + "phing/phing": "2.17.0", + "php-parallel-lint/php-parallel-lint": "1.3.1", + "phpstan/phpstan": "0.12.99", + "phpstan/phpstan-deprecation-rules": "0.12.6", + "phpstan/phpstan-phpunit": "0.12.22", + "phpstan/phpstan-strict-rules": "0.12.11", + "phpunit/phpunit": "7.5.20|8.5.5|9.5.10" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "SlevomatCodingStandard\\": "SlevomatCodingStandard" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", + "support": { + "issues": "https://github.com/slevomat/coding-standard/issues", + "source": "https://github.com/slevomat/coding-standard/tree/7.0.16" + }, + "funding": [ + { + "url": "https://github.com/kukulich", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/slevomat/coding-standard", + "type": "tidelift" + } + ], + "time": "2021-10-22T06:56:51+00:00" + }, { "name": "squizlabs/php_codesniffer", - "version": "2.9.2", + "version": "3.6.1", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "2acf168de78487db620ab4bc524135a13cfe6745" + "reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/2acf168de78487db620ab4bc524135a13cfe6745", - "reference": "2acf168de78487db620ab4bc524135a13cfe6745", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/f268ca40d54617c6e06757f83f699775c9b3ff2e", + "reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e", "shasum": "" }, "require": { "ext-simplexml": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "php": ">=5.1.2" + "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, "bin": [ - "scripts/phpcs", - "scripts/phpcbf" + "bin/phpcs", + "bin/phpcbf" ], "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "3.x-dev" } }, - "autoload": { - "classmap": [ - "CodeSniffer.php", - "CodeSniffer/CLI.php", - "CodeSniffer/Exception.php", - "CodeSniffer/File.php", - "CodeSniffer/Fixer.php", - "CodeSniffer/Report.php", - "CodeSniffer/Reporting.php", - "CodeSniffer/Sniff.php", - "CodeSniffer/Tokens.php", - "CodeSniffer/Reports/", - "CodeSniffer/Tokenizers/", - "CodeSniffer/DocGenerators/", - "CodeSniffer/Standards/AbstractPatternSniff.php", - "CodeSniffer/Standards/AbstractScopeSniff.php", - "CodeSniffer/Standards/AbstractVariableSniff.php", - "CodeSniffer/Standards/IncorrectPatternException.php", - "CodeSniffer/Standards/Generic/Sniffs/", - "CodeSniffer/Standards/MySource/Sniffs/", - "CodeSniffer/Standards/PEAR/Sniffs/", - "CodeSniffer/Standards/PSR1/Sniffs/", - "CodeSniffer/Standards/PSR2/Sniffs/", - "CodeSniffer/Standards/Squiz/Sniffs/", - "CodeSniffer/Standards/Zend/Sniffs/" - ] - }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" @@ -3789,7 +3958,7 @@ } ], "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "http://www.squizlabs.com/php-codesniffer", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", "keywords": [ "phpcs", "standards" @@ -3799,31 +3968,33 @@ "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2018-11-07T22:31:41+00:00" + "time": "2021-10-11T04:00:11+00:00" }, { "name": "symfony/console", - "version": "v5.2.5", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "938ebbadae1b0a9c9d1ec313f87f9708609f1b79" + "reference": "ec3661faca1d110d6c307e124b44f99ac54179e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/938ebbadae1b0a9c9d1ec313f87f9708609f1b79", - "reference": "938ebbadae1b0a9c9d1ec313f87f9708609f1b79", + "url": "https://api.github.com/repos/symfony/console/zipball/ec3661faca1d110d6c307e124b44f99ac54179e3", + "reference": "ec3661faca1d110d6c307e124b44f99ac54179e3", "shasum": "" }, "require": { "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php73": "^1.8", - "symfony/polyfill-php80": "^1.15", - "symfony/service-contracts": "^1.1|^2", - "symfony/string": "^5.1" + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" }, "conflict": { + "psr/log": ">=3", "symfony/dependency-injection": "<4.4", "symfony/dotenv": "<5.1", "symfony/event-dispatcher": "<4.4", @@ -3831,16 +4002,16 @@ "symfony/process": "<4.4" }, "provide": { - "psr/log-implementation": "1.0" + "psr/log-implementation": "1.0|2.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" + "psr/log": "^1|^2", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" }, "suggest": { "psr/log": "For using the console logger", @@ -3880,7 +4051,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.2.5" + "source": "https://github.com/symfony/console/tree/v5.4.0" }, "funding": [ { @@ -3896,20 +4067,87 @@ "type": "tidelift" } ], - "time": "2021-03-06T13:42:15+00:00" + "time": "2021-11-29T15:30:56+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v2.5.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-07-12T14:48:14+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.22.1", + "version": "v1.23.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "c6c942b1ac76c82448322025e084cadc56048b4e" + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", - "reference": "c6c942b1ac76c82448322025e084cadc56048b4e", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", "shasum": "" }, "require": { @@ -3921,7 +4159,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3959,7 +4197,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.1" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" }, "funding": [ { @@ -3975,20 +4213,20 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-02-19T12:13:01+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.22.1", + "version": "v1.23.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "5601e09b69f26c1828b13b6bb87cb07cddba3170" + "reference": "16880ba9c5ebe3642d1995ab866db29270b36535" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/5601e09b69f26c1828b13b6bb87cb07cddba3170", - "reference": "5601e09b69f26c1828b13b6bb87cb07cddba3170", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/16880ba9c5ebe3642d1995ab866db29270b36535", + "reference": "16880ba9c5ebe3642d1995ab866db29270b36535", "shasum": "" }, "require": { @@ -4000,7 +4238,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4040,7 +4278,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.22.1" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.1" }, "funding": [ { @@ -4056,20 +4294,20 @@ "type": "tidelift" } ], - "time": "2021-01-22T09:19:47+00:00" + "time": "2021-05-27T12:26:48+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.22.1", + "version": "v1.23.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "43a0283138253ed1d48d352ab6d0bdb3f809f248" + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/43a0283138253ed1d48d352ab6d0bdb3f809f248", - "reference": "43a0283138253ed1d48d352ab6d0bdb3f809f248", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", "shasum": "" }, "require": { @@ -4081,7 +4319,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4124,7 +4362,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.22.1" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" }, "funding": [ { @@ -4140,20 +4378,20 @@ "type": "tidelift" } ], - "time": "2021-01-22T09:19:47+00:00" + "time": "2021-02-19T12:13:01+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.22.1", + "version": "v1.23.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "5232de97ee3b75b0360528dae24e73db49566ab1" + "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/5232de97ee3b75b0360528dae24e73db49566ab1", - "reference": "5232de97ee3b75b0360528dae24e73db49566ab1", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", + "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", "shasum": "" }, "require": { @@ -4165,7 +4403,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4204,7 +4442,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.22.1" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1" }, "funding": [ { @@ -4220,20 +4458,20 @@ "type": "tidelift" } ], - "time": "2021-01-22T09:19:47+00:00" + "time": "2021-05-27T12:26:48+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.22.1", + "version": "v1.23.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2" + "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", - "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", + "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", "shasum": "" }, "require": { @@ -4242,7 +4480,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4283,7 +4521,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.22.1" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" }, "funding": [ { @@ -4299,20 +4537,20 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-02-19T12:13:01+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.22.1", + "version": "v1.23.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91" + "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dc3063ba22c2a1fd2f45ed856374d79114998f91", - "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be", + "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be", "shasum": "" }, "require": { @@ -4321,7 +4559,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4366,7 +4604,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.22.1" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1" }, "funding": [ { @@ -4382,25 +4620,29 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-07-28T13:41:28+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.2.0", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1" + "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d15da7ba4957ffb8f1747218be9e1a121fd298a1", - "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", + "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", "shasum": "" }, "require": { "php": ">=7.2.5", - "psr/container": "^1.0" + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1" + }, + "conflict": { + "ext-psr": "<1.1|>=2" }, "suggest": { "symfony/service-implementation": "" @@ -4408,7 +4650,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -4445,7 +4687,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/master" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.0" }, "funding": [ { @@ -4461,20 +4703,20 @@ "type": "tidelift" } ], - "time": "2020-09-07T11:33:47+00:00" + "time": "2021-11-04T16:48:04+00:00" }, { "name": "symfony/string", - "version": "v5.2.4", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "4e78d7d47061fa183639927ec40d607973699609" + "reference": "9ffaaba53c61ba75a3c7a3a779051d1e9ec4fd2d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/4e78d7d47061fa183639927ec40d607973699609", - "reference": "4e78d7d47061fa183639927ec40d607973699609", + "url": "https://api.github.com/repos/symfony/string/zipball/9ffaaba53c61ba75a3c7a3a779051d1e9ec4fd2d", + "reference": "9ffaaba53c61ba75a3c7a3a779051d1e9ec4fd2d", "shasum": "" }, "require": { @@ -4485,11 +4727,14 @@ "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php80": "~1.15" }, + "conflict": { + "symfony/translation-contracts": ">=3.0" + }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0", - "symfony/http-client": "^4.4|^5.0", + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/http-client": "^4.4|^5.0|^6.0", "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0" + "symfony/var-exporter": "^4.4|^5.0|^6.0" }, "type": "library", "autoload": { @@ -4528,7 +4773,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.2.4" + "source": "https://github.com/symfony/string/tree/v5.4.0" }, "funding": [ { @@ -4544,20 +4789,20 @@ "type": "tidelift" } ], - "time": "2021-02-16T10:20:28+00:00" + "time": "2021-11-24T10:02:00+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "75a63c33a8577608444246075ea0af0d052e452a" + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", - "reference": "75a63c33a8577608444246075ea0af0d052e452a", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", "shasum": "" }, "require": { @@ -4586,7 +4831,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/master" + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" }, "funding": [ { @@ -4594,20 +4839,20 @@ "type": "github" } ], - "time": "2020-07-12T23:59:07+00:00" + "time": "2021-07-28T10:34:58+00:00" }, { "name": "vimeo/psalm", - "version": "4.6.3", + "version": "4.13.1", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "f1a840727dd756899eee2f1f9ea443e265a4763f" + "reference": "5cf660f63b548ccd4a56f62d916ee4d6028e01a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/f1a840727dd756899eee2f1f9ea443e265a4763f", - "reference": "f1a840727dd756899eee2f1f9ea443e265a4763f", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/5cf660f63b548ccd4a56f62d916ee4d6028e01a3", + "reference": "5cf660f63b548ccd4a56f62d916ee4d6028e01a3", "shasum": "" }, "require": { @@ -4615,8 +4860,9 @@ "amphp/byte-stream": "^1.5", "composer/package-versions-deprecated": "^1.8.0", "composer/semver": "^1.4 || ^2.0 || ^3.0", - "composer/xdebug-handler": "^1.1", + "composer/xdebug-handler": "^1.1 || ^2.0", "dnoegel/php-xdg-base-dir": "^0.1.1", + "ext-ctype": "*", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -4626,11 +4872,11 @@ "felixfbecker/advanced-json-rpc": "^3.0.3", "felixfbecker/language-server-protocol": "^1.5", "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", - "nikic/php-parser": "^4.10.1", + "nikic/php-parser": "^4.13", "openlss/lib-array2xml": "^1.0", "php": "^7.1|^8", "sebastian/diff": "^3.0 || ^4.0", - "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0", + "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0 || ^6.0", "webmozart/path-util": "^2.3" }, "provide": { @@ -4645,14 +4891,15 @@ "phpmyadmin/sql-parser": "5.1.0||dev-master", "phpspec/prophecy": ">=1.9.0", "phpunit/phpunit": "^9.0", - "psalm/plugin-phpunit": "^0.13", - "slevomat/coding-standard": "^6.3.11", + "psalm/plugin-phpunit": "^0.16", + "slevomat/coding-standard": "^7.0", "squizlabs/php_codesniffer": "^3.5", - "symfony/process": "^4.3", + "symfony/process": "^4.3 || ^5.0 || ^6.0", "weirdan/prophecy-shim": "^1.0 || ^2.0" }, "suggest": { - "ext-igbinary": "^2.0.5" + "ext-curl": "In order to send data to shepherd", + "ext-igbinary": "^2.0.5 is required, used to serialize caching data" }, "bin": [ "psalm", @@ -4696,9 +4943,64 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/4.6.3" + "source": "https://github.com/vimeo/psalm/tree/4.13.1" + }, + "time": "2021-11-23T23:52:49+00:00" + }, + { + "name": "webimpress/coding-standard", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/webimpress/coding-standard.git", + "reference": "7a71421c7fc85827488f10c4c510fe80f94d1a74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webimpress/coding-standard/zipball/7a71421c7fc85827488f10c4c510fe80f94d1a74", + "reference": "7a71421c7fc85827488f10c4c510fe80f94d1a74", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0", + "squizlabs/php_codesniffer": "^3.6.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.5.10" + }, + "type": "phpcodesniffer-standard", + "extra": { + "dev-master": "1.2.x-dev", + "dev-develop": "1.3.x-dev" + }, + "autoload": { + "psr-4": { + "WebimpressCodingStandard\\": "src/WebimpressCodingStandard/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "description": "Webimpress Coding Standard", + "keywords": [ + "Coding Standard", + "PSR-2", + "phpcs", + "psr-12", + "webimpress" + ], + "support": { + "issues": "https://github.com/webimpress/coding-standard/issues", + "source": "https://github.com/webimpress/coding-standard/tree/1.2.3" }, - "time": "2021-03-14T00:28:24+00:00" + "funding": [ + { + "url": "https://github.com/michalbundyra", + "type": "github" + } + ], + "time": "2021-10-28T21:18:17+00:00" }, { "name": "webmozart/assert", @@ -4816,7 +5118,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.3 || ~8.0.0" + "php": "^7.4 || ~8.0.0 || ~8.1.0" }, "platform-dev": [], "plugin-api-version": "2.1.0" diff --git a/phpcs.xml b/phpcs.xml index c6e76749..a57227d4 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -1,8 +1,30 @@  - - + + + + + + + + + + + + + src test + + src/Int.php + src/Null.php + + + + + + + diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 6b0f090b..42d8d17a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,27 +1,33 @@ - + ./src + src/Int.php src/Null.php + ./test - - + + diff --git a/psalm-baseline.xml b/psalm-baseline.xml index c8b4d750..93be9244 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,12 +1,6 @@ - + - - $options - - - $value - filterable @@ -17,10 +11,16 @@ $expectedInputs + + array_reduce($value, self::class . '::reduce', true) + + + array_reduce($value, self::class . '::reduce', false) + - ! is_array($options) && ! $options instanceof Traversable + gettype($options) Exception\ExceptionInterface @@ -38,6 +38,9 @@ $key $value + + is_object($options) + @@ -63,17 +66,9 @@ (string) $value - - - $options - - - $options - - - ! is_array($translations) && ! $translations instanceof Traversable + gettype($translations) $found @@ -108,6 +103,9 @@ (bool) $flag + + is_object($translations) + @@ -133,9 +131,6 @@ (array) $params - - is_string($callback) && class_exists($callback) - @@ -150,16 +145,15 @@ $adapter $adapterOptions - + $adapter $adapter + $key $this->adapter - - $key - - + $adapter + $key $value @@ -200,18 +194,30 @@ $this->options['archive'] $this->options['blocksize'] + + $content + $content + (int) $blocksize (string) $archive + + null !== $archive + null !== $content + null !== $content + + + bzclose + bzclose + bzwrite + - - $compressed + $compressed - - string + string @@ -233,10 +239,27 @@ $this->options['level'] $this->options['mode'] + + $content + $content + (int) $level (string) $archive + + $mode === 'deflate' && null !== $content + null !== $archive + null !== $content + null !== $content + null !== $content + + + + + $content + $content + @@ -251,8 +274,7 @@ $options - - bool + string string string @@ -264,17 +286,23 @@ $this->options['password'] $this->options['target'] - + + $content + $content + + (string) $archive + (string) $target - + (string) $password - (string) $target $password !== null - + + ! $archive + ! $filelist $archive $filelist @@ -295,6 +323,10 @@ $compressed $compressed + + $content + $content + snappy_compress($content) snappy_uncompress($content) @@ -329,6 +361,10 @@ $this->options['mode'] $this->options['target'] + + $content + $content + $content @@ -336,12 +372,19 @@ $file $file - - (string) $archive + (string) $target + + + (string) $archive + + $res + $res + $res + $res $res @@ -359,11 +402,10 @@ $this->options['archive'] $this->options['target'] - - $res - $res - $res - + + $content + $content + strrpos($content, DIRECTORY_SEPARATOR) strrpos($content, DIRECTORY_SEPARATOR) @@ -371,9 +413,11 @@ read - - (string) $archive + (string) $target + + + (string) $archive $res !== true @@ -383,11 +427,6 @@ $prefix - - $amount - $index - $precision - setMode setPrecision @@ -412,10 +451,10 @@ $prefixes + $prefixes[$index] ?? null $this->options['mode'] $this->options['precision'] $this->options['unit'] - isset($prefixes[$index]) ? $prefixes[$index] : null self::$standardizedPrefixes[$this->getMode()] @@ -424,32 +463,28 @@ $prefix - + + (int) $precision (string) $unit - - ! is_string($value) && ! is_int($value) && ! $value instanceof DateTime + $result === false $value === null $value === null - - string - - + + $value $value - + + string string $e->getCode() - - $value - $value @@ -549,9 +584,10 @@ string string - + encrypt new $adapter($options) + new $adapter($options) toString @@ -601,7 +637,8 @@ $this->encryption['key'] $this->encryption['vector'] - + + $options $value @@ -641,7 +678,9 @@ $this->keys $this->keys - + + $cert + $cert $cert $cert $cert @@ -651,14 +690,10 @@ $envKey $envelope $header['size'] - $key - $key - $key $keys $keys $length $length - $length $options['compression'] $options['package'] $options['passphrase'] @@ -689,16 +724,13 @@ $this->keys['private'] $this->keys['public'] - + $keys[$key] - $this->keys['envelope'][$key] - $this->keys['private'][$key] - $this->keys['public'][$key] $fingerprints[$key] - + $cert $cert $cert @@ -712,6 +744,7 @@ $key['envelope'] $key['private'] $key['public'] + $length $option $option $option @@ -722,11 +755,9 @@ array array - - $envKey + + $header['size'] $i - $length - $length $this->keys['envelope'] @@ -736,8 +767,7 @@ $compression - - $keys + $keys $keys @@ -748,6 +778,10 @@ (bool) $package + + null !== $this->getPassphrase() + null !== $this->getPassphrase() + @@ -973,42 +1007,26 @@ $target === null is_string($target) - - $clientFileName - $source - - - $clientFileName - $clientFileName - $clientFileName - $source + + $clientFilename + $sourceFile + $sourceFile $sourceFile $sourceFile $sourceFile - $target - $target - $target - $target - $target $value - - $target[strlen($target) - 1] - $this->alreadyFiltered[$sourceFile] $this->alreadyFiltered[$sourceFile] $this->alreadyFiltered[$sourceFile] - + $clientFilename - $last $sourceFile $sourceFile - $target - $targetDir UploadedFileInterface @@ -1022,10 +1040,6 @@ string string - - $targetDir - $targetDir - $this->alreadyFiltered[$alreadyFilteredKey] $this->alreadyFiltered[$fileName] @@ -1045,9 +1059,19 @@ $value - + + $sourceFile $sourceFile + + $sourceFile + $sourceFile + + + $clientFileName + $clientFileName + $clientFileName + (bool) $flag (bool) $flag @@ -1085,10 +1109,11 @@ - - ! is_array($options) && ! $options instanceof Traversable - $callback instanceof FilterInterface + + ! $this->plugins $this->plugins + gettype($callback) + gettype($options) $callback @@ -1138,6 +1163,10 @@ $plugins + + is_object($callback) + is_object($options) + @@ -1146,25 +1175,20 @@ \Zend\Filter\Blacklist::class \Zend\Filter\Whitelist::class - - gettype($plugin) - - ToInt::class => InvokableFactory::class - ToNull::class => InvokableFactory::class + ToInt::class => InvokableFactory::class + ToNull::class => InvokableFactory::class $e->getCode() - - $plugin - + $factories - - is_object($plugin) - + + $plugin + Alnum Alnum @@ -1210,6 +1234,9 @@ $config['filters'] $this->creationOptions + + $options ?: [] + $container @@ -1242,18 +1269,15 @@ - - $this->pluginManager instanceof FilterPluginManager - + + $options['pluginManager'] + $spec[0] $source[ltrim($sourceName, ':')] - - $options['pluginManager'] - $options['pluginManager'] $options['rules'] @@ -1295,7 +1319,7 @@ array|false - new $options['pluginManager'] + new $options['pluginManager']() $this->getPluginManager()->get($rule) @@ -1308,6 +1332,9 @@ $source + + $source + $pluginManager $target @@ -1331,7 +1358,7 @@ getConfig - \Laminas\ModuleManager\ModuleManager + ModuleManager @@ -1605,23 +1632,14 @@ $value - + $defaultScheme $path - $path (string) $value - - - $options - - - $options - - is_string($separator) @@ -1680,9 +1698,6 @@ ! is_scalar($value) && ! is_array($value) - - $replacements[$index] - $matches $matches @@ -1768,9 +1783,9 @@ setCreationOptions + $options['replacement_separator'] ?? '-' + $options['search_separator'] ?? ' ' $this->creationOptions - isset($options['replacement_separator']) ? $options['replacement_separator'] : '-' - isset($options['search_separator']) ? $options['search_separator'] : ' ' @@ -1818,6 +1833,9 @@ array array + + $filter + @@ -1872,8 +1890,8 @@ $data $data $type - list($value, $expected) - list($value, $expected) + [$value, $expected] + [$value, $expected] @@ -1917,6 +1935,9 @@ $target + + testBz2DecompressNullValueIsAccepted + $archive $archive @@ -1930,7 +1951,8 @@ $archive $archive - + + null null @@ -1941,6 +1963,9 @@ $target + + testGzDecompressNullThrowsRuntimeException + $archive $archive @@ -1951,7 +1976,8 @@ $archive - + + null null @@ -1976,6 +2002,9 @@ $callback + + $callback + true @@ -2017,9 +2046,13 @@ assertNull - + [] + false + + [] + $errno $errstr @@ -2031,9 +2064,9 @@ [$this, 'errorHandler'] [$this, 'errorHandler'] - - false - + + $content + @@ -2043,6 +2076,13 @@ testArchiveTarNotLoaded + + $errno + $errstr + + + $tar + @@ -2052,6 +2092,7 @@ testDecompressionDoesNotRequireArchive testSetModeShouldWorkWithCaseInsensitive + $target @@ -2165,41 +2206,73 @@ - - 'Laminas\Filter\Compress\CompressionAlgorithmInterface' - - + + $filterType + $filterType + $filterType + $filterType + $filterType + $filterType + $filterType + $filterType + $filterType $input $tmpDir - - returnUnfilteredDataProvider - - + + $filterType + $filterType + $filterType + $filterType + $filterType + $filterType + $filterType + $filterType + $filterType + $filterType + $filterType $this->tmpDir $this->tmpDir - + + $parameters[0] + $parameters[0] + $parameters[0] + $parameters[0] + $parameters[0] + + $compressed $content2 $content2 $content3 $decompressed + $parameters + $parameters - + + iterable + iterable + + + $filterType + $filterType + $parameters[0] + $parameters[0] $this->tmpDir $this->tmpDir $this->tmpDir $this->tmpDir - + getArchive getArchive - getBlocksize - getBlocksize + + $adapter + @@ -2219,21 +2292,18 @@ testSettingNoOptions testSettingNoUnit + + $filter + $filter + $filter + - - $expected - $input - $options - provideFilter testFilter testInvalidInput - - $options - @@ -2255,43 +2325,68 @@ $this->defaultTimezone + + $result + - - $expected - $input - $options - provideFilter testFilter testInvalidInput - - $options - - + + $filterType + $filterType + $filterType + $filterType + $filterType $input $tmpDir - - returnUnfilteredDataProvider + testFilterMethodProxiesToDecompress - + $compressed + $filterType + $filterType + $filterType + $filterType + $filterType + $filterType + $filterType + $filterType + $filterType $input $this->tmpDir $this->tmpDir - + + $parameter[0] + $parameter[0] + $parameters[0] + $parameters[0] + + $compressed + $parameter + $parameters - + + iterable + iterable + + + $filterType + $filterType + $filterType + $parameters[0] + $parameters[0] $this->tmpDir $this->tmpDir $this->tmpDir @@ -2303,10 +2398,6 @@ - - 'Laminas\Filter\Encrypt\EncryptionAlgorithmInterface' - 'Laminas\Filter\Encrypt\EncryptionAlgorithmInterface' - $input @@ -2321,19 +2412,26 @@ $enc $key + + $enc + $expected $value - + $data + [$value, $expected] array array + + $filter + @@ -2366,6 +2464,9 @@ fail fail + + $filter + @@ -2380,10 +2481,6 @@ - - 'Laminas\Filter\Encrypt\EncryptionAlgorithmInterface' - 'Laminas\Filter\Encrypt\EncryptionAlgorithmInterface' - $input @@ -2503,6 +2600,9 @@ returnUnfilteredDataProvider + + $filter + @@ -2552,6 +2652,12 @@ $oldFilePathInfo['extension'] $oldFilePathInfo['extension'] + + $args + + + $filter + @@ -2562,9 +2668,6 @@ - - 'Laminas\Filter\FilterChain' - $value $value @@ -2589,27 +2692,22 @@ testFiltersAreExecutedInFifoOrder testMergingTwoFilterChainsKeepFiltersPriority - + $config $config $config - $unserialized $value $value $value - + $compare $config $config $config $filter $filtered - $unserialized - - filter - @@ -2650,14 +2748,15 @@ testFactoryConfiguresPluginManagerUnderServiceManagerV2 testFactoryReturnsPluginManager - - method_exists($filters, 'configure') - + + $container + $container + + + $config + - - 'Laminas\Filter\ToInt' - getInvalidServiceException testFilterSuccessfullyConstructed @@ -2670,20 +2769,12 @@ $this->getInvalidServiceException() $this->getInvalidServiceException() - - $filter + $filterOne $filterTwo - - method_exists($this->filters, 'configure') - - - 'Laminas\Filter\Exception\DomainException' - 'Laminas\Filter\HtmlEntities' - $errno $errstr @@ -2716,17 +2807,11 @@ $result + + $result + - - 'Laminas\Filter\FilterInterface' - 'Laminas\Filter\FilterInterface' - 'Laminas\Filter\FilterInterface' - 'Laminas\Filter\FilterInterface' - 'Laminas\Filter\FilterPluginManager' - 'Laminas\Filter\FilterPluginManager' - 'Laminas\Filter\StringToLower' - $inflector @@ -2788,9 +2873,7 @@ $rules['controller'] $rules['suffix'] - - $broker - $filter + $filtered $filtered $filtered @@ -2847,6 +2930,11 @@ $this->_context $this->_context + + $filtered + $inflector + $rule + @@ -2866,19 +2954,11 @@ - - $expected - $input - $options - provideFilter testFilter testInvalidInput - - $options - @@ -2923,6 +3003,9 @@ $filtered $filtered + + $filtered + @@ -2940,13 +3023,6 @@ - - 'Laminas\Filter\FilterPluginManager' - 'Laminas\Filter\FilterPluginManager' - - - Exception\ExceptionInterface::class - $value $value @@ -2967,6 +3043,10 @@ $first $second + + $value + $value + @@ -3159,8 +3239,8 @@ $data $data $type - list($value, $expected) - list($value, $expected) + [$value, $expected] + [$value, $expected] @@ -3219,6 +3299,9 @@ setValue + + return; + diff --git a/src/AbstractDateDropdown.php b/src/AbstractDateDropdown.php index f73d6a4a..c555b3c4 100644 --- a/src/AbstractDateDropdown.php +++ b/src/AbstractDateDropdown.php @@ -1,9 +1,18 @@ isNullOnEmpty() - && array_reduce($value, __CLASS__ . '::reduce', false) + if ( + $this->isNullOnEmpty() + && array_reduce($value, self::class . '::reduce', false) ) { return null; } - if ($this->isNullOnAllEmpty() - && array_reduce($value, __CLASS__ . '::reduce', true) + if ( + $this->isNullOnAllEmpty() + && array_reduce($value, self::class . '::reduce', true) ) { return null; } @@ -118,7 +127,7 @@ public function filter($value) /** * Ensures there are enough inputs in the array to properly format the date. * - * @param $value + * @param mixed $value * @throws Exception\RuntimeException */ protected function filterable($value) diff --git a/src/AbstractFilter.php b/src/AbstractFilter.php index d7d223bb..825033e3 100644 --- a/src/AbstractFilter.php +++ b/src/AbstractFilter.php @@ -1,10 +1,22 @@ list = $list; } - /** * Get the list of items to white-list * diff --git a/src/BaseName.php b/src/BaseName.php index da1b7959..c6c099db 100644 --- a/src/BaseName.php +++ b/src/BaseName.php @@ -1,7 +1,12 @@ 'boolean', - self::TYPE_INTEGER => 'integer', - self::TYPE_FLOAT => 'float', - self::TYPE_STRING => 'string', - self::TYPE_ZERO_STRING => 'zero', - self::TYPE_EMPTY_ARRAY => 'array', - self::TYPE_NULL => 'null', - self::TYPE_PHP => 'php', - self::TYPE_FALSE_STRING => 'false', - self::TYPE_LOCALIZED => 'localized', - self::TYPE_ALL => 'all', + self::TYPE_BOOLEAN => 'boolean', + self::TYPE_INTEGER => 'integer', + self::TYPE_FLOAT => 'float', + self::TYPE_STRING => 'string', + self::TYPE_ZERO_STRING => 'zero', + self::TYPE_EMPTY_ARRAY => 'array', + self::TYPE_NULL => 'null', + self::TYPE_PHP => 'php', + self::TYPE_FALSE_STRING => 'false', + self::TYPE_LOCALIZED => 'localized', + self::TYPE_ALL => 'all', ]; - /** - * @var array - */ + /** @var array */ protected $options = [ 'type' => self::TYPE_PHP, 'casting' => true, @@ -60,7 +70,8 @@ public function __construct($typeOrOptions = null, $casting = true, $translation } if (is_array($typeOrOptions)) { - if (isset($typeOrOptions['type']) + if ( + isset($typeOrOptions['type']) || isset($typeOrOptions['casting']) || isset($typeOrOptions['translations']) ) { @@ -159,7 +170,7 @@ public function setTranslations($translations) throw new Exception\InvalidArgumentException(sprintf( '"%s" expects an array or Traversable; received "%s"', __METHOD__, - (is_object($translations) ? get_class($translations) : gettype($translations)) + is_object($translations) ? get_class($translations) : gettype($translations) )); } diff --git a/src/Callback.php b/src/Callback.php index 6ea3fc9c..d5c42b67 100644 --- a/src/Callback.php +++ b/src/Callback.php @@ -1,17 +1,23 @@ null, - 'callback_params' => [] + 'callback_params' => [], ]; /** diff --git a/src/Compress.php b/src/Compress.php index b8e83e6c..03414aca 100644 --- a/src/Compress.php +++ b/src/Compress.php @@ -1,10 +1,24 @@ adapter = $adapter; diff --git a/src/Compress/AbstractCompressionAlgorithm.php b/src/Compress/AbstractCompressionAlgorithm.php index dff4c5a9..c7514bb1 100644 --- a/src/Compress/AbstractCompressionAlgorithm.php +++ b/src/Compress/AbstractCompressionAlgorithm.php @@ -1,23 +1,24 @@ getArchive(); //check if there are null byte characters before doing a file_exists check - if (false === strpos($content, "\0") && file_exists($content)) { + if (null !== $content && false === strpos($content, "\0") && file_exists($content)) { $archive = $content; } - if (file_exists($archive)) { + if (null !== $archive && file_exists($archive)) { $file = bzopen($archive, 'r'); if (! $file) { throw new Exception\RuntimeException("Error opening the archive '" . $content . "'"); @@ -140,8 +152,12 @@ public function decompress($content) $compressed = bzread($file); bzclose($file); - } else { + } elseif (null !== $content) { $compressed = bzdecompress($content); + } else { + // without strict types, bzdecompress(null) returns an empty string + // we need to simulate this behaviour to prevent a BC break! + $compressed = ''; } if (is_int($compressed)) { diff --git a/src/Compress/CompressionAlgorithmInterface.php b/src/Compress/CompressionAlgorithmInterface.php index 153b7168..57a421e1 100644 --- a/src/Compress/CompressionAlgorithmInterface.php +++ b/src/Compress/CompressionAlgorithmInterface.php @@ -1,5 +1,7 @@ getMode(); //check if there are null byte characters before doing a file_exists check - if (false === strpos($content, "\0") && file_exists($content)) { + if (null !== $content && false === strpos($content, "\0") && file_exists($content)) { $archive = $content; } - if (file_exists($archive)) { + if (null !== $archive && file_exists($archive)) { $handler = fopen($archive, 'rb'); if (! $handler) { throw new Exception\RuntimeException("Error opening the archive '" . $archive . "'"); @@ -179,10 +200,12 @@ public function decompress($content) $file = gzopen($archive, 'r'); $compressed = gzread($file, $size); gzclose($file); - } elseif ($mode === 'deflate') { + } elseif ($mode === 'deflate' && null !== $content) { $compressed = gzinflate($content); - } else { + } elseif (null !== $content) { $compressed = gzuncompress($content); + } else { + $compressed = false; } if ($compressed === false) { diff --git a/src/Compress/Lzf.php b/src/Compress/Lzf.php index b1b00e7a..c8885918 100644 --- a/src/Compress/Lzf.php +++ b/src/Compress/Lzf.php @@ -1,19 +1,21 @@ options['archive'] = (string) $archive; return $this; @@ -129,7 +139,7 @@ public function getTarget() * * @param string $target * @return self - * @throws Exception\InvalidArgumentException if specified target directory does not exist + * @throws Exception\InvalidArgumentException If specified target directory does not exist. */ public function setTarget($target) { @@ -137,7 +147,7 @@ public function setTarget($target) throw new Exception\InvalidArgumentException("The directory '$target' does not exist"); } - $target = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, (string) $target); + $target = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, (string) $target); $this->options['target'] = $target; return $this; } @@ -147,7 +157,7 @@ public function setTarget($target) * * @param string|array $content * @return string - * @throws Exception\RuntimeException if no callback available, or error during compression + * @throws Exception\RuntimeException If no callback available, or error during compression. */ public function compress($content) { @@ -172,8 +182,8 @@ public function compress($content) * * @param string $content * @return bool - * @throws Exception\RuntimeException if archive not found, cannot be opened, - * or error during decompression + * @throws Exception\RuntimeException If archive not found, cannot be opened, + * or error during decompression. */ public function decompress($content) { diff --git a/src/Compress/Snappy.php b/src/Compress/Snappy.php index 9820287c..597d0615 100644 --- a/src/Compress/Snappy.php +++ b/src/Compress/Snappy.php @@ -1,8 +1,13 @@ options['archive'] = $archive; return $this; @@ -84,7 +96,7 @@ public function getTarget() * * @param string $target * @return self - * @throws Exception\InvalidArgumentException if target path does not exist + * @throws Exception\InvalidArgumentException If target path does not exist. */ public function setTarget($target) { @@ -92,7 +104,7 @@ public function setTarget($target) throw new Exception\InvalidArgumentException("The directory '$target' does not exist"); } - $target = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, (string) $target); + $target = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, (string) $target); $this->options['target'] = $target; return $this; } @@ -114,9 +126,9 @@ public function getMode() * * @param string $mode * @return self - * @throws Exception\InvalidArgumentException for invalid $mode values - * @throws Exception\ExtensionNotLoadedException if bz2 mode selected but extension not loaded - * @throws Exception\ExtensionNotLoadedException if gz mode selected but extension not loaded + * @throws Exception\InvalidArgumentException For invalid $mode values. + * @throws Exception\ExtensionNotLoadedException If bz2 mode selected but extension not loaded. + * @throws Exception\ExtensionNotLoadedException If gz mode selected but extension not loaded. */ public function setMode($mode) { @@ -142,8 +154,8 @@ public function setMode($mode) * * @param string $content * @return string - * @throws Exception\RuntimeException if unable to create temporary file - * @throws Exception\RuntimeException if unable to create archive + * @throws Exception\RuntimeException If unable to create temporary file. + * @throws Exception\RuntimeException If unable to create archive. */ public function compress($content) { @@ -164,10 +176,12 @@ public function compress($content) if (is_dir($content)) { // collect all file infos - foreach (new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($content, RecursiveDirectoryIterator::KEY_AS_PATHNAME), - RecursiveIteratorIterator::SELF_FIRST - ) as $directory => $info) { + foreach ( + new RecursiveIteratorIterator( + new RecursiveDirectoryIterator($content, RecursiveDirectoryIterator::KEY_AS_PATHNAME), + RecursiveIteratorIterator::SELF_FIRST + ) as $directory => $info + ) { if ($info->isFile()) { $file[] = $directory; } @@ -176,7 +190,7 @@ public function compress($content) $content = $file; } - $result = $archive->create($content); + $result = $archive->create($content); if ($result === false) { throw new Exception\RuntimeException('Error creating the Tar archive'); } @@ -189,8 +203,8 @@ public function compress($content) * * @param string $content * @return string - * @throws Exception\RuntimeException if unable to find archive - * @throws Exception\RuntimeException if error occurs decompressing archive + * @throws Exception\RuntimeException If unable to find archive. + * @throws Exception\RuntimeException If error occurs decompressing archive. */ public function decompress($content) { diff --git a/src/Compress/Zip.php b/src/Compress/Zip.php index e6f26cde..655cab15 100644 --- a/src/Compress/Zip.php +++ b/src/Compress/Zip.php @@ -1,10 +1,29 @@ options['archive'] = $archive; return $this; @@ -86,7 +103,7 @@ public function setTarget($target) throw new Exception\InvalidArgumentException("The directory '$target' does not exist"); } - $target = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, (string) $target); + $target = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, (string) $target); $this->options['target'] = $target; return $this; } @@ -96,7 +113,7 @@ public function setTarget($target) * * @param string $content * @return string Compressed archive - * @throws Exception\RuntimeException if unable to open zip archive, or error during compression + * @throws Exception\RuntimeException If unable to open zip archive, or error during compression. */ public function compress($content) { @@ -173,7 +190,7 @@ public function compress($content) * @param string $content * @return string * @throws Exception\RuntimeException If archive file not found, target directory not found, - * or error during decompression + * or error during decompression. */ public function decompress($content) { @@ -183,8 +200,8 @@ public function decompress($content) throw new Exception\RuntimeException('ZIP Archive not found'); } - $zip = new ZipArchive(); - $res = $zip->open($archive); + $zip = new ZipArchive(); + $res = $zip->open($archive); $target = $this->getTarget(); if (! empty($target) && ! is_dir($target)) { diff --git a/src/ConfigProvider.php b/src/ConfigProvider.php index 7db09125..af21581e 100644 --- a/src/ConfigProvider.php +++ b/src/ConfigProvider.php @@ -1,5 +1,7 @@ [ + 'aliases' => [ 'FilterManager' => FilterPluginManager::class, // Legacy Zend Framework aliases diff --git a/src/DataUnitFormatter.php b/src/DataUnitFormatter.php index 2c2ae38f..261e39b9 100644 --- a/src/DataUnitFormatter.php +++ b/src/DataUnitFormatter.php @@ -1,16 +1,27 @@ getPrefixes(); - return isset($prefixes[$index]) ? $prefixes[$index] : null; + return $prefixes[$index] ?? null; } /** @@ -210,9 +220,9 @@ public function filter($value) } // Calculate the correct size and prefix: - $base = $this->isBinaryMode() ? self::BASE_BINARY : self::BASE_DECIMAL; - $power = floor(log($amount, $base)); - $prefix = $this->getPrefixAt((int)$power); + $base = $this->isBinaryMode() ? self::BASE_BINARY : self::BASE_DECIMAL; + $power = floor(log($amount, $base)); + $prefix = $this->getPrefixAt((int) $power); // When the amount is too big, no prefix can be found: if ($prefix === null) { @@ -220,15 +230,14 @@ public function filter($value) } // return formatted value: - $result = ($amount / pow($base, $power)); + $result = $amount / pow($base, $power); $formatted = number_format($result, $this->getPrecision()); return $this->formatAmount($formatted, $prefix); } /** - * @param $amount - * @param null $prefix - * + * @param mixed $amount + * @param null $prefix * @return string */ protected function formatAmount($amount, $prefix = null) diff --git a/src/DateSelect.php b/src/DateSelect.php index 7bb08e97..1ee5d979 100644 --- a/src/DateSelect.php +++ b/src/DateSelect.php @@ -1,5 +1,7 @@ normalizeDateTime($value); - } catch (\Exception $e) { + } catch (Throwable $e) { // DateTime threw an exception, an invalid date string was provided throw new Exception\InvalidArgumentException('Invalid date string provided', $e->getCode(), $e); } diff --git a/src/DateTimeSelect.php b/src/DateTimeSelect.php index d8e4cfab..9c167d28 100644 --- a/src/DateTimeSelect.php +++ b/src/DateTimeSelect.php @@ -1,7 +1,13 @@ isNullOnEmpty() + if ( + $this->isNullOnEmpty() && ( empty($value['year']) || empty($value['month']) @@ -41,7 +46,8 @@ public function filter($value) return; } - if ($this->isNullOnAllEmpty() + if ( + $this->isNullOnAllEmpty() && ( empty($value['year']) && empty($value['month']) diff --git a/src/Decompress.php b/src/Decompress.php index e7157c4a..196ebd50 100644 --- a/src/Decompress.php +++ b/src/Decompress.php @@ -1,7 +1,11 @@ adapter; $options = $this->getOptions(); if (! class_exists($adapter)) { - $adapter = __CLASS__ . '\\' . ucfirst($adapter); + $adapter = self::class . '\\' . ucfirst($adapter); if (! class_exists($adapter)) { throw new Exception\RuntimeException(sprintf( '%s unable to load adapter; class "%s" not found', @@ -62,7 +72,7 @@ public function getAdapterInstance() throw new Exception\InvalidArgumentException(sprintf( 'Encryption adapter "%s" does not implement %s\\EncryptionAlgorithmInterface', $adapter, - __CLASS__ + self::class )); } return $this->adapter; diff --git a/src/Encrypt/BlockCipher.php b/src/Encrypt/BlockCipher.php index 1b48bf6c..ec4b08a8 100644 --- a/src/Encrypt/BlockCipher.php +++ b/src/Encrypt/BlockCipher.php @@ -1,5 +1,7 @@ has('openssl') ? 'openssl' : 'mcrypt'; + $cipherType = $cipherPluginManager->has('openssl') ? 'openssl' : 'mcrypt'; try { $this->blockCipher = CryptBlockCipher::factory($cipherType, $this->encryption); } catch (SymmetricException\RuntimeException $e) { diff --git a/src/Encrypt/EncryptionAlgorithmInterface.php b/src/Encrypt/EncryptionAlgorithmInterface.php index f17da9d4..23ad4c86 100644 --- a/src/Encrypt/EncryptionAlgorithmInterface.php +++ b/src/Encrypt/EncryptionAlgorithmInterface.php @@ -1,5 +1,7 @@ public key * 'private' => private key @@ -109,7 +135,7 @@ protected function _setKeys($keys) } foreach ($keys as $type => $key) { - if (is_file($key) && is_readable($key)) { + if (is_string($key) && is_file($key) && is_readable($key)) { $file = fopen($key, 'r'); $cert = fread($file, 8192); fclose($file); @@ -129,7 +155,11 @@ protected function _setKeys($keys) $this->keys['public'][$key] = $cert; break; case 'private': - $test = openssl_pkey_get_private($cert, $this->passphrase); + if (null !== $this->getPassphrase()) { + $test = openssl_pkey_get_private($cert, $this->getPassphrase()); + } else { + $test = openssl_pkey_get_private($cert); + } if ($test === false) { throw new Exception\InvalidArgumentException("Private key '{$cert}' not valid"); } @@ -358,7 +388,7 @@ public function encrypt($value) $value = $compress($value); } - $crypt = openssl_seal($value, $encrypted, $encryptedkeys, $keys, 'RC4'); + $crypt = openssl_seal($value, $encrypted, $encryptedkeys, $keys, 'RC4'); $this->freeKeyResources($keys); @@ -404,7 +434,11 @@ public function decrypt($value) } foreach ($this->keys['private'] as $cert) { - $keys = openssl_pkey_get_private($cert, $this->getPassphrase()); + if (null !== $this->getPassphrase()) { + $keys = openssl_pkey_get_private($cert, $this->getPassphrase()); + } else { + $keys = openssl_pkey_get_private($cert); + } } if ($this->package) { @@ -415,12 +449,12 @@ public function decrypt($value) $fingerprint = md5("Laminas"); } - $count = unpack('ncount', $value); - $count = $count['count']; - $length = 2; + $count = unpack('ncount', $value); + $count = $count['count']; + $length = 2; for ($i = $count; $i > 0; --$i) { - $header = unpack('H32print/nsize', substr($value, $length, 18)); - $length += 18; + $header = unpack('H32print/nsize', substr($value, $length, 18)); + $length += 18; if ($header['print'] === $fingerprint) { $envelope = substr($value, $length, $header['size']); } @@ -432,7 +466,7 @@ public function decrypt($value) $value = substr($value, $length); } - $crypt = openssl_open($value, $decrypted, $envelope, $keys, 'RC4'); + $crypt = openssl_open($value, $decrypted, $envelope, $keys, 'RC4'); $this->freeKeyResources([$keys]); diff --git a/src/Exception/BadMethodCallException.php b/src/Exception/BadMethodCallException.php index a8c3db8a..1db097ae 100644 --- a/src/Exception/BadMethodCallException.php +++ b/src/Exception/BadMethodCallException.php @@ -1,5 +1,7 @@ Source filename or directory which will be renamed @@ -167,8 +184,8 @@ public function filter($value) } $isFileUpload = true; - $uploadData = $value; - $value = $value['tmp_name']; + $uploadData = $value; + $value = $value['tmp_name']; } $file = $this->getNewName($value, true); @@ -185,8 +202,8 @@ public function filter($value) if ($result !== true) { throw new Exception\RuntimeException( sprintf( - "File '%s' could not be renamed. " . - "An error occurred while processing the file.", + "File '%s' could not be renamed. " + . "An error occurred while processing the file.", $value ) ); @@ -320,9 +337,9 @@ protected function _getFileName($file) } if ($rename['randomize']) { - $info = pathinfo($rename['target']); - $newTarget = $info['dirname'] . DIRECTORY_SEPARATOR . - $info['filename'] . uniqid('_', false); + $info = pathinfo($rename['target']); + $newTarget = $info['dirname'] . DIRECTORY_SEPARATOR + . $info['filename'] . uniqid('_', false); if (isset($info['extension'])) { $newTarget .= '.' . $info['extension']; } diff --git a/src/File/RenameUpload.php b/src/File/RenameUpload.php index 27d17159..f82d7444 100644 --- a/src/File/RenameUpload.php +++ b/src/File/RenameUpload.php @@ -1,5 +1,7 @@ null, 'use_upload_name' => false, @@ -227,7 +245,7 @@ public function filter($value) protected function moveUploadedFile($sourceFile, $targetFile) { ErrorHandler::start(); - $result = move_uploaded_file($sourceFile, $targetFile); + $result = move_uploaded_file($sourceFile, $targetFile); $warningException = ErrorHandler::stop(); if (! $result || null !== $warningException) { throw new Exception\RuntimeException( @@ -261,9 +279,8 @@ protected function checkFileExists($targetFile) } /** - * @param $source - * @param $clientFileName - * + * @param string $source + * @param string|null $clientFileName * @return string */ protected function getFinalTarget($source, $clientFileName) @@ -315,7 +332,7 @@ protected function getFinalTarget($source, $clientFileName) */ protected function applyRandomToFilename($source, $filename) { - $info = pathinfo($filename); + $info = pathinfo($filename); $filename = $info['filename'] . str_replace('.', '_', uniqid('_', true)); $sourceinfo = pathinfo($source); @@ -374,17 +391,16 @@ private function filterSapiUploadedFile(array $fileData) $this->checkFileExists($targetFile); $this->moveUploadedFile($sourceFile, $targetFile); - $this->alreadyFiltered[$sourceFile] = $fileData; + $this->alreadyFiltered[$sourceFile] = $fileData; $this->alreadyFiltered[$sourceFile]['tmp_name'] = $targetFile; return $this->alreadyFiltered[$sourceFile]; } /** - * @param UploadedFileInterface $uploadedFile * @return UploadedFileInterface - * @throws Exception\RuntimeException if no stream factory is composed in the filter. - * @throws Exception\RuntimeException if no uploaded file factory is composed in the filter. + * @throws Exception\RuntimeException If no stream factory is composed in the filter. + * @throws Exception\RuntimeException If no uploaded file factory is composed in the filter. */ private function filterPsr7UploadedFile(UploadedFileInterface $uploadedFile) { @@ -394,7 +410,7 @@ private function filterPsr7UploadedFile(UploadedFileInterface $uploadedFile) return $this->alreadyFiltered[$alreadyFilteredKey]; } - $sourceFile = $uploadedFile->getStream()->getMetadata('uri'); + $sourceFile = $uploadedFile->getStream()->getMetadata('uri'); $clientFilename = $uploadedFile->getClientFilename(); $targetFile = $this->getFinalTarget($sourceFile, $clientFilename); diff --git a/src/File/UpperCase.php b/src/File/UpperCase.php index 75216b19..526367cf 100644 --- a/src/File/UpperCase.php +++ b/src/File/UpperCase.php @@ -1,10 +1,19 @@ attach($callback, $priority); } @@ -67,9 +78,9 @@ public function setOptions($options) break; case 'filters': foreach ($value as $spec) { - $name = isset($spec['name']) ? $spec['name'] : false; - $options = isset($spec['options']) ? $spec['options'] : []; - $priority = isset($spec['priority']) ? $spec['priority'] : static::DEFAULT_PRIORITY; + $name = $spec['name'] ?? false; + $options = $spec['options'] ?? []; + $priority = $spec['priority'] ?? static::DEFAULT_PRIORITY; if ($name) { $this->attachByName($name, $options, $priority); } @@ -89,6 +100,7 @@ public function setOptions($options) * * @return int */ + #[ReturnTypeWillChange] public function count() { return count($this->filters); @@ -110,7 +122,6 @@ public function getPluginManager() /** * Set plugin manager instance * - * @param FilterPluginManager $plugins * @return self */ public function setPluginManager(FilterPluginManager $plugins) @@ -146,7 +157,7 @@ public function attach($callback, $priority = self::DEFAULT_PRIORITY) if (! $callback instanceof FilterInterface) { throw new Exception\InvalidArgumentException(sprintf( 'Expected a valid PHP callback; received "%s"', - (is_object($callback) ? get_class($callback) : gettype($callback)) + is_object($callback) ? get_class($callback) : gettype($callback) )); } $callback = [$callback, 'filter']; @@ -180,7 +191,6 @@ public function attachByName($name, $options = [], $priority = self::DEFAULT_PRI /** * Merge the filter chain with the one given in parameter * - * @param FilterChain $filterChain * @return self */ public function merge(FilterChain $filterChain) diff --git a/src/FilterInterface.php b/src/FilterInterface.php index 7d51a907..6e75bff8 100644 --- a/src/FilterInterface.php +++ b/src/FilterInterface.php @@ -1,5 +1,7 @@ ToInt::class, - 'Int' => ToInt::class, - 'null' => ToNull::class, - 'Null' => ToNull::class, + 'int' => ToInt::class, + 'Int' => ToInt::class, + 'null' => ToNull::class, + 'Null' => ToNull::class, // I18n filters - 'alnum' => Alnum::class, - 'Alnum' => Alnum::class, - 'alpha' => Alpha::class, - 'Alpha' => Alpha::class, - 'numberformat' => NumberFormat::class, - 'numberFormat' => NumberFormat::class, - 'NumberFormat' => NumberFormat::class, - 'numberparse' => NumberParse::class, - 'numberParse' => NumberParse::class, - 'NumberParse' => NumberParse::class, + 'alnum' => Alnum::class, + 'Alnum' => Alnum::class, + 'alpha' => Alpha::class, + 'Alpha' => Alpha::class, + 'numberformat' => NumberFormat::class, + 'numberFormat' => NumberFormat::class, + 'NumberFormat' => NumberFormat::class, + 'numberparse' => NumberParse::class, + 'numberParse' => NumberParse::class, + 'NumberParse' => NumberParse::class, // Standard filters 'allowlist' => AllowList::class, @@ -198,118 +206,119 @@ class FilterPluginManager extends AbstractPluginManager 'WordUnderscoreToSeparator' => Word\UnderscoreToSeparator::class, // Legacy Zend Framework aliases - \Zend\I18n\Filter\Alnum::class => Alnum::class, - \Zend\I18n\Filter\Alpha::class => Alpha::class, - \Zend\I18n\Filter\NumberFormat::class => NumberFormat::class, - \Zend\I18n\Filter\NumberParse::class => NumberParse::class, - \Zend\Filter\BaseName::class => BaseName::class, - \Zend\Filter\Blacklist::class => DenyList::class, - \Zend\Filter\Boolean::class => Boolean::class, - \Zend\Filter\Callback::class => Callback::class, - \Zend\Filter\Compress::class => Compress::class, - \Zend\Filter\DataUnitFormatter::class => DataUnitFormatter::class, - \Zend\Filter\DateSelect::class => DateSelect::class, - \Zend\Filter\DateTimeFormatter::class => DateTimeFormatter::class, - \Zend\Filter\DateTimeSelect::class => DateTimeSelect::class, - \Zend\Filter\Decompress::class => Decompress::class, - \Zend\Filter\Decrypt::class => Decrypt::class, - \Zend\Filter\Digits::class => Digits::class, - \Zend\Filter\Dir::class => Dir::class, - \Zend\Filter\Encrypt::class => Encrypt::class, - \Zend\Filter\File\Decrypt::class => File\Decrypt::class, - \Zend\Filter\File\Encrypt::class => File\Encrypt::class, - \Zend\Filter\File\LowerCase::class => File\LowerCase::class, - \Zend\Filter\File\Rename::class => File\Rename::class, - \Zend\Filter\File\RenameUpload::class => File\RenameUpload::class, - \Zend\Filter\File\UpperCase::class => File\UpperCase::class, - \Zend\Filter\HtmlEntities::class => HtmlEntities::class, - \Zend\Filter\Inflector::class => Inflector::class, - \Zend\Filter\ToInt::class => ToInt::class, - \Zend\Filter\ToFloat::class => ToFloat::class, - \Zend\Filter\MonthSelect::class => MonthSelect::class, - \Zend\Filter\ToNull::class => ToNull::class, - \Zend\Filter\UpperCaseWords::class => UpperCaseWords::class, - \Zend\Filter\PregReplace::class => PregReplace::class, - \Zend\Filter\RealPath::class => RealPath::class, - \Zend\Filter\StringPrefix::class => StringPrefix::class, - \Zend\Filter\StringSuffix::class => StringSuffix::class, - \Zend\Filter\StringToLower::class => StringToLower::class, - \Zend\Filter\StringToUpper::class => StringToUpper::class, - \Zend\Filter\StringTrim::class => StringTrim::class, - \Zend\Filter\StripNewlines::class => StripNewlines::class, - \Zend\Filter\StripTags::class => StripTags::class, - \Zend\Filter\UriNormalize::class => UriNormalize::class, - \Zend\Filter\Whitelist::class => AllowList::class, - \Zend\Filter\Word\CamelCaseToDash::class => Word\CamelCaseToDash::class, - \Zend\Filter\Word\CamelCaseToSeparator::class => Word\CamelCaseToSeparator::class, - \Zend\Filter\Word\CamelCaseToUnderscore::class => Word\CamelCaseToUnderscore::class, - \Zend\Filter\Word\DashToCamelCase::class => Word\DashToCamelCase::class, - \Zend\Filter\Word\DashToSeparator::class => Word\DashToSeparator::class, - \Zend\Filter\Word\DashToUnderscore::class => Word\DashToUnderscore::class, - \Zend\Filter\Word\SeparatorToCamelCase::class => Word\SeparatorToCamelCase::class, - \Zend\Filter\Word\SeparatorToDash::class => Word\SeparatorToDash::class, - \Zend\Filter\Word\SeparatorToSeparator::class => Word\SeparatorToSeparator::class, - \Zend\Filter\Word\UnderscoreToCamelCase::class => Word\UnderscoreToCamelCase::class, + \Zend\I18n\Filter\Alnum::class => Alnum::class, + \Zend\I18n\Filter\Alpha::class => Alpha::class, + \Zend\I18n\Filter\NumberFormat::class => NumberFormat::class, + \Zend\I18n\Filter\NumberParse::class => NumberParse::class, + \Zend\Filter\BaseName::class => BaseName::class, + \Zend\Filter\Blacklist::class => DenyList::class, + \Zend\Filter\Boolean::class => Boolean::class, + \Zend\Filter\Callback::class => Callback::class, + \Zend\Filter\Compress::class => Compress::class, + \Zend\Filter\DataUnitFormatter::class => DataUnitFormatter::class, + \Zend\Filter\DateSelect::class => DateSelect::class, + \Zend\Filter\DateTimeFormatter::class => DateTimeFormatter::class, + \Zend\Filter\DateTimeSelect::class => DateTimeSelect::class, + \Zend\Filter\Decompress::class => Decompress::class, + \Zend\Filter\Decrypt::class => Decrypt::class, + \Zend\Filter\Digits::class => Digits::class, + \Zend\Filter\Dir::class => Dir::class, + \Zend\Filter\Encrypt::class => Encrypt::class, + \Zend\Filter\File\Decrypt::class => File\Decrypt::class, + \Zend\Filter\File\Encrypt::class => File\Encrypt::class, + \Zend\Filter\File\LowerCase::class => File\LowerCase::class, + \Zend\Filter\File\Rename::class => File\Rename::class, + \Zend\Filter\File\RenameUpload::class => File\RenameUpload::class, + \Zend\Filter\File\UpperCase::class => File\UpperCase::class, + \Zend\Filter\HtmlEntities::class => HtmlEntities::class, + \Zend\Filter\Inflector::class => Inflector::class, + \Zend\Filter\ToInt::class => ToInt::class, + \Zend\Filter\ToFloat::class => ToFloat::class, + \Zend\Filter\MonthSelect::class => MonthSelect::class, + \Zend\Filter\ToNull::class => ToNull::class, + \Zend\Filter\UpperCaseWords::class => UpperCaseWords::class, + \Zend\Filter\PregReplace::class => PregReplace::class, + \Zend\Filter\RealPath::class => RealPath::class, + \Zend\Filter\StringPrefix::class => StringPrefix::class, + \Zend\Filter\StringSuffix::class => StringSuffix::class, + \Zend\Filter\StringToLower::class => StringToLower::class, + \Zend\Filter\StringToUpper::class => StringToUpper::class, + \Zend\Filter\StringTrim::class => StringTrim::class, + \Zend\Filter\StripNewlines::class => StripNewlines::class, + \Zend\Filter\StripTags::class => StripTags::class, + \Zend\Filter\UriNormalize::class => UriNormalize::class, + \Zend\Filter\Whitelist::class => AllowList::class, + \Zend\Filter\Word\CamelCaseToDash::class => Word\CamelCaseToDash::class, + \Zend\Filter\Word\CamelCaseToSeparator::class => Word\CamelCaseToSeparator::class, + \Zend\Filter\Word\CamelCaseToUnderscore::class => Word\CamelCaseToUnderscore::class, + \Zend\Filter\Word\DashToCamelCase::class => Word\DashToCamelCase::class, + \Zend\Filter\Word\DashToSeparator::class => Word\DashToSeparator::class, + \Zend\Filter\Word\DashToUnderscore::class => Word\DashToUnderscore::class, + \Zend\Filter\Word\SeparatorToCamelCase::class => Word\SeparatorToCamelCase::class, + \Zend\Filter\Word\SeparatorToDash::class => Word\SeparatorToDash::class, + \Zend\Filter\Word\SeparatorToSeparator::class => Word\SeparatorToSeparator::class, + \Zend\Filter\Word\UnderscoreToCamelCase::class => Word\UnderscoreToCamelCase::class, \Zend\Filter\Word\UnderscoreToStudlyCase::class => Word\UnderscoreToStudlyCase::class, - \Zend\Filter\Word\UnderscoreToDash::class => Word\UnderscoreToDash::class, - \Zend\Filter\Word\UnderscoreToSeparator::class => Word\UnderscoreToSeparator::class, + \Zend\Filter\Word\UnderscoreToDash::class => Word\UnderscoreToDash::class, + \Zend\Filter\Word\UnderscoreToSeparator::class => Word\UnderscoreToSeparator::class, // v2 normalized FQCNs - 'zendfiltertoint' => ToInt::class, - 'zendfiltertofloat' => ToFloat::class, - 'zendfiltertonull' => ToNull::class, - 'zendi18nfilteralnum' => Alnum::class, - 'zendi18nfilteralpha' => Alpha::class, - 'zendi18nfilternumberformat' => NumberFormat::class, - 'zendi18nfilternumberparse' => NumberParse::class, - 'zendfilterbasename' => BaseName::class, - 'zendfilterblacklist' => DenyList::class, - 'zendfilterboolean' => Boolean::class, - 'zendfiltercallback' => Callback::class, - 'zendfiltercompress' => Compress::class, - 'zendfilterdataunitformatter' => DataUnitFormatter::class, - 'zendfilterdateselect' => DateSelect::class, - 'zendfilterdatetimeformatter' => DateTimeFormatter::class, - 'zendfilterdatetimeselect' => DateTimeSelect::class, - 'zendfilterdecompress' => Decompress::class, - 'zendfilterdecrypt' => Decrypt::class, - 'zendfilterdigits' => Digits::class, - 'zendfilterdir' => Dir::class, - 'zendfilterencrypt' => Encrypt::class, - 'zendfilterfiledecrypt' => File\Decrypt::class, - 'zendfilterfileencrypt' => File\Encrypt::class, - 'zendfilterfilelowercase' => File\LowerCase::class, - 'zendfilterfilerename' => File\Rename::class, - 'zendfilterfilerenameupload' => File\RenameUpload::class, - 'zendfilterfileuppercase' => File\UpperCase::class, - 'zendfilterhtmlentities' => HtmlEntities::class, - 'zendfilterinflector' => Inflector::class, - 'zendfiltermonthselect' => MonthSelect::class, - 'zendfilterpregreplace' => PregReplace::class, - 'zendfilterrealpath' => RealPath::class, - 'zendfilterstringprefix' => StringPrefix::class, - 'zendfilterstringsuffix' => StringSuffix::class, - 'zendfilterstringtolower' => StringToLower::class, - 'zendfilterstringtoupper' => StringToUpper::class, - 'zendfilterstringtrim' => StringTrim::class, - 'zendfilterstripnewlines' => StripNewlines::class, - 'zendfilterstriptags' => StripTags::class, - 'zendfilteruppercasewords' => UpperCaseWords::class, - 'zendfilterurinormalize' => UriNormalize::class, - 'zendfilterwhitelist' => AllowList::class, - 'zendfilterwordcamelcasetodash' => Word\CamelCaseToDash::class, - 'zendfilterwordcamelcasetoseparator' => Word\CamelCaseToSeparator::class, - 'zendfilterwordcamelcasetounderscore' => Word\CamelCaseToUnderscore::class, - 'zendfilterworddashtocamelcase' => Word\DashToCamelCase::class, - 'zendfilterworddashtoseparator' => Word\DashToSeparator::class, - 'zendfilterworddashtounderscore' => Word\DashToUnderscore::class, - 'zendfilterwordseparatortocamelcase' => Word\SeparatorToCamelCase::class, - 'zendfilterwordseparatortodash' => Word\SeparatorToDash::class, - 'zendfilterwordseparatortoseparator' => Word\SeparatorToSeparator::class, - 'zendfilterwordunderscoretocamelcase' => Word\UnderscoreToCamelCase::class, + 'zendfiltertoint' => ToInt::class, + 'zendfiltertofloat' => ToFloat::class, + 'zendfiltertonull' => ToNull::class, + 'zendi18nfilteralnum' => Alnum::class, + 'zendi18nfilteralpha' => Alpha::class, + 'zendi18nfilternumberformat' => NumberFormat::class, + 'zendi18nfilternumberparse' => NumberParse::class, + 'zendfilterbasename' => BaseName::class, + 'zendfilterblacklist' => DenyList::class, + 'zendfilterboolean' => Boolean::class, + 'zendfiltercallback' => Callback::class, + 'zendfiltercompress' => Compress::class, + 'zendfilterdataunitformatter' => DataUnitFormatter::class, + 'zendfilterdateselect' => DateSelect::class, + 'zendfilterdatetimeformatter' => DateTimeFormatter::class, + 'zendfilterdatetimeselect' => DateTimeSelect::class, + 'zendfilterdecompress' => Decompress::class, + 'zendfilterdecrypt' => Decrypt::class, + 'zendfilterdigits' => Digits::class, + 'zendfilterdir' => Dir::class, + 'zendfilterencrypt' => Encrypt::class, + 'zendfilterfiledecrypt' => File\Decrypt::class, + 'zendfilterfileencrypt' => File\Encrypt::class, + 'zendfilterfilelowercase' => File\LowerCase::class, + 'zendfilterfilerename' => File\Rename::class, + 'zendfilterfilerenameupload' => File\RenameUpload::class, + 'zendfilterfileuppercase' => File\UpperCase::class, + 'zendfilterhtmlentities' => HtmlEntities::class, + 'zendfilterinflector' => Inflector::class, + 'zendfiltermonthselect' => MonthSelect::class, + 'zendfilterpregreplace' => PregReplace::class, + 'zendfilterrealpath' => RealPath::class, + 'zendfilterstringprefix' => StringPrefix::class, + 'zendfilterstringsuffix' => StringSuffix::class, + 'zendfilterstringtolower' => StringToLower::class, + 'zendfilterstringtoupper' => StringToUpper::class, + 'zendfilterstringtrim' => StringTrim::class, + 'zendfilterstripnewlines' => StripNewlines::class, + 'zendfilterstriptags' => StripTags::class, + 'zendfilteruppercasewords' => UpperCaseWords::class, + 'zendfilterurinormalize' => UriNormalize::class, + 'zendfilterwhitelist' => AllowList::class, + 'zendfilterwordcamelcasetodash' => Word\CamelCaseToDash::class, + 'zendfilterwordcamelcasetoseparator' => Word\CamelCaseToSeparator::class, + 'zendfilterwordcamelcasetounderscore' => Word\CamelCaseToUnderscore::class, + 'zendfilterworddashtocamelcase' => Word\DashToCamelCase::class, + 'zendfilterworddashtoseparator' => Word\DashToSeparator::class, + 'zendfilterworddashtounderscore' => Word\DashToUnderscore::class, + 'zendfilterwordseparatortocamelcase' => Word\SeparatorToCamelCase::class, + 'zendfilterwordseparatortodash' => Word\SeparatorToDash::class, + 'zendfilterwordseparatortoseparator' => Word\SeparatorToSeparator::class, + 'zendfilterwordunderscoretocamelcase' => Word\UnderscoreToCamelCase::class, 'zendfilterwordunderscoretostudlycase' => Word\UnderscoreToStudlyCase::class, - 'zendfilterwordunderscoretodash' => Word\UnderscoreToDash::class, - 'zendfilterwordunderscoretoseparator' => Word\UnderscoreToSeparator::class, + 'zendfilterwordunderscoretodash' => Word\UnderscoreToDash::class, + 'zendfilterwordunderscoretoseparator' => Word\UnderscoreToSeparator::class, + // @codingStandardsIgnoreEnd ]; /** @@ -319,70 +328,69 @@ class FilterPluginManager extends AbstractPluginManager */ protected $factories = [ // I18n filters - Alnum::class => InvokableFactory::class, - Alpha::class => InvokableFactory::class, - NumberFormat::class => InvokableFactory::class, - NumberParse::class => InvokableFactory::class, + Alnum::class => InvokableFactory::class, + Alpha::class => InvokableFactory::class, + NumberFormat::class => InvokableFactory::class, + NumberParse::class => InvokableFactory::class, // Standard filters - AllowList::class => InvokableFactory::class, - BaseName::class => InvokableFactory::class, - Blacklist::class => InvokableFactory::class, - Boolean::class => InvokableFactory::class, - Callback::class => InvokableFactory::class, - Compress::class => InvokableFactory::class, - DataUnitFormatter::class => InvokableFactory::class, - DateSelect::class => InvokableFactory::class, - DateTimeFormatter::class => InvokableFactory::class, - DateTimeSelect::class => InvokableFactory::class, - Decompress::class => InvokableFactory::class, - Decrypt::class => InvokableFactory::class, - DenyList::class => InvokableFactory::class, - Digits::class => InvokableFactory::class, - Dir::class => InvokableFactory::class, - Encrypt::class => InvokableFactory::class, - File\Decrypt::class => InvokableFactory::class, - File\Encrypt::class => InvokableFactory::class, - File\LowerCase::class => InvokableFactory::class, - File\Rename::class => InvokableFactory::class, - File\RenameUpload::class => InvokableFactory::class, - File\UpperCase::class => InvokableFactory::class, - HtmlEntities::class => InvokableFactory::class, - Inflector::class => InvokableFactory::class, - ToInt::class => InvokableFactory::class, - ToFloat::class => InvokableFactory::class, - MonthSelect::class => InvokableFactory::class, - ToNull::class => InvokableFactory::class, - UpperCaseWords::class => InvokableFactory::class, - PregReplace::class => InvokableFactory::class, - RealPath::class => InvokableFactory::class, - StringPrefix::class => InvokableFactory::class, - StringSuffix::class => InvokableFactory::class, - StringToLower::class => InvokableFactory::class, - StringToUpper::class => InvokableFactory::class, - StringTrim::class => InvokableFactory::class, - StripNewlines::class => InvokableFactory::class, - StripTags::class => InvokableFactory::class, - ToInt::class => InvokableFactory::class, - ToNull::class => InvokableFactory::class, - UriNormalize::class => InvokableFactory::class, - Whitelist::class => InvokableFactory::class, - Word\CamelCaseToDash::class => InvokableFactory::class, - Word\CamelCaseToSeparator::class => InvokableFactory::class, - Word\CamelCaseToUnderscore::class => InvokableFactory::class, - Word\DashToCamelCase::class => InvokableFactory::class, - Word\DashToSeparator::class => InvokableFactory::class, - Word\DashToUnderscore::class => InvokableFactory::class, - Word\SeparatorToCamelCase::class => InvokableFactory::class, - Word\SeparatorToDash::class => InvokableFactory::class, - Word\SeparatorToSeparator::class => Word\Service\SeparatorToSeparatorFactory::class, - Word\UnderscoreToCamelCase::class => InvokableFactory::class, - Word\UnderscoreToStudlyCase::class => InvokableFactory::class, - Word\UnderscoreToDash::class => InvokableFactory::class, - Word\UnderscoreToSeparator::class => InvokableFactory::class, + AllowList::class => InvokableFactory::class, + BaseName::class => InvokableFactory::class, + Blacklist::class => InvokableFactory::class, + Boolean::class => InvokableFactory::class, + Callback::class => InvokableFactory::class, + Compress::class => InvokableFactory::class, + DataUnitFormatter::class => InvokableFactory::class, + DateSelect::class => InvokableFactory::class, + DateTimeFormatter::class => InvokableFactory::class, + DateTimeSelect::class => InvokableFactory::class, + Decompress::class => InvokableFactory::class, + Decrypt::class => InvokableFactory::class, + DenyList::class => InvokableFactory::class, + Digits::class => InvokableFactory::class, + Dir::class => InvokableFactory::class, + Encrypt::class => InvokableFactory::class, + File\Decrypt::class => InvokableFactory::class, + File\Encrypt::class => InvokableFactory::class, + File\LowerCase::class => InvokableFactory::class, + File\Rename::class => InvokableFactory::class, + File\RenameUpload::class => InvokableFactory::class, + File\UpperCase::class => InvokableFactory::class, + HtmlEntities::class => InvokableFactory::class, + Inflector::class => InvokableFactory::class, + ToInt::class => InvokableFactory::class, + ToFloat::class => InvokableFactory::class, + MonthSelect::class => InvokableFactory::class, + ToNull::class => InvokableFactory::class, + UpperCaseWords::class => InvokableFactory::class, + PregReplace::class => InvokableFactory::class, + RealPath::class => InvokableFactory::class, + StringPrefix::class => InvokableFactory::class, + StringSuffix::class => InvokableFactory::class, + StringToLower::class => InvokableFactory::class, + StringToUpper::class => InvokableFactory::class, + StringTrim::class => InvokableFactory::class, + StripNewlines::class => InvokableFactory::class, + StripTags::class => InvokableFactory::class, + ToInt::class => InvokableFactory::class, + ToNull::class => InvokableFactory::class, + UriNormalize::class => InvokableFactory::class, + Whitelist::class => InvokableFactory::class, + Word\CamelCaseToDash::class => InvokableFactory::class, + Word\CamelCaseToSeparator::class => InvokableFactory::class, + Word\CamelCaseToUnderscore::class => InvokableFactory::class, + Word\DashToCamelCase::class => InvokableFactory::class, + Word\DashToSeparator::class => InvokableFactory::class, + Word\DashToUnderscore::class => InvokableFactory::class, + Word\SeparatorToCamelCase::class => InvokableFactory::class, + Word\SeparatorToDash::class => InvokableFactory::class, + Word\SeparatorToSeparator::class => Word\Service\SeparatorToSeparatorFactory::class, + Word\UnderscoreToCamelCase::class => InvokableFactory::class, + Word\UnderscoreToStudlyCase::class => InvokableFactory::class, + Word\UnderscoreToDash::class => InvokableFactory::class, + Word\UnderscoreToSeparator::class => InvokableFactory::class, // v2 canonical FQCNs - 'laminasfiltertoint' => InvokableFactory::class, 'laminasfiltertofloat' => InvokableFactory::class, 'laminasfiltertonull' => InvokableFactory::class, @@ -473,7 +481,7 @@ public function validate($plugin) throw new InvalidServiceException(sprintf( 'Plugin of type %s is invalid; must implement %s\FilterInterface or be callable', - (is_object($plugin) ? get_class($plugin) : gettype($plugin)), + is_object($plugin) ? get_class($plugin) : gettype($plugin), __NAMESPACE__ )); } @@ -486,7 +494,7 @@ public function validate($plugin) * * @param mixed $plugin * @return void - * @throws Exception\RuntimeException if invalid + * @throws RuntimeException If invalid. */ public function validatePlugin($plugin) { diff --git a/src/FilterPluginManagerFactory.php b/src/FilterPluginManagerFactory.php index fce5e587..2393c59f 100644 --- a/src/FilterPluginManagerFactory.php +++ b/src/FilterPluginManagerFactory.php @@ -1,5 +1,7 @@ setPluginManager($options['pluginManager']); } @@ -216,7 +223,7 @@ public function getTarget() */ public function setTargetReference(&$target) { - $this->target =& $target; + $this->target = &$target; return $this; } @@ -320,12 +327,12 @@ public function clearRules() * or an array of strings or filter objects. * * @param string $spec - * @param array|string|\Laminas\Filter\FilterInterface $ruleSet + * @param array|string|FilterInterface $ruleSet * @return self */ public function setFilterRule($spec, $ruleSet) { - $spec = $this->_normalizeSpec($spec); + $spec = $this->_normalizeSpec($spec); $this->rules[$spec] = []; return $this->addFilterRule($spec, $ruleSet); } @@ -349,8 +356,8 @@ public function addFilterRule($spec, $ruleSet) } if (is_string($this->rules[$spec])) { - $temp = $this->rules[$spec]; - $this->rules[$spec] = []; + $temp = $this->rules[$spec]; + $this->rules[$spec] = []; $this->rules[$spec][] = $temp; } @@ -370,7 +377,7 @@ public function addFilterRule($spec, $ruleSet) */ public function setStaticRule($name, $value) { - $name = $this->_normalizeSpec($name); + $name = $this->_normalizeSpec($name); $this->rules[$name] = (string) $value; return $this; } @@ -388,8 +395,8 @@ public function setStaticRule($name, $value) */ public function setStaticRuleReference($name, &$reference) { - $name = $this->_normalizeSpec($name); - $this->rules[$name] =& $reference; + $name = $this->_normalizeSpec($name); + $this->rules[$name] = &$reference; return $this; } @@ -408,7 +415,7 @@ public function filter($source) } $pregQuotedTargetReplacementIdentifier = preg_quote($this->targetReplacementIdentifier, '#'); - $processedParts = []; + $processedParts = []; foreach ($this->rules as $ruleName => $ruleValue) { if (isset($source[$ruleName])) { @@ -443,8 +450,9 @@ public function filter($source) // to disable preg_replace backreferences $inflectedTarget = preg_replace(array_keys($processedParts), array_values($processedParts), $this->target); - if ($this->throwTargetExceptionsOn - && preg_match('#(?=' . $pregQuotedTargetReplacementIdentifier.'[A-Za-z]{1})#', $inflectedTarget) + if ( + $this->throwTargetExceptionsOn + && preg_match('#(?=' . $pregQuotedTargetReplacementIdentifier . '[A-Za-z]{1})#', $inflectedTarget) ) { throw new Exception\RuntimeException( 'A replacement identifier ' . $this->targetReplacementIdentifier diff --git a/src/Module.php b/src/Module.php index 694e8ac8..a03522ca 100644 --- a/src/Module.php +++ b/src/Module.php @@ -1,7 +1,11 @@ getEvent(); - $container = $event->getParam('ServiceManager'); + $event = $moduleManager->getEvent(); + $container = $event->getParam('ServiceManager'); $serviceListener = $container->get('ServiceListener'); $serviceListener->addServiceManager( diff --git a/src/MonthSelect.php b/src/MonthSelect.php index dd024c7b..16ad7280 100644 --- a/src/MonthSelect.php +++ b/src/MonthSelect.php @@ -1,5 +1,7 @@ options['replacement'] = $replacement; @@ -127,7 +144,7 @@ public function filter($value) if ($this->options['pattern'] === null) { throw new Exception\RuntimeException(sprintf( 'Filter %s does not have a valid pattern set', - get_class($this) + static::class )); } diff --git a/src/RealPath.php b/src/RealPath.php index 0f8cb0ec..0b43d04e 100644 --- a/src/RealPath.php +++ b/src/RealPath.php @@ -1,22 +1,35 @@ true + 'exists' => true, ]; /** - * Class constructor - * * @param bool|Traversable $existsOrOptions Options to set */ public function __construct($existsOrOptions = true) @@ -86,7 +99,7 @@ public function filter($value) if (stripos(PHP_OS, 'WIN') === 0) { $path = preg_replace('/[\\\\\/]/', DIRECTORY_SEPARATOR, $path); if (preg_match('/([a-zA-Z]\:)(.*)/', $path, $matches)) { - list(, $drive, $path) = $matches; + [, $drive, $path] = $matches; } else { $cwd = getcwd(); $drive = substr($cwd, 0, 2); diff --git a/src/StaticFilter.php b/src/StaticFilter.php index 3123dd1c..731b6845 100644 --- a/src/StaticFilter.php +++ b/src/StaticFilter.php @@ -1,23 +1,22 @@ - */ + /** @var array */ protected $options = [ 'prefix' => null, ]; @@ -55,7 +62,7 @@ public function getPrefix() if (! isset($this->options['prefix'])) { throw new Exception\InvalidArgumentException(sprintf( '%s expects a "prefix" option; none given', - __CLASS__ + self::class )); } diff --git a/src/StringSuffix.php b/src/StringSuffix.php index 0b6f1d79..f91dda14 100644 --- a/src/StringSuffix.php +++ b/src/StringSuffix.php @@ -1,14 +1,21 @@ - */ + /** @var array */ protected $options = [ 'suffix' => null, ]; @@ -27,7 +34,6 @@ public function __construct($options = null) * Set the suffix string * * @param string $suffix - * * @return self * @throws Exception\InvalidArgumentException */ @@ -57,7 +63,7 @@ public function getSuffix() if (! isset($this->options['suffix'])) { throw new Exception\InvalidArgumentException(sprintf( '%s expects a "suffix" option; none given', - __CLASS__ + self::class )); } diff --git a/src/StringToLower.php b/src/StringToLower.php index 4548df76..203664f9 100644 --- a/src/StringToLower.php +++ b/src/StringToLower.php @@ -1,14 +1,18 @@ null, ]; diff --git a/src/StringToUpper.php b/src/StringToUpper.php index 150bb3e6..c37b988f 100644 --- a/src/StringToUpper.php +++ b/src/StringToUpper.php @@ -1,14 +1,18 @@ null, ]; diff --git a/src/StringTrim.php b/src/StringTrim.php index 2a58ffce..183120bc 100644 --- a/src/StringTrim.php +++ b/src/StringTrim.php @@ -1,14 +1,19 @@ null, ]; @@ -21,7 +26,7 @@ class StringTrim extends AbstractFilter public function __construct($charlistOrOptions = null) { if ($charlistOrOptions !== null) { - if (! is_array($charlistOrOptions) && ! $charlistOrOptions instanceof Traversable) { + if (! is_array($charlistOrOptions) && ! $charlistOrOptions instanceof Traversable) { $this->setCharList($charlistOrOptions); } else { $this->setOptions($charlistOrOptions); diff --git a/src/StripNewlines.php b/src/StripNewlines.php index 907dbfc0..652647a6 100644 --- a/src/StripNewlines.php +++ b/src/StripNewlines.php @@ -1,7 +1,13 @@ tagsAllowed[$tagName][$attributeName] = null; } } @@ -147,7 +167,7 @@ public function setAttributesAllowed($attributesAllowed) foreach ($attributesAllowed as $attribute) { if (is_string($attribute)) { // Canonicalize the attribute name - $attributeName = strtolower($attribute); + $attributeName = strtolower($attribute); $this->attributesAllowed[$attributeName] = null; } } @@ -264,8 +284,10 @@ protected function _filterTag($tag) $attributeValue = $matches[3][$index] === '' ? $matches[5][$index] : $matches[3][$index]; // If the attribute is not allowed, then remove it entirely - if (! array_key_exists($attributeName, $this->tagsAllowed[$tagName]) - && ! array_key_exists($attributeName, $this->attributesAllowed)) { + if ( + ! array_key_exists($attributeName, $this->tagsAllowed[$tagName]) + && ! array_key_exists($attributeName, $this->attributesAllowed) + ) { continue; } // Add the attribute to the accumulator diff --git a/src/ToFloat.php b/src/ToFloat.php index 5cc9cef2..6d12fff2 100644 --- a/src/ToFloat.php +++ b/src/ToFloat.php @@ -1,7 +1,11 @@ 'boolean', self::TYPE_INTEGER => 'integer', @@ -27,9 +37,7 @@ class ToNull extends AbstractFilter self::TYPE_ALL => 'all', ]; - /** - * @var array - */ + /** @var array */ protected $options = [ 'type' => self::TYPE_ALL, ]; diff --git a/src/UpperCaseWords.php b/src/UpperCaseWords.php index 0a041e68..7bda36bb 100644 --- a/src/UpperCaseWords.php +++ b/src/UpperCaseWords.php @@ -1,20 +1,31 @@ null + 'encoding' => null, ]; /** * Constructor * - * @param string|array|\Traversable $encodingOrOptions OPTIONAL + * @param string|array|Traversable $encodingOrOptions OPTIONAL */ public function __construct($encodingOrOptions = null) { diff --git a/src/UriNormalize.php b/src/UriNormalize.php index 1271ca55..6877fc17 100644 --- a/src/UriNormalize.php +++ b/src/UriNormalize.php @@ -1,10 +1,17 @@ getPath(); if (strpos($path, '/') !== false) { - list($host, $path) = explode('/', $path, 2); - $path = '/' . $path; + [$host, $path] = explode('/', $path, 2); + $path = '/' . $path; } else { $host = $path; $path = ''; diff --git a/src/Whitelist.php b/src/Whitelist.php index 7a5c25a1..977f5dff 100644 --- a/src/Whitelist.php +++ b/src/Whitelist.php @@ -1,5 +1,7 @@ ['test', 1], - 'strict' => true, + 'list' => ['test', 1], + 'strict' => true, ]); $this->assertEquals(true, $filter->getStrict()); @@ -33,7 +39,7 @@ public function testConstructorDefaults(): void public function testWithPluginManager(): void { $pluginManager = new FilterPluginManager(new ServiceManager()); - $filter = $pluginManager->get('AllowList'); + $filter = $pluginManager->get('AllowList'); $this->assertInstanceOf(AllowListFilter::class, $filter); } @@ -48,8 +54,8 @@ public function testNullListShouldThrowException(): void public function testTraversableConvertsToArray(): void { - $array = ['test', 1]; - $obj = new ArrayObject(['test', 1]); + $array = ['test', 1]; + $obj = new ArrayObject(['test', 1]); $filter = new AllowListFilter([ 'list' => $obj, ]); @@ -59,7 +65,7 @@ public function testTraversableConvertsToArray(): void public function testSetStrictShouldCastToBoolean(): void { $filter = new AllowListFilter([ - 'strict' => 1 + 'strict' => 1, ]); $this->assertSame(true, $filter->getStrict()); } @@ -88,7 +94,7 @@ public function testList($strict, $list, $testData): void ]); foreach ($testData as $data) { [$value, $expected] = $data; - $message = sprintf( + $message = sprintf( '%s (%s) is not filtered as %s; type = %s', var_export($value, true), gettype($value), @@ -105,7 +111,7 @@ public static function defaultTestProvider(): array ['test', null], [0, null], [0.1, null], - [[], null], + [[], null], [null, null], ]; } @@ -122,7 +128,7 @@ public static function listTestProvider(): array [null, null], [false, null], [0.0, null], - [[], null], + [[], null], ], ], [ @@ -135,7 +141,7 @@ public static function listTestProvider(): array [false, false], [0.0, 0.0], [0.1, null], - [[], null], + [[], null], ], ], ]; diff --git a/test/BaseNameTest.php b/test/BaseNameTest.php index 5870c89b..4943b257 100644 --- a/test/BaseNameTest.php +++ b/test/BaseNameTest.php @@ -1,14 +1,12 @@ 'filename', - '/path/to/filename.ext' => 'filename.ext' + '/path/to/filename' => 'filename', + '/path/to/filename.ext' => 'filename.ext', ]; foreach ($valuesExpected as $input => $output) { $this->assertEquals($output, $filter($input)); @@ -33,11 +31,13 @@ public function returnUnfilteredDataProvider() { return [ [null], - [new \stdClass()], - [[ - '/path/to/filename', - '/path/to/filename.ext' - ]] + [new stdClass()], + [ + [ + '/path/to/filename', + '/path/to/filename.ext', + ], + ], ]; } diff --git a/test/BlacklistTest.php b/test/BlacklistTest.php index d9c29f5f..60544e24 100644 --- a/test/BlacklistTest.php +++ b/test/BlacklistTest.php @@ -1,5 +1,7 @@ get('blacklist'); + $filter = $pluginManager->get('blacklist'); $this->assertInstanceOf(DenyList::class, $filter); } diff --git a/test/BooleanTest.php b/test/BooleanTest.php index 169926a8..9a107af3 100644 --- a/test/BooleanTest.php +++ b/test/BooleanTest.php @@ -1,11 +1,17 @@ $type]); foreach ($testData as $data) { - list($value, $expected) = $data; - $message = sprintf( + [$value, $expected] = $data; + $message = sprintf( '%s (%s) is not filtered as %s; type = %s', var_export($value, true), gettype($value), @@ -96,7 +102,7 @@ public function testCombinedTypes($typeData, $testData) public function testLocalized() { $filter = new BooleanFilter([ - 'type' => BooleanFilter::TYPE_LOCALIZED, + 'type' => BooleanFilter::TYPE_LOCALIZED, 'translations' => [ 'yes' => true, 'y' => true, @@ -104,7 +110,7 @@ public function testLocalized() 'n' => false, 'yay' => true, 'nay' => false, - ] + ], ]); $this->assertTrue($filter->filter('yes')); @@ -132,7 +138,6 @@ public function testGettingDefaultType() * https://github.com/zendframework/zend-filter/issues/48 * * @param mixed $type Type to double initialize - * * @dataProvider duplicateProvider */ public function testDuplicateTypesWorkProperly($type, $expected) @@ -211,7 +216,7 @@ public static function typeTestProvider() ['true', true], ['no', true], ['yes', true], - ] + ], ], [ BooleanFilter::TYPE_INTEGER, @@ -233,7 +238,7 @@ public static function typeTestProvider() ['true', true], ['no', true], ['yes', true], - ] + ], ], [ BooleanFilter::TYPE_FLOAT, @@ -255,7 +260,7 @@ public static function typeTestProvider() ['true', true], ['no', true], ['yes', true], - ] + ], ], [ BooleanFilter::TYPE_STRING, @@ -277,7 +282,7 @@ public static function typeTestProvider() ['true', true], ['no', true], ['yes', true], - ] + ], ], [ BooleanFilter::TYPE_ZERO_STRING, @@ -299,7 +304,7 @@ public static function typeTestProvider() ['true', true], ['no', true], ['yes', true], - ] + ], ], [ BooleanFilter::TYPE_EMPTY_ARRAY, @@ -321,7 +326,7 @@ public static function typeTestProvider() ['true', true], ['no', true], ['yes', true], - ] + ], ], [ BooleanFilter::TYPE_NULL, @@ -343,7 +348,7 @@ public static function typeTestProvider() ['true', true], ['no', true], ['yes', true], - ] + ], ], [ BooleanFilter::TYPE_PHP, @@ -365,7 +370,7 @@ public static function typeTestProvider() ['true', true], ['no', true], ['yes', true], - ] + ], ], [ BooleanFilter::TYPE_FALSE_STRING, @@ -387,7 +392,7 @@ public static function typeTestProvider() ['true', true], ['no', true], ['yes', true], - ] + ], ], // default behaviour with no translations provided // all values filtered as true @@ -411,7 +416,7 @@ public static function typeTestProvider() ['true', true], ['no', true], ['yes', true], - ] + ], ], [ BooleanFilter::TYPE_ALL, @@ -433,7 +438,7 @@ public static function typeTestProvider() ['true', true], ['no', true], ['yes', true], - ] + ], ], ]; } @@ -474,8 +479,8 @@ public static function combinedTypeTestProvider() ['true', true], ['no', true], ['yes', true], - ] - ] + ], + ], ]; } diff --git a/test/CallbackTest.php b/test/CallbackTest.php index b10a04e6..edbccdac 100644 --- a/test/CallbackTest.php +++ b/test/CallbackTest.php @@ -1,5 +1,7 @@ assertEquals('staticCallback-test', $filter('test')); } diff --git a/test/Compress/Bz2Test.php b/test/Compress/Bz2Test.php index 80240121..dc380495 100644 --- a/test/Compress/Bz2Test.php +++ b/test/Compress/Bz2Test.php @@ -1,11 +1,20 @@ compress('compress me'); $this->assertNotEquals('compress me', $content); @@ -115,7 +124,7 @@ public function testBz2GetSetArchive() */ public function testBz2CompressToFile() { - $filter = new Bz2Compression(); + $filter = new Bz2Compression(); $archive = $this->target; $filter->setArchive($archive); @@ -150,7 +159,7 @@ public function testBz2ToString() */ public function testBz2DecompressArchive() { - $filter = new Bz2Compression(); + $filter = new Bz2Compression(); $archive = $this->target; $filter->setArchive($archive); @@ -161,4 +170,12 @@ public function testBz2DecompressArchive() $content2 = $filter2->decompress($archive); $this->assertEquals('compress me', $content2); } + + public function testBz2DecompressNullValueIsAccepted() + { + $filter = new Bz2Compression(); + $result = $filter->decompress(null); + + $this->assertEmpty($result); + } } diff --git a/test/Compress/GzTest.php b/test/Compress/GzTest.php index 316d9eff..757cd21b 100644 --- a/test/Compress/GzTest.php +++ b/test/Compress/GzTest.php @@ -1,11 +1,20 @@ compress('compress me'); $this->assertNotEquals('compress me', $content); @@ -134,7 +143,7 @@ public function testGzGetSetArchive() */ public function testGzCompressToFile() { - $filter = new GzCompression(); + $filter = new GzCompression(); $archive = $this->target; $filter->setArchive($archive); @@ -158,7 +167,7 @@ public function testGzCompressToFile() */ public function testGzDeflate() { - $filter = new GzCompression(['mode' => 'deflate']); + $filter = new GzCompression(['mode' => 'deflate']); $content = $filter->compress('compress me'); $this->assertNotEquals('compress me', $content); @@ -177,4 +186,13 @@ public function testGzToString() $filter = new GzCompression(); $this->assertEquals('Gz', $filter->toString()); } + + public function testGzDecompressNullThrowsRuntimeException() + { + $this->expectException(Exception\RuntimeException::class); + $this->expectExceptionMessage('Error during decompression'); + + $filter = new GzCompression(); + $filter->decompress(null); + } } diff --git a/test/Compress/LzfTest.php b/test/Compress/LzfTest.php index 0e50dc70..0ed1a4d6 100644 --- a/test/Compress/LzfTest.php +++ b/test/Compress/LzfTest.php @@ -1,11 +1,15 @@ compress($text); diff --git a/test/Compress/RarTest.php b/test/Compress/RarTest.php index f3238274..900c249c 100644 --- a/test/Compress/RarTest.php +++ b/test/Compress/RarTest.php @@ -1,11 +1,27 @@ tmp . '/_compress/Compress/zipextracted.txt', $this->tmp . '/_compress/Compress', $this->tmp . '/_compress/zipextracted.txt', - $this->tmp . '/_compress' + $this->tmp . '/_compress', ]; foreach ($files as $file) { @@ -53,7 +69,7 @@ public function tearDown(): void $this->tmp . '/_compress/Compress/zipextracted.txt', $this->tmp . '/_compress/Compress', $this->tmp . '/_compress/zipextracted.txt', - $this->tmp . '/_compress' + $this->tmp . '/_compress', ]; foreach ($files as $file) { @@ -74,11 +90,11 @@ public function tearDown(): void */ public function testBasicUsage() { - $filter = new RarCompression( + $filter = new RarCompression( [ 'archive' => dirname(__DIR__) . '/_files/compressed.rar', 'target' => $this->tmp . '/zipextracted.txt', - 'callback' => [__CLASS__, 'rarCompress'] + 'callback' => [self::class, 'rarCompress'], ] ); @@ -180,7 +196,7 @@ public function testSettingCallback() { $filter = new RarCompression(); - $callback = [__CLASS__, 'rarCompress']; + $callback = [self::class, 'rarCompress']; $filter->setCallback($callback); $this->assertEquals($callback, $filter->getCallback()); } @@ -210,11 +226,11 @@ public function testSettingCallbackThrowsExceptionOnInvalidCallback() */ public function testRarCompressFile() { - $filter = new RarCompression( + $filter = new RarCompression( [ 'archive' => dirname(__DIR__) . '/_files/compressed.rar', 'target' => $this->tmp . '/zipextracted.txt', - 'callback' => [__CLASS__, 'rarCompress'] + 'callback' => [self::class, 'rarCompress'], ] ); file_put_contents($this->tmp . '/zipextracted.txt', 'compress me'); @@ -242,7 +258,7 @@ public function testRarCompressDirectory() [ 'archive' => dirname(__DIR__) . '/_files/compressed.rar', 'target' => $this->tmp . '/_compress', - 'callback' => [__CLASS__, 'rarCompress'] + 'callback' => [self::class, 'rarCompress'], ] ); $content = $filter->compress(dirname(__DIR__) . '/_files/Compress'); @@ -265,7 +281,7 @@ public function testRarCompressDirectory() $this->assertFileExists($base . 'zipextracted.txt'); $this->assertFileExists($base . 'First' . DIRECTORY_SEPARATOR . 'zipextracted.txt'); $this->assertFileExists( - $base . 'First' . DIRECTORY_SEPARATOR . 'Second' . DIRECTORY_SEPARATOR . 'zipextracted.txt' + $base . 'First' . DIRECTORY_SEPARATOR . 'Second' . DIRECTORY_SEPARATOR . 'zipextracted.txt' ); } diff --git a/test/Compress/SnappyTest.php b/test/Compress/SnappyTest.php index 9a4768c7..5edcac6c 100644 --- a/test/Compress/SnappyTest.php +++ b/test/Compress/SnappyTest.php @@ -1,11 +1,19 @@ compress('compress me'); $this->assertNotEquals('compress me', $content); diff --git a/test/Compress/TarLoadArchiveTarTest.php b/test/Compress/TarLoadArchiveTarTest.php index 42f0143f..71e07980 100644 --- a/test/Compress/TarLoadArchiveTarTest.php +++ b/test/Compress/TarLoadArchiveTarTest.php @@ -1,11 +1,19 @@ fail('ExtensionNotLoadedException was expected but not thrown'); } catch (ExtensionNotLoadedException $e) { } diff --git a/test/Compress/TarTest.php b/test/Compress/TarTest.php index 78ce6d26..226df337 100644 --- a/test/Compress/TarTest.php +++ b/test/Compress/TarTest.php @@ -1,11 +1,30 @@ tmp . '/_compress', $this->tmp . '/compressed.tar', $this->tmp . '/compressed.tar.gz', - $this->tmp . '/compressed.tar.bz2' + $this->tmp . '/compressed.tar.bz2', ]; foreach ($files as $file) { @@ -51,10 +70,10 @@ public function tearDown(): void */ public function testBasicUsage() { - $filter = new TarCompression( + $filter = new TarCompression( [ - 'archive' => $this->tmp . '/compressed.tar', - 'target' => $this->tmp . '/zipextracted.txt' + 'archive' => $this->tmp . '/compressed.tar', + 'target' => $this->tmp . '/zipextracted.txt', ] ); @@ -65,7 +84,7 @@ public function testBasicUsage() ); $content = $filter->decompress($content); - $this->assertEquals($this->tmp . DIRECTORY_SEPARATOR, $content); + $this->assertEquals($this->tmp . DIRECTORY_SEPARATOR, $content); $content = file_get_contents($this->tmp . '/zipextracted.txt'); $this->assertEquals('compress me', $content); } @@ -82,7 +101,8 @@ public function testTarGetSetOptions() [ 'archive' => null, 'target' => '.', - 'mode' => null], + 'mode' => null, + ], $filter->getOptions() ); @@ -135,10 +155,10 @@ public function testTarGetSetTarget() */ public function testTarCompressToFile() { - $filter = new TarCompression( + $filter = new TarCompression( [ - 'archive' => $this->tmp . '/compressed.tar', - 'target' => $this->tmp . '/zipextracted.txt' + 'archive' => $this->tmp . '/compressed.tar', + 'target' => $this->tmp . '/zipextracted.txt', ] ); file_put_contents($this->tmp . '/zipextracted.txt', 'compress me'); @@ -164,8 +184,8 @@ public function testTarCompressDirectory() { $filter = new TarCompression( [ - 'archive' => $this->tmp . '/compressed.tar', - 'target' => $this->tmp . '/_compress' + 'archive' => $this->tmp . '/compressed.tar', + 'target' => $this->tmp . '/_compress', ] ); $content = $filter->compress(dirname(__DIR__) . '/_files/Compress'); @@ -177,7 +197,7 @@ public function testTarCompressDirectory() public function testSetModeShouldWorkWithCaseInsensitive() { - $filter = new TarCompression; + $filter = new TarCompression(); $filter->setTarget($this->tmp . '/zipextracted.txt'); foreach (['GZ', 'Bz2'] as $mode) { @@ -210,10 +230,10 @@ public function testDecompressionDoesNotRequireArchive() { $filter = new TarCompression([ 'archive' => $this->tmp . '/compressed.tar', - 'target' => $this->tmp . '/zipextracted.txt', + 'target' => $this->tmp . '/zipextracted.txt', ]); - $content = 'compress me ' . microtime(true); + $content = 'compress me ' . microtime(true); $compressed = $filter->compress($content); self::assertSame($this->tmp . DIRECTORY_SEPARATOR . 'compressed.tar', $compressed); diff --git a/test/Compress/ZipTest.php b/test/Compress/ZipTest.php index 04fe1518..2684fa7b 100644 --- a/test/Compress/ZipTest.php +++ b/test/Compress/ZipTest.php @@ -1,11 +1,27 @@ markTestSkipped('This adapter needs the zip extension'); } - $this->tmp = sys_get_temp_dir() . DIRECTORY_SEPARATOR . str_replace('\\', '_', __CLASS__); + $this->tmp = sys_get_temp_dir() . DIRECTORY_SEPARATOR . str_replace('\\', '_', self::class); $files = [ $this->tmp . '/compressed.zip', @@ -27,7 +43,7 @@ public function setUp(): void $this->tmp . '/_files/_compress/Compress/zipextracted.txt', $this->tmp . '/_files/_compress/Compress', $this->tmp . '/_files/_compress/zipextracted.txt', - $this->tmp . '/_files/_compress' + $this->tmp . '/_files/_compress', ]; foreach ($files as $file) { @@ -61,7 +77,7 @@ public function tearDown(): void $this->tmp . '/_compress/Compress/zipextracted.txt', $this->tmp . '/_compress/Compress', $this->tmp . '/_compress/zipextracted.txt', - $this->tmp . '/_compress' + $this->tmp . '/_compress', ]; foreach ($files as $file) { @@ -93,10 +109,10 @@ public function testBasicUsage() $this->markTestSkipped('ZIP compression tests are currently disabled'); } - $filter = new ZipCompression( + $filter = new ZipCompression( [ 'archive' => $this->tmp . '/compressed.zip', - 'target' => $this->tmp . '/zipextracted.txt' + 'target' => $this->tmp . '/zipextracted.txt', ] ); @@ -172,10 +188,10 @@ public function testZipCompressFile() $this->markTestSkipped('ZIP compression tests are currently disabled'); } - $filter = new ZipCompression( + $filter = new ZipCompression( [ 'archive' => $this->tmp . '/compressed.zip', - 'target' => $this->tmp . '/zipextracted.txt' + 'target' => $this->tmp . '/zipextracted.txt', ] ); file_put_contents($this->tmp . '/zipextracted.txt', 'compress me'); @@ -200,10 +216,10 @@ public function testCompressNonExistingTargetFile() $this->markTestSkipped('ZIP compression tests are currently disabled'); } - $filter = new ZipCompression( + $filter = new ZipCompression( [ 'archive' => $this->tmp . '/compressed.zip', - 'target' => $this->tmp + 'target' => $this->tmp, ] ); @@ -230,7 +246,7 @@ public function testZipCompressDirectory() $filter = new ZipCompression( [ 'archive' => $this->tmp . '/compressed.zip', - 'target' => $this->tmp . '/_compress' + 'target' => $this->tmp . '/_compress', ] ); $content = $filter->compress($this->tmp . '/Compress'); @@ -245,8 +261,8 @@ public function testZipCompressDirectory() $this->assertFileExists($base); $this->assertFileExists($base . 'zipextracted.txt'); $this->assertFileExists($base . 'First' . DIRECTORY_SEPARATOR . 'zipextracted.txt'); - $this->assertFileExists($base . 'First' . DIRECTORY_SEPARATOR . - 'Second' . DIRECTORY_SEPARATOR . 'zipextracted.txt'); + $this->assertFileExists($base . 'First' . DIRECTORY_SEPARATOR + . 'Second' . DIRECTORY_SEPARATOR . 'zipextracted.txt'); $content = file_get_contents($this->tmp . '/Compress/zipextracted.txt'); $this->assertEquals('compress me', $content); } @@ -268,10 +284,10 @@ public function testDecompressWillThrowExceptionWhenDecompressingWithNoTarget() $this->markTestSkipped('ZIP compression tests are currently disabled'); } - $filter = new ZipCompression( + $filter = new ZipCompression( [ 'archive' => $this->tmp . '/compressed.zip', - 'target' => $this->tmp . '/_compress' + 'target' => $this->tmp . '/_compress', ] ); @@ -281,7 +297,7 @@ public function testDecompressWillThrowExceptionWhenDecompressingWithNoTarget() $filter = new ZipCompression( [ 'archive' => $this->tmp . '/compressed.zip', - 'target' => $this->tmp . '/_compress' + 'target' => $this->tmp . '/_compress', ] ); $content = $filter->decompress($content); @@ -292,7 +308,6 @@ public function testDecompressWillThrowExceptionWhenDecompressingWithNoTarget() /** * @group 6026 - * * @covers \Laminas\Filter\Compress\Zip::decompress */ public function testDecompressWhenNoArchieveInClass() @@ -301,10 +316,10 @@ public function testDecompressWhenNoArchieveInClass() $this->markTestSkipped('ZIP compression tests are currently disabled'); } - $filter = new ZipCompression( + $filter = new ZipCompression( [ 'archive' => $this->tmp . '/compressed.zip', - 'target' => $this->tmp . '/_compress' + 'target' => $this->tmp . '/_compress', ] ); @@ -313,7 +328,7 @@ public function testDecompressWhenNoArchieveInClass() $filter = new ZipCompression( [ - 'target' => $this->tmp . '/_compress' + 'target' => $this->tmp . '/_compress', ] ); $content = $filter->decompress($content); diff --git a/test/CompressTest.php b/test/CompressTest.php index 33ac8639..ce66e4f6 100644 --- a/test/CompressTest.php +++ b/test/CompressTest.php @@ -1,10 +1,25 @@ markTestSkipped('This filter is tested with the bz2 extension'); + if (! extension_loaded('bz2') && ! extension_loaded('zlib')) { + $this->markTestSkipped('This filter requires bz2 of zlib extension'); } - $this->tmpDir = sprintf('%s/%s', sys_get_temp_dir(), uniqid('laminasilter')); + $this->tmpDir = sprintf('%s/%s', sys_get_temp_dir(), uniqid('laminasfilter')); mkdir($this->tmpDir, 0775, true); } public function tearDown(): void { if (is_dir($this->tmpDir)) { - if (file_exists($this->tmpDir . '/compressed.bz2')) { - unlink($this->tmpDir . '/compressed.bz2'); + foreach ($this->returnFilterType() as $parameters) { + if (file_exists($this->tmpDir . '/compressed.' . $parameters[0])) { + unlink($this->tmpDir . '/compressed.' . $parameters[0]); + } } rmdir($this->tmpDir); } } + public function returnFilterType(): iterable + { + if (extension_loaded('bz2')) { + yield ['bz2']; + } + if (extension_loaded('zlib')) { + yield ['gz']; + } + } + /** * Basic usage * + * @dataProvider returnFilterType * @return void */ - public function testBasicUsage() + public function testBasicUsage($filterType) { - $filter = new CompressFilter('bz2'); + $filter = new CompressFilter($filterType); - $text = 'compress me'; + $text = 'compress me'; $compressed = $filter($text); $this->assertNotEquals($text, $compressed); @@ -50,56 +78,58 @@ public function testBasicUsage() /** * Setting Options * + * @dataProvider returnFilterType * @return void */ - public function testGetSetAdapterOptionsInConstructor() + public function testGetSetAdapterOptionsInConstructor($filterType) { $filter = new CompressFilter([ - 'adapter' => 'bz2', + 'adapter' => $filterType, 'options' => [ - 'blocksize' => 6, - 'archive' => 'test.txt', - ] + 'archive' => 'test.txt', + ], ]); $this->assertEquals( - ['blocksize' => 6, 'archive' => 'test.txt'], + ['archive' => 'test.txt'], $filter->getAdapterOptions() ); $adapter = $filter->getAdapter(); - $this->assertEquals(6, $adapter->getBlocksize()); $this->assertEquals('test.txt', $adapter->getArchive()); } /** * Setting Options through constructor * + * @dataProvider returnFilterType * @return void */ - public function testGetSetAdapterOptions() + public function testGetSetAdapterOptions($filterType) { - $filter = new CompressFilter('bz2'); + $filter = new CompressFilter($filterType); $filter->setAdapterOptions([ - 'blocksize' => 6, - 'archive' => 'test.txt', + 'archive' => 'test.txt', ]); $this->assertEquals( - ['blocksize' => 6, 'archive' => 'test.txt'], + ['archive' => 'test.txt'], $filter->getAdapterOptions() ); $adapter = $filter->getAdapter(); - $this->assertEquals(6, $adapter->getBlocksize()); $this->assertEquals('test.txt', $adapter->getArchive()); } /** - * Setting Blocksize + * Setting Blocksize (works only for bz2) * * @return void */ public function testGetSetBlocksize() { + if (! extension_loaded('bz2')) { + $this->markTestSkipped('Extension bz2 is required for this test'); + } + $filter = new CompressFilter('bz2'); $this->assertEquals(4, $filter->getBlocksize()); $filter->setBlocksize(6); @@ -113,11 +143,12 @@ public function testGetSetBlocksize() /** * Setting Archive * + * @dataProvider returnFilterType * @return void */ - public function testGetSetArchive() + public function testGetSetArchive($filterType) { - $filter = new CompressFilter('bz2'); + $filter = new CompressFilter($filterType); $this->assertEquals(null, $filter->getArchive()); $filter->setArchive('Testfile.txt'); $this->assertEquals('Testfile.txt', $filter->getArchive()); @@ -127,22 +158,23 @@ public function testGetSetArchive() /** * Setting Archive * + * @dataProvider returnFilterType * @return void */ - public function testCompressToFile() + public function testCompressToFile($filterType) { - $filter = new CompressFilter('bz2'); - $archive = $this->tmpDir . '/compressed.bz2'; + $filter = new CompressFilter($filterType); + $archive = $this->tmpDir . '/compressed.' . $filterType; $filter->setArchive($archive); $content = $filter('compress me'); $this->assertTrue($content); - $filter2 = new CompressFilter('bz2'); + $filter2 = new CompressFilter($filterType); $content2 = $filter2->decompress($archive); $this->assertEquals('compress me', $content2); - $filter3 = new CompressFilter('bz2'); + $filter3 = new CompressFilter($filterType); $filter3->setArchive($archive); $content3 = $filter3->decompress(null); $this->assertEquals('compress me', $content3); @@ -151,25 +183,27 @@ public function testCompressToFile() /** * testing toString * + * @dataProvider returnFilterType * @return void */ - public function testToString() + public function testToString($filterType) { - $filter = new CompressFilter('bz2'); - $this->assertEquals('Bz2', $filter->toString()); + $filter = new CompressFilter($filterType); + $this->assertEqualsIgnoringCase($filterType, $filter->toString()); } /** * testing getAdapter * + * @dataProvider returnFilterType * @return void */ - public function testGetAdapter() + public function testGetAdapter($filterType) { - $filter = new CompressFilter('bz2'); + $filter = new CompressFilter($filterType); $adapter = $filter->getAdapter(); - $this->assertInstanceOf('Laminas\Filter\Compress\CompressionAlgorithmInterface', $adapter); - $this->assertEquals('Bz2', $filter->getAdapterName()); + $this->assertInstanceOf(CompressionAlgorithmInterface::class, $adapter); + $this->assertEqualsIgnoringCase($filterType, $filter->getAdapterName()); } /** @@ -186,8 +220,7 @@ public function testSetAdapter() $filter = new CompressFilter(); $this->assertEquals('Gz', $filter->getAdapterName()); - - $filter->setAdapter('\Laminas\Filter\Boolean'); + $filter->setAdapter(Boolean::class); $this->expectException(Exception\InvalidArgumentException::class); $this->expectExceptionMessage('does not implement'); @@ -197,18 +230,19 @@ public function testSetAdapter() /** * Decompress archiv * + * @dataProvider returnFilterType * @return void */ - public function testDecompressArchive() + public function testDecompressArchive($filterType) { - $filter = new CompressFilter('bz2'); - $archive = $this->tmpDir . '/compressed.bz2'; + $filter = new CompressFilter($filterType); + $archive = $this->tmpDir . '/compressed.' . $filterType; $filter->setArchive($archive); $content = $filter('compress me'); $this->assertTrue($content); - $filter2 = new CompressFilter('bz2'); + $filter2 = new CompressFilter($filterType); $content2 = $filter2->decompress($archive); $this->assertEquals('compress me', $content2); } @@ -227,25 +261,28 @@ public function testInvalidMethod() $filter->invalidMethod(); } - public function returnUnfilteredDataProvider() + public function returnUnfilteredDataProvider(): iterable { - return [ - [null], - [new \stdClass()], - [[ - 'compress me', - 'compress me too, please' - ]] - ]; + foreach ($this->returnFilterType() as $parameters) { + yield [$parameters[0], null]; + yield [$parameters[0], new stdClass()]; + yield [ + $parameters[0], + [ + 'compress me', + 'compress me too, please', + ], + ]; + } } /** * @dataProvider returnUnfilteredDataProvider * @return void */ - public function testReturnUnfiltered($input) + public function testReturnUnfiltered($filterType, $input) { - $filter = new CompressFilter('bz2'); + $filter = new CompressFilter($filterType); $this->assertEquals($input, $filter($input)); } diff --git a/test/DataUnitFormatterTest.php b/test/DataUnitFormatterTest.php index 2a52b8c1..5c3e5fd8 100644 --- a/test/DataUnitFormatterTest.php +++ b/test/DataUnitFormatterTest.php @@ -1,11 +1,15 @@ DataUnitFormatterFilter::MODE_DECIMAL, - 'unit' => 'B' + 'unit' => 'B', ]); $this->assertEquals($expected, $filter->filter($value)); } @@ -31,7 +35,7 @@ public function testBinaryBytes($value, $expected) { $filter = new DataUnitFormatterFilter([ 'mode' => DataUnitFormatterFilter::MODE_BINARY, - 'unit' => 'B' + 'unit' => 'B', ]); $this->assertEquals($expected, $filter->filter($value)); } @@ -39,7 +43,7 @@ public function testBinaryBytes($value, $expected) public function testPrecision() { $filter = new DataUnitFormatterFilter([ - 'unit' => 'B', + 'unit' => 'B', 'precision' => 3, ]); @@ -49,7 +53,7 @@ public function testPrecision() public function testCustomPrefixes() { $filter = new DataUnitFormatterFilter([ - 'unit' => 'B', + 'unit' => 'B', 'prefixes' => ['', 'kilos'], ]); @@ -91,7 +95,7 @@ public static function decimalBytesTestProvider() [pow(1000, 6), '1.00 EB'], [pow(1000, 7), '1.00 ZB'], [pow(1000, 8), '1.00 YB'], - [pow(1000, 9), (pow(1000, 9) . ' B')], + [pow(1000, 9), pow(1000, 9) . ' B'], ]; } @@ -109,7 +113,7 @@ public static function binaryBytesTestProvider() [pow(1024, 6), '1.00 EiB'], [pow(1024, 7), '1.00 ZiB'], [pow(1024, 8), '1.00 YiB'], - [pow(1024, 9), (pow(1024, 9) . ' B')], + [pow(1024, 9), pow(1024, 9) . ' B'], ]; } } diff --git a/test/DateSelectTest.php b/test/DateSelectTest.php index 92dd5f97..c27df08c 100644 --- a/test/DateSelectTest.php +++ b/test/DateSelectTest.php @@ -1,17 +1,20 @@ expectException(\Laminas\Filter\Exception\RuntimeException::class); + $this->expectException(RuntimeException::class); $sut = new DateSelectFilter(); $sut->filter(['year' => '2120', 'month' => '07']); } diff --git a/test/DateTimeFormatterTest.php b/test/DateTimeFormatterTest.php index 8ef44ce4..43604e87 100644 --- a/test/DateTimeFormatterTest.php +++ b/test/DateTimeFormatterTest.php @@ -1,11 +1,17 @@ '2014', 'month' => '10', 'day' => '26', 'hour' => '12', 'minute' => '35'], - '2014-10-26 12:35:00' + '2014-10-26 12:35:00', ], [ ['nullOnEmpty' => true], ['year' => null, 'month' => '10', 'day' => '26', 'hour' => '12', 'minute' => '35'], - null + null, ], [ ['null_on_empty' => true], ['year' => null, 'month' => '10', 'day' => '26', 'hour' => '12', 'minute' => '35'], - null + null, ], [ ['nullOnAllEmpty' => true], ['year' => null, 'month' => null, 'day' => null, 'hour' => null, 'minute' => null], - null + null, ], [ ['null_on_all_empty' => true], ['year' => null, 'month' => null, 'day' => null, 'hour' => null, 'minute' => null], - null + null, ], ]; } public function testInvalidInput() { - $this->expectException(\Laminas\Filter\Exception\RuntimeException::class); + $this->expectException(RuntimeException::class); $sut = new DateTimeSelectFilter(); $sut->filter(['year' => '2120', 'month' => '10', 'day' => '26', 'hour' => '12']); } diff --git a/test/DecompressTest.php b/test/DecompressTest.php index a631b1fb..2773bfca 100644 --- a/test/DecompressTest.php +++ b/test/DecompressTest.php @@ -1,9 +1,22 @@ tmpDir)) { - if (file_exists($this->tmpDir . '/compressed.bz2')) { - unlink($this->tmpDir . '/compressed.bz2'); + foreach ($this->returnFilterType() as $parameters) { + if (file_exists($this->tmpDir . '/compressed.' . $parameters[0])) { + unlink($this->tmpDir . '/compressed.' . $parameters[0]); + } } rmdir($this->tmpDir); } } + public function returnFilterType(): iterable + { + if (extension_loaded('bz2')) { + yield ['bz2']; + } + if (extension_loaded('zlib')) { + yield ['gz']; + } + } + /** * Basic usage * + * @dataProvider returnFilterType * @return void */ - public function testBasicUsage() + public function testBasicUsage($filterType) { - $filter = new DecompressFilter('bz2'); + $filter = new DecompressFilter($filterType); $text = 'compress me'; $compressed = $filter->compress($text); @@ -49,22 +75,23 @@ public function testBasicUsage() /** * Setting Archive * + * @dataProvider returnFilterType * @return void */ - public function testCompressToFile() + public function testCompressToFile($filterType) { - $filter = new DecompressFilter('bz2'); - $archive = $this->tmpDir . '/compressed.bz2'; + $filter = new DecompressFilter($filterType); + $archive = $this->tmpDir . '/compressed.' . $filterType; $filter->setArchive($archive); $content = $filter->compress('compress me'); $this->assertTrue($content); - $filter2 = new DecompressFilter('bz2'); + $filter2 = new DecompressFilter($filterType); $content2 = $filter2($archive); $this->assertEquals('compress me', $content2); - $filter3 = new DecompressFilter('bz2'); + $filter3 = new DecompressFilter($filterType); $filter3->setArchive($archive); $content3 = $filter3(null); $this->assertEquals('compress me', $content3); @@ -73,55 +100,61 @@ public function testCompressToFile() /** * Basic usage * + * @dataProvider returnFilterType * @return void */ - public function testDecompressArchive() + public function testDecompressArchive($filterType) { - $filter = new DecompressFilter('bz2'); - $archive = $this->tmpDir . '/compressed.bz2'; + $filter = new DecompressFilter($filterType); + $archive = $this->tmpDir . '/compressed.' . $filterType; $filter->setArchive($archive); $content = $filter->compress('compress me'); $this->assertTrue($content); - $filter2 = new DecompressFilter('bz2'); + $filter2 = new DecompressFilter($filterType); $content2 = $filter2($archive); $this->assertEquals('compress me', $content2); } - public function testFilterMethodProxiesToDecompress() + /** + * @dataProvider returnFilterType + */ + public function testFilterMethodProxiesToDecompress($filterType) { - $filter = new DecompressFilter('bz2'); - $archive = $this->tmpDir . '/compressed.bz2'; + $filter = new DecompressFilter($filterType); + $archive = $this->tmpDir . '/compressed.' . $filterType; $filter->setArchive($archive); $content = $filter->compress('compress me'); $this->assertTrue($content); - $filter2 = new DecompressFilter('bz2'); + $filter2 = new DecompressFilter($filterType); $content2 = $filter2->filter($archive); $this->assertEquals('compress me', $content2); } - public function returnUnfilteredDataProvider() + public function returnUnfilteredDataProvider(): iterable { - return [ - [null], - [new \stdClass()], - [[ - 'decompress me', - 'decompress me too, please' - ]] - ]; + foreach ($this->returnFilterType() as $parameter) { + yield [$parameter[0], new stdClass()]; + yield [ + $parameter[0], + [ + 'decompress me', + 'decompress me too, please', + ], + ]; + } } /** * @dataProvider returnUnfilteredDataProvider * @return void */ - public function testReturnUnfiltered($input) + public function testReturnUnfiltered($filterType, $input) { - $filter = new DecompressFilter('bz2'); + $filter = new DecompressFilter($filterType); $this->assertEquals($input, $filter($input)); } diff --git a/test/DecryptTest.php b/test/DecryptTest.php index c4bea249..5587b054 100644 --- a/test/DecryptTest.php +++ b/test/DecryptTest.php @@ -1,10 +1,16 @@ 'BlockCipher']); + $filter = new DecryptFilter(['adapter' => 'BlockCipher']); $valuesExpected = [ 'STRING' => 'STRING', 'ABC1@3' => 'ABC1@3', - 'A b C' => 'A B C' + 'A b C' => 'A B C', ]; $enc = $filter->getEncryption(); @@ -71,8 +77,9 @@ public function testBasicOpenssl() $key = $filter->getPrivateKey(); $this->assertEquals( - [__DIR__ . '/_files/privatekey.pem' => - '-----BEGIN RSA PRIVATE KEY----- + [ + __DIR__ . '/_files/privatekey.pem' + => '-----BEGIN RSA PRIVATE KEY----- MIICXgIBAAKBgQDKTIp7FntJt1BioBZ0lmWBE8CyzngeGCHNMcAC4JLbi1Y0LwT4 CSaQarbvAqBRmc+joHX+rcURm89wOibRaThrrZcvgl2pomzu7shJc0ObiRZC8H7p xTkZ1HHjN8cRSQlOHkcdtE9yoiSGSO+zZ9K5ReU1DOsFFDD4V7XpcNU63QIDAQAB @@ -87,7 +94,8 @@ public function testBasicOpenssl() cAkcoMuBcgWhIn/46C1PAkEAzLK/ibrdMQLOdO4SuDgj/2nc53NZ3agl61ew8Os6 d/fxzPfuO/bLpADozTAnYT9Hu3wPrQVLeAfCp0ojqH7DYg== -----END RSA PRIVATE KEY----- -'], +', + ], $key ); } @@ -104,15 +112,15 @@ public function testSettingAdapterManually() $filter = new DecryptFilter(); $filter->setAdapter('Openssl'); $this->assertEquals('Openssl', $filter->getAdapter()); - $this->assertInstanceOf('Laminas\Filter\Encrypt\EncryptionAlgorithmInterface', $filter->getAdapterInstance()); + $this->assertInstanceOf(EncryptionAlgorithmInterface::class, $filter->getAdapterInstance()); $filter->setAdapter('BlockCipher'); $this->assertEquals('BlockCipher', $filter->getAdapter()); - $this->assertInstanceOf('Laminas\Filter\Encrypt\EncryptionAlgorithmInterface', $filter->getAdapterInstance()); + $this->assertInstanceOf(EncryptionAlgorithmInterface::class, $filter->getAdapterInstance()); $this->expectException(Exception\InvalidArgumentException::class); $this->expectExceptionMessage('does not implement'); - $filter->setAdapter('\stdClass'); + $filter->setAdapter(stdClass::class); } /** @@ -130,7 +138,7 @@ public function returnUnfilteredDataProvider() { return [ [null], - [new \stdClass()], + [new stdClass()], // @codingStandardsIgnoreStart [[ 'ec133eb7460682b0020b736ad6d2ef14c35de0f1e5976330ae1dd096ef3b4cb7MTIzNDU2Nzg5MDEyMzQ1NoZvxY1JkeL6TnQP3ug5F0k=', diff --git a/test/DenyListTest.php b/test/DenyListTest.php index 4b6fbc4b..73e288de 100644 --- a/test/DenyListTest.php +++ b/test/DenyListTest.php @@ -1,5 +1,7 @@ ['test', 1], - 'strict' => true, + 'list' => ['test', 1], + 'strict' => true, ]); $this->assertEquals(true, $filter->getStrict()); @@ -33,7 +39,7 @@ public function testConstructorDefaults(): void public function testWithPluginManager(): void { $pluginManager = new FilterPluginManager(new ServiceManager()); - $filter = $pluginManager->get('DenyList'); + $filter = $pluginManager->get('DenyList'); $this->assertInstanceOf(DenyListFilter::class, $filter); } @@ -48,8 +54,8 @@ public function testNullListShouldThrowException(): void public function testTraversableConvertsToArray(): void { - $array = ['test', 1]; - $obj = new ArrayObject(['test', 1]); + $array = ['test', 1]; + $obj = new ArrayObject(['test', 1]); $filter = new DenyListFilter([ 'list' => $obj, ]); @@ -59,7 +65,7 @@ public function testTraversableConvertsToArray(): void public function testSetStrictShouldCastToBoolean(): void { $filter = new DenyListFilter([ - 'strict' => 1 + 'strict' => 1, ]); $this->assertSame(true, $filter->getStrict()); } @@ -85,9 +91,8 @@ public function testList(bool $strict, array $list, array $testData): void 'list' => $list, ]); foreach ($testData as $data) { - /** @var mixed */ [$value, $expected] = $data; - $message = sprintf( + $message = sprintf( '%s (%s) is not filtered as %s; type = %s, strict = %b', var_export($value, true), gettype($value), @@ -105,7 +110,7 @@ public static function defaultTestProvider(): array ['test', 'test'], [0, 0], [0.1, 0.1], - [[], []], + [[], []], [null, null], ]; } @@ -122,7 +127,7 @@ public static function listTestProvider(): array [null, null], [false, false], [0.0, 0.0], - [[], []], + [[], []], ], ], [ @@ -135,7 +140,7 @@ public static function listTestProvider(): array [false, null], [0.0, null], [0.1, 0.1], - [[], []], + [[], []], ], ], ]; diff --git a/test/DigitsTest.php b/test/DigitsTest.php index cffa6ef6..363abff1 100644 --- a/test/DigitsTest.php +++ b/test/DigitsTest.php @@ -1,9 +1,15 @@ '123', - 'C 4.5B 6' => '456', + 'C 4.5B 6' => '456', '9壱8@7.6,5#4' => '987654', - '789' => '789' - ]; + '789' => '789', + ]; } else { // POSIX named classes are not supported, use alternative 0-9 match // Or filter for the value without mbstring @@ -62,8 +66,8 @@ public function testBasic() 'abcxyz' => '', 'AZ@#4.3' => '43', '1.23' => '123', - '0x9f' => '09' - ]; + '0x9f' => '09', + ]; } foreach ($valuesExpected as $input => $output) { @@ -79,11 +83,13 @@ public function returnUnfilteredDataProvider() { return [ [null], - [new \stdClass()], - [[ - 'abc123', - 'abc 123' - ]], + [new stdClass()], + [ + [ + 'abc123', + 'abc 123', + ], + ], [true], [false], ]; diff --git a/test/DirTest.php b/test/DirTest.php index bb28e734..5a2245f4 100644 --- a/test/DirTest.php +++ b/test/DirTest.php @@ -1,9 +1,12 @@ '.', '/path/to/filename' => '/path/to', - '/path/to/filename.ext' => '/path/to' - ]; + '/path/to/filename.ext' => '/path/to', + ]; foreach ($valuesExpected as $input => $output) { $this->assertEquals($output, $filter($input)); } @@ -29,11 +32,13 @@ public function returnUnfilteredDataProvider() { return [ [null], - [new \stdClass()], - [[ - '/path/to/filename', - '/path/to/filename.ext' - ]] + [new stdClass()], + [ + [ + '/path/to/filename', + '/path/to/filename.ext', + ], + ], ]; } diff --git a/test/Encrypt/BlockCipherTest.php b/test/Encrypt/BlockCipherTest.php index 45ba3361..9b763bbc 100644 --- a/test/Encrypt/BlockCipherTest.php +++ b/test/Encrypt/BlockCipherTest.php @@ -1,11 +1,17 @@ 'testkey']); $filter->setVector('testvect'); } + /** * Ensures that the filter allows default encryption * @@ -66,11 +73,13 @@ public function testDefaultEncryption() $filter = new BlockCipherEncryption(['key' => 'testkey']); $filter->setVector('1234567890123456'); $this->assertEquals( - ['key' => 'testkey', - 'algorithm' => 'aes', - 'vector' => '1234567890123456', - 'key_iteration' => 5000, - 'hash' => 'sha256'], + [ + 'key' => 'testkey', + 'algorithm' => 'aes', + 'vector' => '1234567890123456', + 'key_iteration' => 5000, + 'hash' => 'sha256', + ], $filter->getEncryption() ); } @@ -88,11 +97,13 @@ public function testGetSetEncryption() ['algorithm' => 'blowfish'] ); $this->assertEquals( - ['key' => 'testkey', - 'algorithm' => 'blowfish', - 'vector' => '1234567890123456', - 'key_iteration' => 5000, - 'hash' => 'sha256'], + [ + 'key' => 'testkey', + 'algorithm' => 'blowfish', + 'vector' => '1234567890123456', + 'key_iteration' => 5000, + 'hash' => 'sha256', + ], $filter->getEncryption() ); } @@ -120,7 +131,7 @@ public function testEncryptionWithDecryption() public function testConstructionWithStringKey() { $filter = new BlockCipherEncryption('testkey'); - $data = $filter->getEncryption(); + $data = $filter->getEncryption(); $this->assertEquals('testkey', $data['key']); } @@ -156,20 +167,20 @@ public function testSettingEncryptionOptions() try { $filter->setEncryption(1234); $filter->fail(); - } catch (\Laminas\Filter\Exception\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $this->assertStringContainsString('Invalid options argument', $e->getMessage()); } try { $filter->setEncryption(['algorithm' => 'unknown']); $filter->fail(); - } catch (\Laminas\Filter\Exception\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $this->assertStringContainsString('The algorithm', $e->getMessage()); } try { $filter->setEncryption(['mode' => 'unknown']); - } catch (\Laminas\Filter\Exception\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { $this->assertStringContainsString('The mode', $e->getMessage()); } } diff --git a/test/Encrypt/OpensslTest.php b/test/Encrypt/OpensslTest.php index 65c0e5b4..461adcd1 100644 --- a/test/Encrypt/OpensslTest.php +++ b/test/Encrypt/OpensslTest.php @@ -1,12 +1,20 @@ 'STRING', 'ABC1@3' => 'ABC1@3', - 'A b C' => 'A B C' + 'A b C' => 'A B C', ]; $key = $filter->getPublicKey(); $this->assertEquals( - [__DIR__ . '/../_files/publickey.pem' => - '-----BEGIN CERTIFICATE----- + [ + __DIR__ . '/../_files/publickey.pem' + => '-----BEGIN CERTIFICATE----- MIIC3jCCAkegAwIBAgIBADANBgkqhkiG9w0BAQQFADCBtDELMAkGA1UEBhMCTkwx FjAUBgNVBAgTDU5vb3JkLUhvbGxhbmQxEDAOBgNVBAcTB1phYW5kYW0xFzAVBgNV BAoTDk1vYmlsZWZpc2guY29tMR8wHQYDVQQLExZDZXJ0aWZpY2F0aW9uIFNlcnZp @@ -51,7 +60,8 @@ public function testBasicOpenssl() 5jYy6v3b+zwEvY82EUieMldovdnpsS1EScjjvPfQ1lSgcTHT2QX5MjNv13xLnOgh PIDs9E7uuizAKDhRRRvho8BS -----END CERTIFICATE----- -'], +', + ], $key ); foreach ($valuesExpected as $input => $output) { @@ -72,7 +82,7 @@ public function testEncryptionWithDecryptionOpenssl() $filter = new OpensslEncryption(); $filter->setPublicKey(__DIR__ . '/../_files/publickey.pem'); - $output = $filter->encrypt('teststring'); + $output = $filter->encrypt('teststring'); $envelopekeys = $filter->getEnvelopeKey(); $this->assertNotEquals('teststring', $output); @@ -101,7 +111,7 @@ public function testEncryptionWithDecryptionSingleOptionOpenssl() $filter = new OpensslEncryption(); $filter->setPublicKey(__DIR__ . '/../_files/publickey.pem'); - $output = $filter->encrypt('teststring'); + $output = $filter->encrypt('teststring'); $envelopekeys = $filter->getEnvelopeKey(); $this->assertNotEquals('teststring', $output); @@ -157,8 +167,8 @@ public function testSetPrivateKey() cAkcoMuBcgWhIn/46C1PAkEAzLK/ibrdMQLOdO4SuDgj/2nc53NZ3agl61ew8Os6 d/fxzPfuO/bLpADozTAnYT9Hu3wPrQVLeAfCp0ojqH7DYg== -----END RSA PRIVATE KEY----- -'], $test); - +', + ], $test); $this->expectException(Exception\InvalidArgumentException::class); $this->expectExceptionMessage('not valid'); @@ -183,7 +193,7 @@ public function testInvalidDecryption() try { $filter->decrypt('unknown'); $this->fail(); - } catch (\Laminas\Filter\Exception\RuntimeException $e) { + } catch (RuntimeException $e) { $this->assertStringContainsString('Please give a private key', $e->getMessage()); } @@ -191,7 +201,7 @@ public function testInvalidDecryption() try { $filter->decrypt('unknown'); $this->fail(); - } catch (\Laminas\Filter\Exception\RuntimeException $e) { + } catch (RuntimeException $e) { $this->assertStringContainsString('Please give an envelope key', $e->getMessage()); } @@ -199,7 +209,7 @@ public function testInvalidDecryption() try { $filter->decrypt('unknown'); $this->fail(); - } catch (\Laminas\Filter\Exception\RuntimeException $e) { + } catch (RuntimeException $e) { $this->assertStringContainsString('was not able to decrypt', $e->getMessage()); } } @@ -222,11 +232,12 @@ public function testEncryptionWithoutPublicKey() public function testMultipleOptionsAtInitiation() { $passphrase = 'test'; - $filter = new OpensslEncryption([ - 'public' => __DIR__ . '/../_files/publickey_pass.pem', + $filter = new OpensslEncryption([ + 'public' => __DIR__ . '/../_files/publickey_pass.pem', 'passphrase' => $passphrase, - 'private' => __DIR__ . '/../_files/privatekey_pass.pem']); - $public = $filter->getPublicKey(); + 'private' => __DIR__ . '/../_files/privatekey_pass.pem', + ]); + $public = $filter->getPublicKey(); $this->assertNotEmpty($public); $this->assertEquals($passphrase, $filter->getPassphrase()); } diff --git a/test/EncryptTest.php b/test/EncryptTest.php index 9f619b4b..d48ec926 100644 --- a/test/EncryptTest.php +++ b/test/EncryptTest.php @@ -1,10 +1,16 @@ 'BlockCipher', 'key' => 'testkey']); + $filter = new EncryptFilter(['adapter' => 'BlockCipher', 'key' => 'testkey']); $valuesExpected = [ 'STRING' => 'STRING', 'ABC1@3' => 'ABC1@3', @@ -65,18 +71,19 @@ public function testBasicOpenssl() $this->markTestSkipped('Openssl extension not installed'); } - $filter = new EncryptFilter(['adapter' => 'Openssl']); + $filter = new EncryptFilter(['adapter' => 'Openssl']); $valuesExpected = [ 'STRING' => 'STRING', 'ABC1@3' => 'ABC1@3', - 'A b C' => 'A B C' + 'A b C' => 'A B C', ]; $filter->setPublicKey(__DIR__ . '/_files/publickey.pem'); $key = $filter->getPublicKey(); $this->assertEquals( - [__DIR__ . '/_files/publickey.pem' => - '-----BEGIN CERTIFICATE----- + [ + __DIR__ . '/_files/publickey.pem' + => '-----BEGIN CERTIFICATE----- MIIC3jCCAkegAwIBAgIBADANBgkqhkiG9w0BAQQFADCBtDELMAkGA1UEBhMCTkwx FjAUBgNVBAgTDU5vb3JkLUhvbGxhbmQxEDAOBgNVBAcTB1phYW5kYW0xFzAVBgNV BAoTDk1vYmlsZWZpc2guY29tMR8wHQYDVQQLExZDZXJ0aWZpY2F0aW9uIFNlcnZp @@ -94,7 +101,8 @@ public function testBasicOpenssl() 5jYy6v3b+zwEvY82EUieMldovdnpsS1EScjjvPfQ1lSgcTHT2QX5MjNv13xLnOgh PIDs9E7uuizAKDhRRRvho8BS -----END CERTIFICATE----- -'], +', + ], $key ); foreach ($valuesExpected as $input => $output) { @@ -114,15 +122,15 @@ public function testSettingAdapterManually() $filter = new EncryptFilter(); $filter->setAdapter('Openssl'); $this->assertEquals('Openssl', $filter->getAdapter()); - $this->assertInstanceOf('Laminas\Filter\Encrypt\EncryptionAlgorithmInterface', $filter->getAdapterInstance()); + $this->assertInstanceOf(EncryptionAlgorithmInterface::class, $filter->getAdapterInstance()); $filter->setAdapter('BlockCipher'); $this->assertEquals('BlockCipher', $filter->getAdapter()); - $this->assertInstanceOf('Laminas\Filter\Encrypt\EncryptionAlgorithmInterface', $filter->getAdapterInstance()); + $this->assertInstanceOf(EncryptionAlgorithmInterface::class, $filter->getAdapterInstance()); $this->expectException(Exception\InvalidArgumentException::class); $this->expectExceptionMessage('does not implement'); - $filter->setAdapter('\stdClass'); + $filter->setAdapter(stdClass::class); } /** @@ -140,11 +148,13 @@ public function returnUnfilteredDataProvider() { return [ [null], - [new \stdClass()], - [[ - 'encrypt me', - 'encrypt me too, please' - ]] + [new stdClass()], + [ + [ + 'encrypt me', + 'encrypt me too, please', + ], + ], ]; } diff --git a/test/File/DecryptTest.php b/test/File/DecryptTest.php index 2734a7f0..041d0192 100644 --- a/test/File/DecryptTest.php +++ b/test/File/DecryptTest.php @@ -1,11 +1,27 @@ tmpDir . '/nofile.txt', - $this->tmpDir . '/nofile2.txt' - ]] + [new stdClass()], + [ + [ + $this->tmpDir . '/nofile.txt', + $this->tmpDir . '/nofile2.txt', + ], + ], ]; } diff --git a/test/File/EncryptTest.php b/test/File/EncryptTest.php index 2ccd3b71..49a64f85 100644 --- a/test/File/EncryptTest.php +++ b/test/File/EncryptTest.php @@ -1,16 +1,25 @@ fileToEncrypt = dirname(__DIR__) . '/_files/encryption.txt'; - $this->testDir = sys_get_temp_dir(); - $this->testFile = sprintf('%s/%s.txt', sys_get_temp_dir(), uniqid('laminasilter')); + $this->testDir = sys_get_temp_dir(); + $this->testFile = sprintf('%s/%s.txt', sys_get_temp_dir(), uniqid('laminasilter')); } public function tearDown(): void @@ -74,7 +83,6 @@ public function testEncryptionWithDecryption() } /** - * * @return void */ public function testNonExistingFile() @@ -88,7 +96,6 @@ public function testNonExistingFile() } /** - * * @return void */ public function testEncryptionInSameFile() @@ -106,11 +113,13 @@ public function returnUnfilteredDataProvider() { return [ [null], - [new \stdClass()], - [[ - sprintf('%s/%s.txt', sys_get_temp_dir(), uniqid()), - sprintf('%s/%s.txt', sys_get_temp_dir(), uniqid()), - ]] + [new stdClass()], + [ + [ + sprintf('%s/%s.txt', sys_get_temp_dir(), uniqid()), + sprintf('%s/%s.txt', sys_get_temp_dir(), uniqid()), + ], + ], ]; } diff --git a/test/File/LowerCaseTest.php b/test/File/LowerCaseTest.php index d2196ef2..eb0b3cd9 100644 --- a/test/File/LowerCaseTest.php +++ b/test/File/LowerCaseTest.php @@ -1,10 +1,23 @@ testDir = sys_get_temp_dir(); + $source = dirname(__DIR__) . '/_files/testfile2.txt'; + $this->testDir = sys_get_temp_dir(); $this->testFile = sprintf('%s/%s.txt', $this->testDir, uniqid('laminasilter')); copy($source, $this->testFile); } /** * Sets the path to test files - * - * @return void */ public function tearDown(): void { @@ -85,7 +94,7 @@ public function testCheckSettingOfEncodingInIstance() $filter = new FileLowerCase('ISO-8859-1'); $filter($this->testFile); $this->assertStringContainsString('this is a file', file_get_contents($this->testFile)); - } catch (\Laminas\Filter\Exception\ExtensionNotLoadedException $e) { + } catch (ExtensionNotLoadedException $e) { $this->assertStringContainsString('mbstring is required', $e->getMessage()); } } @@ -101,7 +110,7 @@ public function testCheckSettingOfEncodingWithMethod() $filter->setEncoding('ISO-8859-1'); $filter($this->testFile); $this->assertStringContainsString('this is a file', file_get_contents($this->testFile)); - } catch (\Laminas\Filter\Exception\ExtensionNotLoadedException $e) { + } catch (ExtensionNotLoadedException $e) { $this->assertStringContainsString('mbstring is required', $e->getMessage()); } } @@ -110,11 +119,13 @@ public function returnUnfilteredDataProvider() { return [ [null], - [new \stdClass()], - [[ - sprintf('%s/%s.txt', $this->testDir, uniqid()), - sprintf('%s/%s.txt', $this->testDir, uniqid()), - ]] + [new stdClass()], + [ + [ + sprintf('%s/%s.txt', $this->testDir, uniqid()), + sprintf('%s/%s.txt', $this->testDir, uniqid()), + ], + ], ]; } diff --git a/test/File/RenameTest.php b/test/File/RenameTest.php index 8fbad361..22449a88 100644 --- a/test/File/RenameTest.php +++ b/test/File/RenameTest.php @@ -1,10 +1,27 @@ tmpPath = sprintf('%s%s%s', sys_get_temp_dir(), DIRECTORY_SEPARATOR, uniqid('laminasilter')); mkdir($this->tmpPath, 0775, true); - $this->oldFile = sprintf('%s%stestfile.txt', $this->tmpPath, DIRECTORY_SEPARATOR); - $this->origFile = sprintf('%s%soriginal.file', $this->tmpPath, DIRECTORY_SEPARATOR); - $this->newFile = sprintf('%s%snewfile.xml', $this->tmpPath, DIRECTORY_SEPARATOR); - $this->newDir = sprintf('%s%stestdir', $this->tmpPath, DIRECTORY_SEPARATOR); + $this->oldFile = sprintf('%s%stestfile.txt', $this->tmpPath, DIRECTORY_SEPARATOR); + $this->origFile = sprintf('%s%soriginal.file', $this->tmpPath, DIRECTORY_SEPARATOR); + $this->newFile = sprintf('%s%snewfile.xml', $this->tmpPath, DIRECTORY_SEPARATOR); + $this->newDir = sprintf('%s%stestdir', $this->tmpPath, DIRECTORY_SEPARATOR); $this->newDirFile = sprintf('%s%stestfile.txt', $this->newDir, DIRECTORY_SEPARATOR); copy($control, $this->oldFile); @@ -74,8 +89,6 @@ public function setUp(): void /** * Sets the path to test files - * - * @return void */ public function tearDown(): void { @@ -109,12 +122,14 @@ public function testConstructSingleValue() $filter = new FileRename($this->newFile); $this->assertEquals( - [0 => [ - 'source' => '*', - 'target' => $this->newFile, - 'overwrite' => false, - 'randomize' => false, - ]], + [ + 0 => [ + 'source' => '*', + 'target' => $this->newFile, + 'overwrite' => false, + 'randomize' => false, + ], + ], $filter->getFile() ); $this->assertEquals($this->newFile, $filter($this->oldFile)); @@ -131,12 +146,14 @@ public function testConstructSingleValueWithFilesArray() $filter = new FileRename($this->newFile); $this->assertEquals( - [0 => [ - 'source' => '*', - 'target' => $this->newFile, - 'overwrite' => false, - 'randomize' => false, - ]], + [ + 0 => [ + 'source' => '*', + 'target' => $this->newFile, + 'overwrite' => false, + 'randomize' => false, + ], + ], $filter->getFile() ); $this->assertEquals( @@ -155,15 +172,18 @@ public function testConstructSingleArray() { $filter = new FileRename([ 'source' => $this->oldFile, - 'target' => $this->newFile]); + 'target' => $this->newFile, + ]); $this->assertEquals( - [0 => [ - 'source' => $this->oldFile, - 'target' => $this->newFile, - 'overwrite' => false, - 'randomize' => false, - ]], + [ + 0 => [ + 'source' => $this->oldFile, + 'target' => $this->newFile, + 'overwrite' => false, + 'randomize' => false, + ], + ], $filter->getFile() ); $this->assertEquals($this->newFile, $filter($this->oldFile)); @@ -178,20 +198,22 @@ public function testConstructSingleArray() public function testConstructFullOptionsArray() { $filter = new FileRename([ - 'source' => $this->oldFile, - 'target' => $this->newFile, + 'source' => $this->oldFile, + 'target' => $this->newFile, 'overwrite' => true, 'randomize' => false, - 'unknown' => false + 'unknown' => false, ]); $this->assertEquals( - [0 => [ - 'source' => $this->oldFile, - 'target' => $this->newFile, - 'overwrite' => true, - 'randomize' => false, - ]], + [ + 0 => [ + 'source' => $this->oldFile, + 'target' => $this->newFile, + 'overwrite' => true, + 'randomize' => false, + ], + ], $filter->getFile() ); $this->assertEquals($this->newFile, $filter($this->oldFile)); @@ -208,15 +230,19 @@ public function testConstructDoubleArray() $filter = new FileRename([ 0 => [ 'source' => $this->oldFile, - 'target' => $this->newFile]]); + 'target' => $this->newFile, + ], + ]); $this->assertEquals( - [0 => [ - 'source' => $this->oldFile, - 'target' => $this->newFile, - 'overwrite' => false, - 'randomize' => false, - ]], + [ + 0 => [ + 'source' => $this->oldFile, + 'target' => $this->newFile, + 'overwrite' => false, + 'randomize' => false, + ], + ], $filter->getFile() ); $this->assertEquals($this->newFile, $filter($this->oldFile)); @@ -231,15 +257,18 @@ public function testConstructDoubleArray() public function testConstructTruncatedTarget() { $filter = new FileRename([ - 'source' => $this->oldFile]); + 'source' => $this->oldFile, + ]); $this->assertEquals( - [0 => [ - 'source' => $this->oldFile, - 'target' => '*', - 'overwrite' => false, - 'randomize' => false, - ]], + [ + 0 => [ + 'source' => $this->oldFile, + 'target' => '*', + 'overwrite' => false, + 'randomize' => false, + ], + ], $filter->getFile() ); $this->assertEquals($this->oldFile, $filter($this->oldFile)); @@ -254,15 +283,18 @@ public function testConstructTruncatedTarget() public function testConstructTruncatedSource() { $filter = new FileRename([ - 'target' => $this->newFile]); + 'target' => $this->newFile, + ]); $this->assertEquals( - [0 => [ - 'source' => '*', - 'target' => $this->newFile, - 'overwrite' => false, - 'randomize' => false, - ]], + [ + 0 => [ + 'source' => '*', + 'target' => $this->newFile, + 'overwrite' => false, + 'randomize' => false, + ], + ], $filter->getFile() ); $this->assertEquals($this->newFile, $filter($this->oldFile)); @@ -279,12 +311,14 @@ public function testConstructSingleDirectory() $filter = new FileRename($this->newDir); $this->assertEquals( - [0 => [ - 'source' => '*', - 'target' => $this->newDir, - 'overwrite' => false, - 'randomize' => false, - ]], + [ + 0 => [ + 'source' => '*', + 'target' => $this->newDir, + 'overwrite' => false, + 'randomize' => false, + ], + ], $filter->getFile() ); $this->assertEquals($this->newDirFile, $filter($this->oldFile)); @@ -300,15 +334,18 @@ public function testConstructSingleArrayDirectory() { $filter = new FileRename([ 'source' => $this->oldFile, - 'target' => $this->newDir]); + 'target' => $this->newDir, + ]); $this->assertEquals( - [0 => [ - 'source' => $this->oldFile, - 'target' => $this->newDir, - 'overwrite' => false, - 'randomize' => false, - ]], + [ + 0 => [ + 'source' => $this->oldFile, + 'target' => $this->newDir, + 'overwrite' => false, + 'randomize' => false, + ], + ], $filter->getFile() ); $this->assertEquals($this->newDirFile, $filter($this->oldFile)); @@ -325,15 +362,19 @@ public function testConstructDoubleArrayDirectory() $filter = new FileRename([ 0 => [ 'source' => $this->oldFile, - 'target' => $this->newDir]]); + 'target' => $this->newDir, + ], + ]); $this->assertEquals( - [0 => [ - 'source' => $this->oldFile, - 'target' => $this->newDir, - 'overwrite' => false, - 'randomize' => false, - ]], + [ + 0 => [ + 'source' => $this->oldFile, + 'target' => $this->newDir, + 'overwrite' => false, + 'randomize' => false, + ], + ], $filter->getFile() ); $this->assertEquals($this->newDirFile, $filter($this->oldFile)); @@ -348,15 +389,18 @@ public function testConstructDoubleArrayDirectory() public function testConstructTruncatedSourceDirectory() { $filter = new FileRename([ - 'target' => $this->newDir]); + 'target' => $this->newDir, + ]); $this->assertEquals( - [0 => [ - 'source' => '*', - 'target' => $this->newDir, - 'overwrite' => false, - 'randomize' => false, - ]], + [ + 0 => [ + 'source' => '*', + 'target' => $this->newDir, + 'overwrite' => false, + 'randomize' => false, + ], + ], $filter->getFile() ); $this->assertEquals($this->newDirFile, $filter($this->oldFile)); @@ -370,19 +414,23 @@ public function testAddSameFileAgainAndOverwriteExistingTarget() { $filter = new FileRename([ 'source' => $this->oldFile, - 'target' => $this->newDir]); + 'target' => $this->newDir, + ]); $filter->addFile([ 'source' => $this->oldFile, - 'target' => $this->newFile]); + 'target' => $this->newFile, + ]); $this->assertEquals( - [0 => [ - 'source' => $this->oldFile, - 'target' => $this->newFile, - 'overwrite' => false, - 'randomize' => false, - ]], + [ + 0 => [ + 'source' => $this->oldFile, + 'target' => $this->newFile, + 'overwrite' => false, + 'randomize' => false, + ], + ], $filter->getFile() ); $this->assertEquals($this->newFile, $filter($this->oldFile)); @@ -400,12 +448,14 @@ public function testGetNewName() ]); $this->assertEquals( - [0 => [ - 'source' => $this->oldFile, - 'target' => $this->newDir, - 'overwrite' => false, - 'randomize' => false, - ]], + [ + 0 => [ + 'source' => $this->oldFile, + 'target' => $this->newDir, + 'overwrite' => false, + 'randomize' => false, + ], + ], $filter->getFile() ); $this->assertEquals($this->newDirFile, $filter->getNewName($this->oldFile)); @@ -418,17 +468,20 @@ public function testGetNewNameExceptionWithExistingFile() { $filter = new FileRename([ 'source' => $this->oldFile, - 'target' => $this->newFile]); + 'target' => $this->newFile, + ]); copy($this->oldFile, $this->newFile); $this->assertEquals( - [0 => [ - 'source' => $this->oldFile, - 'target' => $this->newFile, - 'overwrite' => false, - 'randomize' => false, - ]], + [ + 0 => [ + 'source' => $this->oldFile, + 'target' => $this->newFile, + 'overwrite' => false, + 'randomize' => false, + ], + ], $filter->getFile() ); $this->expectException(Exception\InvalidArgumentException::class); @@ -444,17 +497,20 @@ public function testGetNewNameOverwriteWithExistingFile() $filter = new FileRename([ 'source' => $this->oldFile, 'target' => $this->newFile, - 'overwrite' => true]); + 'overwrite' => true, + ]); copy($this->oldFile, $this->newFile); $this->assertEquals( - [0 => [ - 'source' => $this->oldFile, - 'target' => $this->newFile, - 'overwrite' => true, - 'randomize' => false, - ]], + [ + 0 => [ + 'source' => $this->oldFile, + 'target' => $this->newFile, + 'overwrite' => true, + 'randomize' => false, + ], + ], $filter->getFile() ); $this->assertEquals($this->newFile, $filter->getNewName($this->oldFile)); @@ -468,16 +524,18 @@ public function testGetRandomizedFile() $filter = new FileRename([ 'source' => $this->oldFile, 'target' => $this->newFile, - 'randomize' => true + 'randomize' => true, ]); $this->assertEquals( - [0 => [ - 'source' => $this->oldFile, - 'target' => $this->newFile, - 'overwrite' => false, - 'randomize' => true, - ]], + [ + 0 => [ + 'source' => $this->oldFile, + 'target' => $this->newFile, + 'overwrite' => false, + 'randomize' => true, + ], + ], $filter->getFile() ); $fileNoExt = $this->tmpPath . DIRECTORY_SEPARATOR . 'newfile'; @@ -493,19 +551,21 @@ public function testGetRandomizedFile() public function testGetRandomizedFileWithoutExtension() { $fileNoExt = $this->tmpPath . DIRECTORY_SEPARATOR . 'newfile'; - $filter = new FileRename([ + $filter = new FileRename([ 'source' => $this->oldFile, 'target' => $fileNoExt, - 'randomize' => true + 'randomize' => true, ]); $this->assertEquals( - [0 => [ - 'source' => $this->oldFile, - 'target' => $fileNoExt, - 'overwrite' => false, - 'randomize' => true, - ]], + [ + 0 => [ + 'source' => $this->oldFile, + 'target' => $fileNoExt, + 'overwrite' => false, + 'randomize' => true, + ], + ], $filter->getFile() ); $this->assertMatchesRegularExpression( @@ -523,12 +583,14 @@ public function testAddFileWithString() $filter->addFile($this->newFile); $this->assertEquals( - [0 => [ - 'source' => '*', - 'target' => $this->newFile, - 'overwrite' => false, - 'randomize' => false, - ]], + [ + 0 => [ + 'source' => '*', + 'target' => $this->newFile, + 'overwrite' => false, + 'randomize' => false, + ], + ], $filter->getFile() ); $this->assertEquals($this->newFile, $filter($this->oldFile)); @@ -560,11 +622,13 @@ public function returnUnfilteredDataProvider() { return [ [null], - [new \stdClass()], - [[ - $this->oldFile, - $this->origFile - ]] + [new stdClass()], + [ + [ + $this->oldFile, + $this->origFile, + ], + ], ]; } diff --git a/test/File/RenameUploadMock.php b/test/File/RenameUploadMock.php index 371404b4..8ef4196b 100644 --- a/test/File/RenameUploadMock.php +++ b/test/File/RenameUploadMock.php @@ -1,9 +1,13 @@ filesPath = sprintf('%s%s%s', sys_get_temp_dir(), DIRECTORY_SEPARATOR, uniqid('laminasilter')); + $this->filesPath = sprintf('%s%s%s', sys_get_temp_dir(), DIRECTORY_SEPARATOR, uniqid('laminasilter')); $this->targetPath = sprintf('%s%s%s', $this->filesPath, DIRECTORY_SEPARATOR, 'targetPath'); mkdir($this->targetPath, 0775, true); - $this->sourceFile = $this->filesPath . DIRECTORY_SEPARATOR . 'testfile.txt'; - $this->targetFile = $this->filesPath . DIRECTORY_SEPARATOR . 'newfile.xml'; + $this->sourceFile = $this->filesPath . DIRECTORY_SEPARATOR . 'testfile.txt'; + $this->targetFile = $this->filesPath . DIRECTORY_SEPARATOR . 'newfile.xml'; $this->targetPathFile = $this->targetPath . DIRECTORY_SEPARATOR . 'testfile.txt'; touch($this->sourceFile); @@ -72,8 +93,6 @@ public function setUp(): void /** * Sets the path to test files - * - * @return void */ public function tearDown(): void { @@ -163,7 +182,7 @@ public function testStringConstructorWithFilesArray() ], $filter([ 'tmp_name' => $this->sourceFile, - 'name' => $this->targetFile, + 'name' => $this->targetFile, ]) ); $this->assertEquals('falsefile', $filter('falsefile')); @@ -183,7 +202,7 @@ public function testStringConstructorWithPsrFile() $originalFile = $this->prophesize(UploadedFileInterface::class); $originalFile->getStream()->will(function ($args, $mock) use ($originalStream) { - $mock->getStream()->willThrow(new \RuntimeException('Cannot call getStream() more than once')); + $mock->getStream()->willThrow(new RuntimeException('Cannot call getStream() more than once')); return $originalStream->reveal(); }); @@ -209,7 +228,7 @@ public function testStringConstructorWithPsrFile() $fileFactory ->createUploadedFile( Argument::that([$renamedStream, 'reveal']), - 0, // we can hardcode this, as we know the file is empty + 0, // we can hardcode this, as we know the file is empty UPLOAD_ERR_OK, $targetFile, null @@ -272,8 +291,8 @@ public function testTargetDirectory() public function testOverwriteWithExistingFile() { $filter = new RenameUploadMock([ - 'target' => $this->targetFile, - 'overwrite' => true, + 'target' => $this->targetFile, + 'overwrite' => true, ]); copy($this->sourceFile, $this->targetFile); @@ -288,8 +307,8 @@ public function testOverwriteWithExistingFile() public function testCannotOverwriteExistingFile() { $filter = new RenameUploadMock([ - 'target' => $this->targetFile, - 'overwrite' => false, + 'target' => $this->targetFile, + 'overwrite' => false, ]); copy($this->sourceFile, $this->targetFile); @@ -307,9 +326,9 @@ public function testCannotOverwriteExistingFile() public function testGetRandomizedFile() { $fileNoExt = $this->filesPath . DIRECTORY_SEPARATOR . 'newfile'; - $filter = new RenameUploadMock([ - 'target' => $this->targetFile, - 'randomize' => true, + $filter = new RenameUploadMock([ + 'target' => $this->targetFile, + 'randomize' => true, ]); $this->assertMatchesRegularExpression( @@ -321,16 +340,16 @@ public function testGetRandomizedFile() public function testGetFileWithOriginalExtension() { $fileNoExt = $this->filesPath . DIRECTORY_SEPARATOR . 'newfile'; - $filter = new RenameUploadMock([ - 'target' => $this->targetFile, + $filter = new RenameUploadMock([ + 'target' => $this->targetFile, 'use_upload_extension' => true, - 'randomize' => false, + 'randomize' => false, ]); $oldFilePathInfo = pathinfo($this->sourceFile); $this->assertMatchesRegularExpression( - '#' . str_replace('\\', '\\\\', $fileNoExt) . '.'.$oldFilePathInfo['extension'].'#', + '#' . str_replace('\\', '\\\\', $fileNoExt) . '.' . $oldFilePathInfo['extension'] . '#', $filter($this->sourceFile) ); } @@ -338,16 +357,16 @@ public function testGetFileWithOriginalExtension() public function testGetRandomizedFileWithOriginalExtension() { $fileNoExt = $this->filesPath . DIRECTORY_SEPARATOR . 'newfile'; - $filter = new RenameUploadMock([ - 'target' => $this->targetFile, + $filter = new RenameUploadMock([ + 'target' => $this->targetFile, 'use_upload_extension' => true, - 'randomize' => true, + 'randomize' => true, ]); $oldFilePathInfo = pathinfo($this->sourceFile); $this->assertMatchesRegularExpression( - '#' . str_replace('\\', '\\\\', $fileNoExt) . '_.{23}\.'.$oldFilePathInfo['extension'].'#', + '#' . str_replace('\\', '\\\\', $fileNoExt) . '_.{23}\.' . $oldFilePathInfo['extension'] . '#', $filter($this->sourceFile) ); } @@ -358,9 +377,9 @@ public function testGetRandomizedFileWithOriginalExtension() public function testGetRandomizedFileWithoutExtension() { $fileNoExt = $this->filesPath . DIRECTORY_SEPARATOR . 'newfile'; - $filter = new RenameUploadMock([ - 'target' => $fileNoExt, - 'randomize' => true, + $filter = new RenameUploadMock([ + 'target' => $fileNoExt, + 'randomize' => true, ]); $this->assertMatchesRegularExpression( @@ -385,8 +404,8 @@ public function testInvalidConstruction() public function testCanFilterMultipleTimesWithSameResult() { $filter = new RenameUploadMock([ - 'target' => $this->targetFile, - 'randomize' => true, + 'target' => $this->targetFile, + 'randomize' => true, ]); $firstResult = $filter($this->sourceFile); @@ -398,16 +417,17 @@ public function testCanFilterMultipleTimesWithSameResult() $this->assertSame($firstResult, $secondResult); } - public function returnUnfilteredDataProvider() { return [ [null], - [new \stdClass()], - [[ - $this->sourceFile, - 'something invalid' - ]] + [new stdClass()], + [ + [ + $this->sourceFile, + 'something invalid', + ], + ], ]; } @@ -418,8 +438,8 @@ public function returnUnfilteredDataProvider() public function testReturnUnfiltered($input) { $filter = new RenameUploadMock([ - 'target' => $this->targetFile, - 'randomize' => true, + 'target' => $this->targetFile, + 'randomize' => true, ]); $this->assertEquals($input, $filter($input)); @@ -427,6 +447,7 @@ public function testReturnUnfiltered($input) /** * @see https://github.com/zendframework/zend-filter/issues/77 + * * @return void */ public function testFilterDoesNotAlterUnknownFileDataAndCachesResultsOfFilteringSAPIUploads() @@ -436,18 +457,18 @@ public function testFilterDoesNotAlterUnknownFileDataAndCachesResultsOfFiltering // Emulate the output of \Laminas\Http\Request::getFiles()->toArray() $sapiSource = [ 'tmp_name' => $this->sourceFile, - 'name' => basename($this->targetFile), - 'type' => 'text/plain', - 'error' => \UPLOAD_ERR_OK, - 'size' => 123, + 'name' => basename($this->targetFile), + 'type' => 'text/plain', + 'error' => UPLOAD_ERR_OK, + 'size' => 123, ]; $sapiTarget = [ 'tmp_name' => $this->targetPathFile, - 'name' => basename($this->targetFile), - 'type' => 'text/plain', - 'error' => \UPLOAD_ERR_OK, - 'size' => 123, + 'name' => basename($this->targetFile), + 'type' => 'text/plain', + 'error' => UPLOAD_ERR_OK, + 'size' => 123, ]; // Check the result twice for the `alreadyFiltered` cache path @@ -457,6 +478,7 @@ public function testFilterDoesNotAlterUnknownFileDataAndCachesResultsOfFiltering /** * @see https://github.com/zendframework/zend-filter/issues/76 + * * @return void */ public function testFilterReturnsFileDataVerbatimUnderSAPIWhenTargetPathIsUnspecified() @@ -465,7 +487,7 @@ public function testFilterReturnsFileDataVerbatimUnderSAPIWhenTargetPathIsUnspec $source = [ 'tmp_name' => $this->sourceFile, - 'name' => basename($this->targetFile), + 'name' => basename($this->targetFile), ]; $this->assertEquals($source, $filter($source)); diff --git a/test/File/UpperCaseTest.php b/test/File/UpperCaseTest.php index 7dc171b0..a39a0cc0 100644 --- a/test/File/UpperCaseTest.php +++ b/test/File/UpperCaseTest.php @@ -1,10 +1,25 @@ testFile = sprintf('%s/%s.txt', sys_get_temp_dir(), uniqid('laminasilter')); copy($origFile, $this->testFile); @@ -31,8 +44,6 @@ public function setUp(): void /** * Sets the path to test files - * - * @return void */ public function tearDown(): void { @@ -84,7 +95,7 @@ public function testCheckSettingOfEncodingInIstance() $filter = new FileUpperCase('ISO-8859-1'); $filter($this->testFile); $this->assertStringContainsString('THIS IS A FILE', file_get_contents($this->testFile)); - } catch (\Laminas\Filter\Exception\ExtensionNotLoadedException $e) { + } catch (ExtensionNotLoadedException $e) { $this->assertStringContainsString('mbstring is required', $e->getMessage()); } } @@ -100,7 +111,7 @@ public function testCheckSettingOfEncodingWithMethod() $filter->setEncoding('ISO-8859-1'); $filter($this->testFile); $this->assertStringContainsString('THIS IS A FILE', file_get_contents($this->testFile)); - } catch (\Laminas\Filter\Exception\ExtensionNotLoadedException $e) { + } catch (ExtensionNotLoadedException $e) { $this->assertStringContainsString('mbstring is required', $e->getMessage()); } } @@ -109,11 +120,13 @@ public function returnUnfilteredDataProvider() { return [ [null], - [new \stdClass()], - [[ - $this->testFile, - 'something invalid' - ]] + [new stdClass()], + [ + [ + $this->testFile, + 'something invalid', + ], + ], ]; } diff --git a/test/FilterChainTest.php b/test/FilterChainTest.php index f658a77a..1eec2bc7 100644 --- a/test/FilterChainTest.php +++ b/test/FilterChainTest.php @@ -1,5 +1,7 @@ attach(new TestAsset\StripUpperCase()) - ->attach(new TestAsset\LowerCase, 100); + ->attach(new TestAsset\LowerCase(), 100); $value = 'AbC'; $valueExpected = 'b'; $this->assertEquals($valueExpected, $chain->filter($value)); @@ -109,19 +119,19 @@ protected function getChainConfig() { return [ 'callbacks' => [ - ['callback' => __CLASS__ . '::staticUcaseFilter'], + ['callback' => self::class . '::staticUcaseFilter'], [ 'priority' => 10000, 'callback' => function ($value) { return trim($value); - } + }, ], ], 'filters' => [ [ 'name' => StripTags::class, 'options' => ['allowTags' => 'img', 'allowAttribs' => 'id'], - 'priority' => 10100 + 'priority' => 10100, ], ], ]; @@ -176,7 +186,7 @@ public function testCanSerializeFilterChain() $serialized = serialize($chain); $unserialized = unserialize($serialized); - $this->assertInstanceOf('Laminas\Filter\FilterChain', $unserialized); + $this->assertInstanceOf(FilterChain::class, $unserialized); $this->assertEquals(2, count($unserialized)); $value = 'AbC'; $valueExpected = 'abc'; diff --git a/test/FilterPluginManagerCompatibilityTest.php b/test/FilterPluginManagerCompatibilityTest.php index b2cd0e3f..c0a6f567 100644 --- a/test/FilterPluginManagerCompatibilityTest.php +++ b/test/FilterPluginManagerCompatibilityTest.php @@ -1,5 +1,7 @@ getPluginManager(); - $r = new ReflectionProperty($pluginManager, 'aliases'); + $r = new ReflectionProperty($pluginManager, 'aliases'); $r->setAccessible(true); $aliases = $r->getValue($pluginManager); diff --git a/test/FilterPluginManagerFactoryTest.php b/test/FilterPluginManagerFactoryTest.php index 24623e6b..f22c9ac8 100644 --- a/test/FilterPluginManagerFactoryTest.php +++ b/test/FilterPluginManagerFactoryTest.php @@ -1,5 +1,7 @@ prophesize(ContainerInterface::class)->reveal(); - $factory = new FilterPluginManagerFactory(); + $factory = new FilterPluginManagerFactory(); $filters = $factory($container, FilterPluginManagerFactory::class); $this->assertInstanceOf(FilterPluginManager::class, $filters); @@ -42,7 +46,7 @@ public function testFactoryReturnsPluginManager() public function testFactoryConfiguresPluginManagerUnderContainerInterop() { $container = $this->prophesize(ContainerInterface::class)->reveal(); - $filter = function ($value) { + $filter = function ($value) { return $value; }; @@ -83,7 +87,7 @@ public function testConfiguresFilterServicesWhenFound() $filter = $this->prophesize(FilterInterface::class)->reveal(); $config = [ 'filters' => [ - 'aliases' => [ + 'aliases' => [ 'test' => Boolean::class, ], 'factories' => [ @@ -116,7 +120,7 @@ public function testDoesNotConfigureFilterServicesWhenServiceListenerPresent() $filter = $this->prophesize(FilterInterface::class)->reveal(); $config = [ 'filters' => [ - 'aliases' => [ + 'aliases' => [ 'test' => Boolean::class, ], 'factories' => [ diff --git a/test/FilterPluginManagerTest.php b/test/FilterPluginManagerTest.php index 4e38ed1c..a68d53b7 100644 --- a/test/FilterPluginManagerTest.php +++ b/test/FilterPluginManagerTest.php @@ -1,19 +1,22 @@ filters->get('int'); - $this->assertInstanceOf('Laminas\Filter\ToInt', $filter); + $this->assertInstanceOf(ToInt::class, $filter); } public function testRegisteringInvalidFilterRaisesException() @@ -36,7 +39,7 @@ public function testRegisteringInvalidFilterRaisesException() public function testLoadingInvalidFilterRaisesException() { - $this->filters->setInvokableClass('test', get_class($this)); + $this->filters->setInvokableClass('test', static::class); $this->expectException($this->getInvalidServiceException()); $this->filters->get('test'); } @@ -85,7 +88,6 @@ public function testFiltersConstructedAreDifferent() $this->assertNotEquals($filterOne, $filterTwo); } - protected function getInvalidServiceException() { if (method_exists($this->filters, 'configure')) { diff --git a/test/HtmlEntitiesTest.php b/test/HtmlEntitiesTest.php index 69e089c1..ba7976a2 100644 --- a/test/HtmlEntitiesTest.php +++ b/test/HtmlEntitiesTest.php @@ -1,10 +1,29 @@ ' => '>', '\'' => ''', '"' => '"', - '&' => '&' - ]; - $filter = $this->_filter; + '&' => '&', + ]; + $filter = $this->_filter; foreach ($valuesExpected as $input => $output) { $this->assertEquals($output, $filter($input)); } @@ -120,7 +137,7 @@ public function testSetDoubleQuote() public function testFluentInterface() { $instance = $this->_filter->setCharSet('UTF-8')->setQuoteStyle(ENT_QUOTES)->setDoubleQuote(false); - $this->assertInstanceOf('Laminas\Filter\HtmlEntities', $instance); + $this->assertInstanceOf(HtmlEntitiesFilter::class, $instance); } /** @@ -246,8 +263,8 @@ public function testRaisesExceptionIfEncodingMismatchDetectedAndFinalStringIsEmp try { $result = $this->_filter->filter($string); $this->fail('Expected exception from single non-utf-8 character'); - } catch (\Exception $e) { - $this->assertInstanceOf('Laminas\Filter\Exception\DomainException', $e); + } catch (Exception $e) { + $this->assertInstanceOf(DomainException::class, $e); } } @@ -255,11 +272,13 @@ public function returnUnfilteredDataProvider() { return [ [null], - [new \stdClass()], - [[ - '<', - '>' - ]] + [new stdClass()], + [ + [ + '<', + '>', + ], + ], ]; } diff --git a/test/InflectorTest.php b/test/InflectorTest.php index 89cdbb35..8e996729 100644 --- a/test/InflectorTest.php +++ b/test/InflectorTest.php @@ -1,9 +1,12 @@ inflector->getPluginManager(); - $this->assertInstanceOf('Laminas\Filter\FilterPluginManager', $broker); + $this->assertInstanceOf(FilterPluginManager::class, $broker); } public function testSetPluginManagerAllowsSettingAlternatePluginManager() @@ -88,7 +92,7 @@ public function testSetFilterRuleWithStringRuleCreatesRuleEntryAndFilterObject() $rules = $this->inflector->getRules('controller'); $this->assertEquals(1, count($rules)); $filter = $rules[0]; - $this->assertInstanceOf('Laminas\Filter\FilterInterface', $filter); + $this->assertInstanceOf(FilterInterface::class, $filter); } public function testSetFilterRuleWithFilterObjectCreatesRuleEntryWithFilterObject() @@ -100,7 +104,7 @@ public function testSetFilterRuleWithFilterObjectCreatesRuleEntryWithFilterObjec $rules = $this->inflector->getRules('controller'); $this->assertEquals(1, count($rules)); $received = $rules[0]; - $this->assertInstanceOf('Laminas\Filter\FilterInterface', $received); + $this->assertInstanceOf(FilterInterface::class, $received); $this->assertSame($filter, $received); } @@ -111,8 +115,8 @@ public function testAddFilterRuleAppendsRuleEntries() $this->inflector->setFilterRule('controller', [PregReplace::class, TestAsset\Alpha::class]); $rules = $this->inflector->getRules('controller'); $this->assertEquals(2, count($rules)); - $this->assertInstanceOf('Laminas\Filter\FilterInterface', $rules[0]); - $this->assertInstanceOf('Laminas\Filter\FilterInterface', $rules[1]); + $this->assertInstanceOf(FilterInterface::class, $rules[0]); + $this->assertInstanceOf(FilterInterface::class, $rules[1]); } public function testSetStaticRuleCreatesScalarRuleEntry() @@ -181,7 +185,7 @@ public function testSetRulesCreatesAppropriateRuleEntries() public function testGetRule() { $this->inflector->setFilterRule(':controller', [TestAsset\Alpha::class, StringToLower::class]); - $this->assertInstanceOf('Laminas\Filter\StringToLower', $this->inflector->getRule('controller', 1)); + $this->assertInstanceOf(StringToLower::class, $this->inflector->getRule('controller', 1)); $this->assertFalse($this->inflector->getRule('controller', 2)); } @@ -192,13 +196,13 @@ public function testFilterTransformsStringAccordingToRules() ->addRules([ ':controller' => [CamelCaseToDash::class], ':action' => [CamelCaseToDash::class], - 'suffix' => 'phtml' + 'suffix' => 'phtml', ]); $filter = $this->inflector; $filtered = $filter([ 'controller' => 'FooBar', - 'action' => 'bazBat' + 'action' => 'bazBat', ]); $this->assertEquals('Foo-Bar/baz-Bat.phtml', $filtered); } @@ -217,7 +221,7 @@ public function testTargetReplacementIdentiferWorksWhenInflected() [ ':controller' => [CamelCaseToDash::class], ':action' => [CamelCaseToDash::class], - 'suffix' => 'phtml' + 'suffix' => 'phtml', ], null, '?=##' @@ -225,7 +229,7 @@ public function testTargetReplacementIdentiferWorksWhenInflected() $filtered = $inflector([ 'controller' => 'FooBar', - 'action' => 'bazBat' + 'action' => 'bazBat', ]); $this->assertEquals('Foo-Bar/baz-Bat.phtml', $filtered); @@ -252,7 +256,7 @@ public function testTargetExceptionThrownWhenTargetSourceNotSatisfied() [ ':controller' => [CamelCaseToDash::class], ':action' => [CamelCaseToDash::class], - 'suffix' => 'phtml' + 'suffix' => 'phtml', ], true, '?=##' @@ -270,7 +274,7 @@ public function testTargetExceptionNotThrownOnIdentifierNotFollowedByCharacter() [ ':controller' => [CamelCaseToDash::class, StringToLower::class], ':action' => [CamelCaseToDash::class], - 'suffix' => 'phtml' + 'suffix' => 'phtml', ], true, ':' @@ -282,7 +286,7 @@ public function testTargetExceptionNotThrownOnIdentifierNotFollowedByCharacter() public function getOptions() { - $options = [ + return [ 'target' => '$controller/$action.$suffix', 'throwTargetExceptionsOn' => true, 'targetReplacementIdentifier' => '$', @@ -295,11 +299,9 @@ public function getOptions() 'rule1' => CamelCaseToDash::class, 'rule2' => StringToUpper::class, ], - 'suffix' => 'php' + 'suffix' => 'php', ], ]; - - return $options; } /** @@ -307,7 +309,7 @@ public function getOptions() * Laminas\Config\Config instance; the two are interchangeable, as inflectors * consume the more general array or Traversable types. * - * @return \Traversable + * @return Traversable */ public function getConfig() { @@ -324,7 +326,7 @@ protected function _testOptions($inflector) $broker = $inflector->getPluginManager(); $this->assertEquals($options['target'], $inflector->getTarget()); - $this->assertInstanceOf('Laminas\Filter\FilterPluginManager', $broker); + $this->assertInstanceOf(FilterPluginManager::class, $broker); $this->assertTrue($inflector->isThrowTargetExceptionsOn()); $this->assertEquals($options['targetReplacementIdentifier'], $inflector->getTargetReplacementIdentifier()); @@ -360,7 +362,7 @@ public function testCheckInflectorWithPregBackreferenceLikeParts() [ ':controller' => [CamelCaseToDash::class, StringToLower::class], ':action' => [CamelCaseToDash::class], - 'suffix' => 'phtml' + 'suffix' => 'phtml', ], true, ':' @@ -370,7 +372,7 @@ public function testCheckInflectorWithPregBackreferenceLikeParts() $filtered = $inflector([ 'controller' => 'FooBar', - 'action' => 'MooToo' + 'action' => 'MooToo', ]); $this->assertEquals( $filtered, diff --git a/test/IntTest.php b/test/IntTest.php index 11ab6593..18f73fbc 100644 --- a/test/IntTest.php +++ b/test/IntTest.php @@ -1,10 +1,16 @@ expectException(\Laminas\Filter\Exception\RuntimeException::class); + $this->expectException(RuntimeException::class); $sut = new MonthSelectFilter(); $sut->filter(['year' => '2120']); } diff --git a/test/NullTest.php b/test/NullTest.php index 83c9b54a..6427a24c 100644 --- a/test/NullTest.php +++ b/test/NullTest.php @@ -1,10 +1,16 @@ [a-z_-]+)#'; - $filter = new PregReplaceFilter($pattern); + $filter = new PregReplaceFilter($pattern); $this->assertEquals($pattern, $filter->getPattern()); } public function testPassingReplacementToConstructorSetsReplacement() { $replace = 'foo/bar'; - $filter = new PregReplaceFilter(null, $replace); + $filter = new PregReplaceFilter(null, $replace); $this->assertEquals($replace, $filter->getReplacement()); } @@ -74,7 +71,7 @@ public function testFilterPerformsRegexReplacement() $filter = $this->filter; $filter->setPattern('#^controller/(?P[a-z_-]+)#')->setReplacement('foo/bar'); - $string = 'controller/action'; + $string = 'controller/action'; $filtered = $filter($string); $this->assertNotEquals($string, $filtered); $this->assertEquals('foo/bar', $filtered); @@ -87,14 +84,14 @@ public function testFilterPerformsRegexReplacementWithArray() $input = [ 'controller/action', - 'This should stay the same' + 'This should stay the same', ]; $filtered = $filter($input); $this->assertNotEquals($input, $filtered); $this->assertEquals([ 'foo/bar', - 'This should stay the same' + 'This should stay the same', ], $filtered); } @@ -120,7 +117,7 @@ public function returnUnfilteredDataProvider() { return [ [null], - [new \stdClass()] + [new stdClass()], ]; } diff --git a/test/RealPathTest.php b/test/RealPathTest.php index b1ebbb91..d22d1938 100644 --- a/test/RealPathTest.php +++ b/test/RealPathTest.php @@ -1,9 +1,17 @@ _filesPath . DIRECTORY_SEPARATOR . 'file.1', - $this->_filesPath . DIRECTORY_SEPARATOR . 'file.2' - ] - ] + $this->_filesPath . DIRECTORY_SEPARATOR . 'file.2', + ], + ], ]; } diff --git a/test/StaticFilterTest.php b/test/StaticFilterTest.php index f3b906bd..25e13f77 100644 --- a/test/StaticFilterTest.php +++ b/test/StaticFilterTest.php @@ -1,5 +1,7 @@ assertInstanceOf('Laminas\Filter\FilterPluginManager', $plugins); + $this->assertInstanceOf(FilterPluginManager::class, $plugins); } public function testCanSpecifyCustomPluginManager() @@ -44,7 +47,7 @@ public function testCanResetPluginManagerByPassingNull() StaticFilter::setPluginManager(null); $registered = StaticFilter::getPluginManager(); $this->assertNotSame($plugins, $registered); - $this->assertInstanceOf('Laminas\Filter\FilterPluginManager', $registered); + $this->assertInstanceOf(FilterPluginManager::class, $registered); } /** @@ -91,7 +94,7 @@ public function testStaticFactoryClassNotFound() public function testUsesDifferentConfigurationOnEachRequest() { - $first = StaticFilter::execute('foo', Callback::class, [ + $first = StaticFilter::execute('foo', Callback::class, [ 'callback' => function ($value) { return 'FOO'; }, diff --git a/test/StringPrefixTest.php b/test/StringPrefixTest.php index 4efc39eb..d236d7d4 100644 --- a/test/StringPrefixTest.php +++ b/test/StringPrefixTest.php @@ -1,5 +1,7 @@ filter = new StringPrefixFilter(); @@ -68,7 +67,6 @@ function () { /** * @dataProvider invalidPrefixesDataProvider - * * @param mixed $prefix */ public function testInvalidPrefixes($prefix) diff --git a/test/StringSuffixTest.php b/test/StringSuffixTest.php index 39fad9c6..41f1df26 100644 --- a/test/StringSuffixTest.php +++ b/test/StringSuffixTest.php @@ -1,5 +1,7 @@ filter = new StringSuffixFilter(); @@ -68,7 +67,6 @@ function () { /** * @dataProvider invalidSuffixesDataProvider - * * @param mixed $suffix */ public function testInvalidSuffixes($suffix) diff --git a/test/StringToLowerTest.php b/test/StringToLowerTest.php index ccbad2ce..563c7ed8 100644 --- a/test/StringToLowerTest.php +++ b/test/StringToLowerTest.php @@ -1,10 +1,16 @@ _filter; + $filter = $this->_filter; $valuesExpected = [ 'string' => 'string', 'aBc1@3' => 'abc1@3', - 'A b C' => 'a b c' + 'A b C' => 'a b c', ]; foreach ($valuesExpected as $input => $output) { @@ -54,11 +58,11 @@ public function testBasic() */ public function testWithEncoding() { - $filter = $this->_filter; + $filter = $this->_filter; $valuesExpected = [ 'Ü' => 'ü', 'Ñ' => 'ñ', - 'ÜÑ123' => 'üñ123' + 'ÜÑ123' => 'üñ123', ]; try { @@ -93,7 +97,7 @@ public function testInitiationWithEncoding() $valuesExpected = [ 'Ü' => 'ü', 'Ñ' => 'ñ', - 'ÜÑ123' => 'üñ123' + 'ÜÑ123' => 'üñ123', ]; try { @@ -111,11 +115,11 @@ public function testInitiationWithEncoding() */ public function testCaseInsensitiveEncoding() { - $filter = $this->_filter; + $filter = $this->_filter; $valuesExpected = [ 'Ü' => 'ü', 'Ñ' => 'ñ', - 'ÜÑ123' => 'üñ123' + 'ÜÑ123' => 'üñ123', ]; try { @@ -154,13 +158,13 @@ public function returnUnfilteredDataProvider() { return [ [null], - [new \stdClass()], + [new stdClass()], [ [ 'UPPER CASE WRITTEN', - 'This should stay the same' - ] - ] + 'This should stay the same', + ], + ], ]; } diff --git a/test/StringToUpperTest.php b/test/StringToUpperTest.php index c2d37598..8e248ec2 100644 --- a/test/StringToUpperTest.php +++ b/test/StringToUpperTest.php @@ -1,10 +1,16 @@ _filter; + $filter = $this->_filter; $valuesExpected = [ 'STRING' => 'STRING', 'ABC1@3' => 'ABC1@3', - 'A b C' => 'A B C' + 'A b C' => 'A B C', ]; foreach ($valuesExpected as $input => $output) { @@ -54,11 +58,11 @@ public function testBasic() */ public function testWithEncoding() { - $filter = $this->_filter; + $filter = $this->_filter; $valuesExpected = [ 'ü' => 'Ü', 'ñ' => 'Ñ', - 'üñ123' => 'ÜÑ123' + 'üñ123' => 'ÜÑ123', ]; try { @@ -93,7 +97,7 @@ public function testInitiationWithEncoding() $valuesExpected = [ 'ü' => 'Ü', 'ñ' => 'Ñ', - 'üñ123' => 'ÜÑ123' + 'üñ123' => 'ÜÑ123', ]; try { @@ -111,11 +115,11 @@ public function testInitiationWithEncoding() */ public function testCaseInsensitiveEncoding() { - $filter = $this->_filter; + $filter = $this->_filter; $valuesExpected = [ 'ü' => 'Ü', 'ñ' => 'Ñ', - 'üñ123' => 'ÜÑ123' + 'üñ123' => 'ÜÑ123', ]; try { @@ -154,11 +158,13 @@ public function returnUnfilteredDataProvider() { return [ [null], - [new \stdClass()], - [[ - 'lower case written', - 'This should stay the same' - ]] + [new stdClass()], + [ + [ + 'lower case written', + 'This should stay the same', + ], + ], ]; } diff --git a/test/StringTrimTest.php b/test/StringTrimTest.php index 1dcdbef7..dbd3aa48 100644 --- a/test/StringTrimTest.php +++ b/test/StringTrimTest.php @@ -1,28 +1,26 @@ _filter = new StringTrim(); + $this->filter = new StringTrim(); } /** @@ -32,12 +30,12 @@ public function setUp(): void */ public function testBasic() { - $filter = $this->_filter; + $filter = $this->filter; $valuesExpected = [ 'string' => 'string', ' str ' => 'str', - "\ns\t" => 's' - ]; + "\ns\t" => 's', + ]; foreach ($valuesExpected as $input => $output) { $this->assertEquals($output, $filter($input)); } @@ -50,7 +48,7 @@ public function testBasic() */ public function testUtf8() { - $this->assertEquals('a', $this->_filter->filter(utf8_encode("\xa0a\xa0"))); + $this->assertEquals('a', $this->filter->filter(utf8_encode("\xa0a\xa0"))); } /** @@ -60,7 +58,7 @@ public function testUtf8() */ public function testGetCharList() { - $this->assertEquals(null, $this->_filter->getCharList()); + $this->assertEquals(null, $this->filter->getCharList()); } /** @@ -70,8 +68,8 @@ public function testGetCharList() */ public function testSetCharList() { - $this->_filter->setCharList('&'); - $this->assertEquals('&', $this->_filter->getCharList()); + $this->filter->setCharList('&'); + $this->assertEquals('&', $this->filter->getCharList()); } /** @@ -81,7 +79,7 @@ public function testSetCharList() */ public function testCharList() { - $filter = $this->_filter; + $filter = $this->filter; $filter->setCharList('&'); $this->assertEquals('a&b', $filter('&&a&b&&')); } @@ -91,7 +89,7 @@ public function testCharList() */ public function testLaminas7183() { - $filter = $this->_filter; + $filter = $this->filter; $this->assertEquals('Зенд', $filter('Зенд')); } @@ -100,17 +98,16 @@ public function testLaminas7183() */ public function testLaminas170() { - $filter = $this->_filter; + $filter = $this->filter; $this->assertEquals('Расчет', $filter('Расчет')); } - /** * @group Laminas-7902 */ public function testLaminas7902() { - $filter = $this->_filter; + $filter = $this->filter; $this->assertEquals('/', $filter('/')); } @@ -119,13 +116,13 @@ public function testLaminas7902() */ public function testLaminas10891() { - $filter = $this->_filter; + $filter = $this->filter; $this->assertEquals('Зенд', $filter(' Зенд ')); $this->assertEquals('Зенд', $filter('Зенд ')); $this->assertEquals('Зенд', $filter(' Зенд')); - $trim_charlist = " \t\n\r\x0B・。"; - $filter = new StringTrim($trim_charlist); + $trimCharlist = " \t\n\r\x0B・。"; + $filter = new StringTrim($trimCharlist); $this->assertEquals('Зенд', $filter->filter('。 Зенд 。')); } @@ -147,7 +144,7 @@ public function getNonStringValues() */ public function testShouldNotFilterNonStringValues($value) { - $filtered = $this->_filter->filter($value); + $filtered = $this->filter->filter($value); $this->assertSame($value, $filtered); } @@ -158,7 +155,7 @@ public function testShouldNotFilterNonStringValues($value) */ public function testEmptyCharList() { - $filter = $this->_filter; + $filter = $this->filter; $filter->setCharList('0'); $this->assertEquals('a0b', $filter('00a0b00')); diff --git a/test/StripNewlinesTest.php b/test/StripNewlinesTest.php index 6acc340b..5de14d25 100644 --- a/test/StripNewlinesTest.php +++ b/test/StripNewlinesTest.php @@ -1,14 +1,15 @@ '', - "\n" => '', - "\r" => '', - "\r\n" => '', - '\n' => '\n', - '\r' => '\r', - '\r\n' => '\r\n', - "Some text\nthat we have\r\nstuff in" => 'Some textthat we havestuff in' + '' => '', + "\n" => '', + "\r" => '', + "\r\n" => '', + '\n' => '\n', + '\r' => '\r', + '\r\n' => '\r\n', + "Some text\nthat we have\r\nstuff in" => 'Some textthat we havestuff in', ]; foreach ($valuesExpected as $input => $output) { $this->assertEquals($output, $filter($input)); @@ -36,15 +37,14 @@ public function testBasic() } /** - * * @return void */ public function testArrayValues() { - $filter = new StripNewLinesFilter(); + $filter = new StripNewlinesFilter(); $expected = [ "Some text\nthat we have\r\nstuff in" => 'Some textthat we havestuff in', - "Some text\n" => 'Some text' + "Some text\n" => 'Some text', ]; $this->assertEquals(array_values($expected), $filter(array_keys($expected))); } @@ -53,7 +53,7 @@ public function returnUnfilteredDataProvider() { return [ [null], - [new \stdClass()] + [new stdClass()], ]; } @@ -63,7 +63,7 @@ public function returnUnfilteredDataProvider() */ public function testReturnUnfiltered($input) { - $filter = new StripNewLinesFilter(); + $filter = new StripNewlinesFilter(); $this->assertEquals($input, $filter($input)); } diff --git a/test/StripTagsTest.php b/test/StripTagsTest.php index fa10346e..ca6f528b 100644 --- a/test/StripTagsTest.php +++ b/test/StripTagsTest.php @@ -1,9 +1,14 @@ 'href', - 'div' => ['id', 'class'] - ]; + 'div' => ['id', 'class'], + ]; $this->_filter->setTagsAllowed($tagsAllowed); $tagsAllowedExpected = [ 'b' => [], 'a' => ['href' => null], - 'div' => ['id' => null, 'class' => null] - ]; + 'div' => ['id' => null, 'class' => null], + ]; $this->assertEquals($tagsAllowedExpected, $this->_filter->getTagsAllowed()); } @@ -100,14 +103,14 @@ public function testSetAttributesAllowedArray() 'clAss', 4 => 'inT', 'ok' => 'String', - null - ]; + null, + ]; $this->_filter->setAttributesAllowed($attributesAllowed); $attributesAllowedExpected = [ 'class' => null, 'int' => null, - 'string' => null - ]; + 'string' => null, + ]; $this->assertEquals($attributesAllowedExpected, $this->_filter->getAttributesAllowed()); } @@ -223,7 +226,7 @@ public function testFilterTagWrappedGt() */ public function testFilterTagAllowedAttribute() { - $filter = $this->_filter; + $filter = $this->_filter; $tagsAllowed = 'img'; $this->_filter->setTagsAllowed($tagsAllowed); $input = 'foo'; @@ -238,10 +241,10 @@ public function testFilterTagAllowedAttribute() */ public function testFilterTagAllowedAttributeAllowed() { - $filter = $this->_filter; + $filter = $this->_filter; $tagsAllowed = [ - 'img' => 'alt' - ]; + 'img' => 'alt', + ]; $this->_filter->setTagsAllowed($tagsAllowed); $input = 'FOO'; $expected = 'FOO'; @@ -257,10 +260,10 @@ public function testFilterTagAllowedAttributeAllowed() */ public function testFilterTagAllowedAttributeAllowedGt() { - $filter = $this->_filter; + $filter = $this->_filter; $tagsAllowed = [ - 'img' => 'alt' - ]; + 'img' => 'alt', + ]; $this->_filter->setTagsAllowed($tagsAllowed); $input = '$object->property'; $expected = 'property" /'; @@ -274,10 +277,10 @@ public function testFilterTagAllowedAttributeAllowedGt() */ public function testFilterTagAllowedAttributeAllowedGtEscaped() { - $filter = $this->_filter; + $filter = $this->_filter; $tagsAllowed = [ - 'img' => 'alt' - ]; + 'img' => 'alt', + ]; $this->_filter->setTagsAllowed($tagsAllowed); $input = '$object->property'; $expected = '$object->property'; @@ -292,10 +295,10 @@ public function testFilterTagAllowedAttributeAllowedGtEscaped() */ public function testFilterTagAllowedAttributeAllowedValueUnclosed() { - $filter = $this->_filter; + $filter = $this->_filter; $tagsAllowed = [ - 'img' => ['alt', 'height', 'src', 'width'] - ]; + 'img' => ['alt', 'height', 'src', 'width'], + ]; $this->_filter->setTagsAllowed($tagsAllowed); $input = 'square height='; $expected = 'square height='; @@ -309,10 +312,10 @@ public function testFilterTagAllowedAttributeAllowedValueUnclosed() */ public function testFilterTagAllowedAttributeAllowedValueMissing() { - $filter = $this->_filter; + $filter = $this->_filter; $tagsAllowed = [ - 'input' => ['checked', 'name', 'type'] - ]; + 'input' => ['checked', 'name', 'type'], + ]; $this->_filter->setTagsAllowed($tagsAllowed); $input = ''; $expected = ''; @@ -323,18 +326,19 @@ public function testFilterTagAllowedAttributeAllowedValueMissing() * Ensures that the filter works properly for the data reported on fw-general on 2007-05-26 * * @see http://www.nabble.com/question-about-tag-filter-p10813688s16154.html + * * @return void */ public function testFilter20070526() { - $filter = $this->_filter; + $filter = $this->_filter; $tagsAllowed = [ 'object' => ['width', 'height'], 'param' => ['name', 'value'], 'embed' => ['src', 'type', 'wmode', 'width', 'height'], - ]; + ]; $this->_filter->setTagsAllowed($tagsAllowed); - $input = '' + $input = '' . ''; @@ -352,7 +356,7 @@ public function testFilter20070526() */ public function testFilterComment() { - $filter = $this->_filter; + $filter = $this->_filter; $input = ''; $expected = ''; $this->assertEquals($expected, $filter($input)); @@ -365,7 +369,7 @@ public function testFilterComment() */ public function testFilterCommentWrapped() { - $filter = $this->_filter; + $filter = $this->_filter; $input = 'foobar'; $expected = 'foobar'; $this->assertEquals($expected, $filter($input)); @@ -374,15 +378,16 @@ public function testFilterCommentWrapped() /** * Ensures that a closing angle bracket in an allowed attribute does not break the parser * - * @return void * @link https://getlaminas.org/issues/browse/Laminas-3278 + * + * @return void */ public function testClosingAngleBracketInAllowedAttributeValue() { - $filter = $this->_filter; + $filter = $this->_filter; $tagsAllowed = [ - 'a' => 'href' - ]; + 'a' => 'href', + ]; $filter->setTagsAllowed($tagsAllowed); $input = ''; $expected = ''; @@ -397,9 +402,9 @@ public function testClosingAngleBracketInAllowedAttributeValue() */ public function testAllowedAttributeValueMayEndWithEquals() { - $filter = $this->_filter; + $filter = $this->_filter; $tagsAllowed = [ - 'element' => 'attribute' + 'element' => 'attribute', ]; $filter->setTagsAllowed($tagsAllowed); $input = 'contents'; @@ -411,10 +416,10 @@ public function testAllowedAttributeValueMayEndWithEquals() */ public function testDisallowedAttributesSplitOverMultipleLinesShouldBeStripped() { - $filter = $this->_filter; + $filter = $this->_filter; $tagsAllowed = ['a' => 'href']; $filter->setTagsAllowed($tagsAllowed); - $input = '_filter; + $filter = $this->_filter; $input = 'äöüäöü'; $expected = 'äöüäöü'; $this->assertEquals($expected, $filter($input)); - $input = 'äöüäöü'; - $input = iconv("UTF-8", "ISO-8859-1", $input); - $output = $filter($input); + $input = 'äöüäöü'; + $input = iconv("UTF-8", "ISO-8859-1", $input); + $output = $filter($input); $this->assertNotEmpty($output); } @@ -442,14 +447,14 @@ public function testFilterIsoChars() */ public function testFilterIsoCharsInComment() { - $filter = $this->_filter; + $filter = $this->_filter; $input = 'äöüäöü'; $expected = 'äöüäöü'; $this->assertEquals($expected, $filter($input)); - $input = 'äöüäöü'; - $input = iconv("UTF-8", "ISO-8859-1", $input); - $output = $filter($input); + $input = 'äöüäöü'; + $input = iconv("UTF-8", "ISO-8859-1", $input); + $output = $filter($input); $this->assertNotEmpty($output); } @@ -458,7 +463,7 @@ public function testFilterIsoCharsInComment() */ public function testFilterSplitCommentTags() { - $filter = $this->_filter; + $filter = $this->_filter; $input = 'äöüüßüßüß<-->äöü'; $expected = 'äöüäöü'; $this->assertEquals($expected, $filter($input)); @@ -469,7 +474,7 @@ public function testFilterSplitCommentTags() */ public function testCommentWithTagInSameLine() { - $filter = $this->_filter; + $filter = $this->_filter; $input = 'test test
div-content
'; $expected = 'test test div-content'; $this->assertEquals($expected, $filter($input)); @@ -494,8 +499,8 @@ public function testMultiQuoteInput() { $filter = new StripTagsFilter( [ - 'allowTags' => 'img', - 'allowAttribs' => ['width', 'height', 'src'] + 'allowTags' => 'img', + 'allowAttribs' => ['width', 'height', 'src'], ] ); @@ -507,7 +512,7 @@ public function testMultiQuoteInput() public function badCommentProvider() { return [ - ['A B', 'A '], // Should be treated as just an open + ['A B', 'A '], // Should be treated as just an open ['A B', 'A '], // Should be treated as just an open ['A B', 'A B'], ['A B', 'A B'], @@ -523,7 +528,6 @@ public function badCommentProvider() /** * @dataProvider badCommentProvider - * * @param string $input * @param string $expected */ @@ -533,8 +537,8 @@ public function testBadCommentTags($input, $expected) } /** - * @group Laminas-10256 - */ + * @group Laminas-10256 + */ public function testNotClosedHtmlCommentAtEndOfString() { $input = 'text