From 953debdfeeed86a7d07473ed811785b2e65e6266 Mon Sep 17 00:00:00 2001 From: George Steel Date: Wed, 31 May 2023 11:24:04 +0100 Subject: [PATCH 01/32] Upgrade PHPUnit to 10.1.x and migrate config Signed-off-by: George Steel --- .gitignore | 2 +- composer.json | 4 +- composer.lock | 668 +++++++++++++++++++---------------------------- phpunit.xml.dist | 25 +- 4 files changed, 280 insertions(+), 419 deletions(-) diff --git a/.gitignore b/.gitignore index 4d6216b34..d3d699cd0 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,5 @@ /laminas-mkdoc-theme/ /phpunit.xml /vendor/ -.phpunit.result.cache +.phpunit.cache .phpcs-cache diff --git a/composer.json b/composer.json index 6b192de79..a0c578c6c 100644 --- a/composer.json +++ b/composer.json @@ -49,10 +49,10 @@ "laminas/laminas-mvc-plugin-flashmessenger": "^1.9", "laminas/laminas-navigation": "^2.18.1", "laminas/laminas-paginator": "^2.17", - "laminas/laminas-permissions-acl": "^2.14", + "laminas/laminas-permissions-acl": "^2.15", "laminas/laminas-router": "^3.11.1", "laminas/laminas-uri": "^2.10", - "phpunit/phpunit": "^9.6.8", + "phpunit/phpunit": "^10.1.3", "psalm/plugin-phpunit": "^0.18.4", "vimeo/psalm": "^5.12" }, diff --git a/composer.lock b/composer.lock index fa9b56f8a..c5d9eaf2b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8196e88e34920255fc335907afd446ce", + "content-hash": "d8c4880e9375fc4df0bb44fdb9436bf2", "packages": [ { "name": "laminas/laminas-escaper", @@ -1015,76 +1015,6 @@ }, "time": "2019-12-04T15:06:13+00:00" }, - { - "name": "doctrine/instantiator", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "shasum": "" - }, - "require": { - "php": "^8.1" - }, - "require-dev": { - "doctrine/coding-standard": "^11", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^1.2", - "phpstan/phpstan": "^1.9.4", - "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.5.27", - "vimeo/psalm": "^5.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/2.0.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2022-12-30T00:23:10+00:00" - }, { "name": "felixfbecker/advanced-json-rpc", "version": "v3.2.1", @@ -2273,20 +2203,20 @@ }, { "name": "laminas/laminas-permissions-acl", - "version": "2.14.0", + "version": "2.15.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-permissions-acl.git", - "reference": "86cecb540cf8f2e088d70d8acef1fc9203ed5023" + "reference": "ea9f6643a624b3e847f7d637eb828498654f492e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-permissions-acl/zipball/86cecb540cf8f2e088d70d8acef1fc9203ed5023", - "reference": "86cecb540cf8f2e088d70d8acef1fc9203ed5023", + "url": "https://api.github.com/repos/laminas/laminas-permissions-acl/zipball/ea9f6643a624b3e847f7d637eb828498654f492e", + "reference": "ea9f6643a624b3e847f7d637eb828498654f492e", "shasum": "" }, "require": { - "php": "~8.0.0 || ~8.1.0 || ~8.2.0" + "php": "~8.1.0 || ~8.2.0" }, "conflict": { "laminas/laminas-servicemanager": "<3.0", @@ -2294,11 +2224,11 @@ }, "require-dev": { "laminas/laminas-coding-standard": "~2.5.0", - "laminas/laminas-servicemanager": "^3.19", - "phpbench/phpbench": "^1.2", - "phpunit/phpunit": "^9.5.26", - "psalm/plugin-phpunit": "^0.18.0", - "vimeo/psalm": "^5.0" + "laminas/laminas-servicemanager": "^3.21", + "phpbench/phpbench": "^1.2.10", + "phpunit/phpunit": "^10.1.3", + "psalm/plugin-phpunit": "^0.18.4", + "vimeo/psalm": "^5.12" }, "suggest": { "laminas/laminas-servicemanager": "To support Laminas\\Permissions\\Acl\\Assertion\\AssertionManager plugin manager usage" @@ -2333,7 +2263,7 @@ "type": "community_bridge" } ], - "time": "2023-02-01T16:19:54+00:00" + "time": "2023-05-29T19:28:02+00:00" }, { "name": "laminas/laminas-router", @@ -3118,16 +3048,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.26", + "version": "10.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1" + "reference": "db1497ec8dd382e82c962f7abbe0320e4882ee4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", - "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/db1497ec8dd382e82c962f7abbe0320e4882ee4e", + "reference": "db1497ec8dd382e82c962f7abbe0320e4882ee4e", "shasum": "" }, "require": { @@ -3135,18 +3065,18 @@ "ext-libxml": "*", "ext-xmlwriter": "*", "nikic/php-parser": "^4.15", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", + "php": ">=8.1", + "phpunit/php-file-iterator": "^4.0", + "phpunit/php-text-template": "^3.0", + "sebastian/code-unit-reverse-lookup": "^3.0", + "sebastian/complexity": "^3.0", + "sebastian/environment": "^6.0", + "sebastian/lines-of-code": "^2.0", + "sebastian/version": "^4.0", "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.1" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -3155,7 +3085,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.2-dev" + "dev-main": "10.1-dev" } }, "autoload": { @@ -3183,7 +3113,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.26" + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.2" }, "funding": [ { @@ -3191,32 +3122,32 @@ "type": "github" } ], - "time": "2023-03-06T12:58:08+00:00" + "time": "2023-05-22T09:04:27+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.6", + "version": "4.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + "reference": "5647d65443818959172645e7ed999217360654b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/5647d65443818959172645e7ed999217360654b6", + "reference": "5647d65443818959172645e7ed999217360654b6", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -3243,7 +3174,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.0.2" }, "funding": [ { @@ -3251,28 +3183,28 @@ "type": "github" } ], - "time": "2021-12-02T12:48:52+00:00" + "time": "2023-05-07T09:13:23+00:00" }, { "name": "phpunit/php-invoker", - "version": "3.1.1", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "suggest": { "ext-pcntl": "*" @@ -3280,7 +3212,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -3306,7 +3238,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + "source": "https://github.com/sebastianbergmann/php-invoker/tree/4.0.0" }, "funding": [ { @@ -3314,32 +3246,32 @@ "type": "github" } ], - "time": "2020-09-28T05:58:55+00:00" + "time": "2023-02-03T06:56:09+00:00" }, { "name": "phpunit/php-text-template", - "version": "2.0.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + "reference": "9f3d3709577a527025f55bcf0f7ab8052c8bb37d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/9f3d3709577a527025f55bcf0f7ab8052c8bb37d", + "reference": "9f3d3709577a527025f55bcf0f7ab8052c8bb37d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -3365,7 +3297,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.0" }, "funding": [ { @@ -3373,32 +3305,32 @@ "type": "github" } ], - "time": "2020-10-26T05:33:50+00:00" + "time": "2023-02-03T06:56:46+00:00" }, { "name": "phpunit/php-timer", - "version": "5.0.3", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/e2a2d67966e740530f4a3343fe2e030ffdc1161d", + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -3424,7 +3356,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/php-timer/tree/6.0.0" }, "funding": [ { @@ -3432,24 +3364,23 @@ "type": "github" } ], - "time": "2020-10-26T13:16:10+00:00" + "time": "2023-02-03T06:57:52+00:00" }, { "name": "phpunit/phpunit", - "version": "9.6.8", + "version": "10.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "17d621b3aff84d0c8b62539e269e87d8d5baa76e" + "reference": "2379ebafc1737e71cdc84f402acb6b7f04198b9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/17d621b3aff84d0c8b62539e269e87d8d5baa76e", - "reference": "17d621b3aff84d0c8b62539e269e87d8d5baa76e", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2379ebafc1737e71cdc84f402acb6b7f04198b9d", + "reference": "2379ebafc1737e71cdc84f402acb6b7f04198b9d", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -3459,27 +3390,26 @@ "myclabs/deep-copy": "^1.10.1", "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", - "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.13", - "phpunit/php-file-iterator": "^3.0.5", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.5", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.2", - "sebastian/version": "^3.0.2" + "php": ">=8.1", + "phpunit/php-code-coverage": "^10.1.1", + "phpunit/php-file-iterator": "^4.0", + "phpunit/php-invoker": "^4.0", + "phpunit/php-text-template": "^3.0", + "phpunit/php-timer": "^6.0", + "sebastian/cli-parser": "^2.0", + "sebastian/code-unit": "^2.0", + "sebastian/comparator": "^5.0", + "sebastian/diff": "^5.0", + "sebastian/environment": "^6.0", + "sebastian/exporter": "^5.0", + "sebastian/global-state": "^6.0", + "sebastian/object-enumerator": "^5.0", + "sebastian/recursion-context": "^5.0", + "sebastian/type": "^4.0", + "sebastian/version": "^4.0" }, "suggest": { - "ext-soap": "To be able to generate mocks based on WSDL files", - "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + "ext-soap": "To be able to generate mocks based on WSDL files" }, "bin": [ "phpunit" @@ -3487,7 +3417,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.6-dev" + "dev-main": "10.1-dev" } }, "autoload": { @@ -3519,7 +3449,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.8" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.1.3" }, "funding": [ { @@ -3535,7 +3465,7 @@ "type": "tidelift" } ], - "time": "2023-05-11T05:14:45+00:00" + "time": "2023-05-11T05:16:22+00:00" }, { "name": "psalm/plugin-phpunit", @@ -3702,28 +3632,28 @@ }, { "name": "sebastian/cli-parser", - "version": "1.0.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/efdc130dbbbb8ef0b545a994fd811725c5282cae", + "reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -3746,7 +3676,7 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.0" }, "funding": [ { @@ -3754,32 +3684,32 @@ "type": "github" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2023-02-03T06:58:15+00:00" }, { "name": "sebastian/code-unit", - "version": "1.0.8", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/a81fee9eef0b7a76af11d121767abc44c104e503", + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -3802,7 +3732,7 @@ "homepage": "https://github.com/sebastianbergmann/code-unit", "support": { "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + "source": "https://github.com/sebastianbergmann/code-unit/tree/2.0.0" }, "funding": [ { @@ -3810,32 +3740,32 @@ "type": "github" } ], - "time": "2020-10-26T13:08:54+00:00" + "time": "2023-02-03T06:58:43+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -3857,7 +3787,7 @@ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/3.0.0" }, "funding": [ { @@ -3865,34 +3795,36 @@ "type": "github" } ], - "time": "2020-09-28T05:30:19+00:00" + "time": "2023-02-03T06:59:15+00:00" }, { "name": "sebastian/comparator", - "version": "4.0.8", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + "reference": "72f01e6586e0caf6af81297897bd112eb7e9627c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/72f01e6586e0caf6af81297897bd112eb7e9627c", + "reference": "72f01e6586e0caf6af81297897bd112eb7e9627c", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/diff": "^5.0", + "sebastian/exporter": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -3931,7 +3863,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.0" }, "funding": [ { @@ -3939,33 +3871,33 @@ "type": "github" } ], - "time": "2022-09-14T12:41:17+00:00" + "time": "2023-02-03T07:07:16+00:00" }, { "name": "sebastian/complexity", - "version": "2.0.2", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + "reference": "e67d240970c9dc7ea7b2123a6d520e334dd61dc6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/e67d240970c9dc7ea7b2123a6d520e334dd61dc6", + "reference": "e67d240970c9dc7ea7b2123a6d520e334dd61dc6", "shasum": "" }, "require": { - "nikic/php-parser": "^4.7", - "php": ">=7.3" + "nikic/php-parser": "^4.10", + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -3988,7 +3920,7 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + "source": "https://github.com/sebastianbergmann/complexity/tree/3.0.0" }, "funding": [ { @@ -3996,33 +3928,33 @@ "type": "github" } ], - "time": "2020-10-26T15:52:27+00:00" + "time": "2023-02-03T06:59:47+00:00" }, { "name": "sebastian/diff", - "version": "4.0.5", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" + "reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/912dc2fbe3e3c1e7873313cc801b100b6c68c87b", + "reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3", + "phpunit/phpunit": "^10.0", "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -4054,7 +3986,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/5.0.3" }, "funding": [ { @@ -4062,27 +3995,27 @@ "type": "github" } ], - "time": "2023-05-07T05:35:17+00:00" + "time": "2023-05-01T07:48:21+00:00" }, { "name": "sebastian/environment", - "version": "5.1.5", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + "reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/43c751b41d74f96cbbd4e07b7aec9675651e2951", + "reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "suggest": { "ext-posix": "*" @@ -4090,7 +4023,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -4109,7 +4042,7 @@ } ], "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", + "homepage": "https://github.com/sebastianbergmann/environment", "keywords": [ "Xdebug", "environment", @@ -4117,7 +4050,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/6.0.1" }, "funding": [ { @@ -4125,34 +4059,34 @@ "type": "github" } ], - "time": "2023-02-03T06:03:51+00:00" + "time": "2023-04-11T05:39:26+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.5", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + "reference": "f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0", + "reference": "f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/recursion-context": "^5.0" }, "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -4194,7 +4128,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/exporter/tree/5.0.0" }, "funding": [ { @@ -4202,38 +4136,35 @@ "type": "github" } ], - "time": "2022-09-14T06:03:37+00:00" + "time": "2023-02-03T07:06:49+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.5", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + "reference": "aab257c712de87b90194febd52e4d184551c2d44" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/aab257c712de87b90194febd52e4d184551c2d44", + "reference": "aab257c712de87b90194febd52e4d184551c2d44", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -4258,7 +4189,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.0" }, "funding": [ { @@ -4266,33 +4197,33 @@ "type": "github" } ], - "time": "2022-02-14T08:28:10+00:00" + "time": "2023-02-03T07:07:38+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.3", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + "reference": "17c4d940ecafb3d15d2cf916f4108f664e28b130" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/17c4d940ecafb3d15d2cf916f4108f664e28b130", + "reference": "17c4d940ecafb3d15d2cf916f4108f664e28b130", "shasum": "" }, "require": { - "nikic/php-parser": "^4.6", - "php": ">=7.3" + "nikic/php-parser": "^4.10", + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -4315,7 +4246,7 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.0" }, "funding": [ { @@ -4323,34 +4254,34 @@ "type": "github" } ], - "time": "2020-11-28T06:42:11+00:00" + "time": "2023-02-03T07:08:02+00:00" }, { "name": "sebastian/object-enumerator", - "version": "4.0.4", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/202d0e344a580d7f7d04b3fafce6933e59dae906", + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -4372,7 +4303,7 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/5.0.0" }, "funding": [ { @@ -4380,32 +4311,32 @@ "type": "github" } ], - "time": "2020-10-26T13:12:34+00:00" + "time": "2023-02-03T07:08:32+00:00" }, { "name": "sebastian/object-reflector", - "version": "2.0.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/24ed13d98130f0e7122df55d06c5c4942a577957", + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -4427,7 +4358,7 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + "source": "https://github.com/sebastianbergmann/object-reflector/tree/3.0.0" }, "funding": [ { @@ -4435,32 +4366,32 @@ "type": "github" } ], - "time": "2020-10-26T13:14:26+00:00" + "time": "2023-02-03T07:06:18+00:00" }, { "name": "sebastian/recursion-context", - "version": "4.0.5", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + "reference": "05909fb5bc7df4c52992396d0116aed689f93712" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/05909fb5bc7df4c52992396d0116aed689f93712", + "reference": "05909fb5bc7df4c52992396d0116aed689f93712", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -4490,7 +4421,7 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/5.0.0" }, "funding": [ { @@ -4498,87 +4429,32 @@ "type": "github" } ], - "time": "2023-02-03T06:07:39+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T06:45:17+00:00" + "time": "2023-02-03T07:05:40+00:00" }, { "name": "sebastian/type", - "version": "3.2.1", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/462699a16464c3944eefc02ebdd77882bd3925bf", + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -4601,7 +4477,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + "source": "https://github.com/sebastianbergmann/type/tree/4.0.0" }, "funding": [ { @@ -4609,29 +4485,29 @@ "type": "github" } ], - "time": "2023-02-03T06:13:03+00:00" + "time": "2023-02-03T07:10:45+00:00" }, { "name": "sebastian/version", - "version": "3.0.2", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c51fa83a5d8f43f1402e3f32a005e6262244ef17", + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -4654,7 +4530,7 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + "source": "https://github.com/sebastianbergmann/version/tree/4.0.1" }, "funding": [ { @@ -4662,7 +4538,7 @@ "type": "github" } ], - "time": "2020-09-28T06:39:44+00:00" + "time": "2023-02-07T11:34:05+00:00" }, { "name": "slevomat/coding-standard", @@ -4847,23 +4723,23 @@ }, { "name": "symfony/console", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "5aa03db8ef0a5457c316ec580e69562d97734c77" + "reference": "8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/5aa03db8ef0a5457c316ec580e69562d97734c77", - "reference": "5aa03db8ef0a5457c316ec580e69562d97734c77", + "url": "https://api.github.com/repos/symfony/console/zipball/8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7", + "reference": "8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/service-contracts": "^1.1|^2|^3", + "symfony/service-contracts": "^2.5|^3", "symfony/string": "^5.4|^6.0" }, "conflict": { @@ -4885,12 +4761,6 @@ "symfony/process": "^5.4|^6.0", "symfony/var-dumper": "^5.4|^6.0" }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, "type": "library", "autoload": { "psr-4": { @@ -4923,7 +4793,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.2.11" + "source": "https://github.com/symfony/console/tree/v6.3.0" }, "funding": [ { @@ -4939,20 +4809,20 @@ "type": "tidelift" } ], - "time": "2023-05-26T08:16:21+00:00" + "time": "2023-05-29T12:49:39+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.2.1", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e" + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", - "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", "shasum": "" }, "require": { @@ -4961,7 +4831,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -4990,7 +4860,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" }, "funding": [ { @@ -5006,20 +4876,20 @@ "type": "tidelift" } ], - "time": "2023-03-01T10:25:55+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/filesystem", - "version": "v6.2.10", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "fd588debf7d1bc16a2c84b4b3b71145d9946b894" + "reference": "97b698e1d77d356304def77a8d0cd73090b359ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/fd588debf7d1bc16a2c84b4b3b71145d9946b894", - "reference": "fd588debf7d1bc16a2c84b4b3b71145d9946b894", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/97b698e1d77d356304def77a8d0cd73090b359ea", + "reference": "97b698e1d77d356304def77a8d0cd73090b359ea", "shasum": "" }, "require": { @@ -5053,7 +4923,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.2.10" + "source": "https://github.com/symfony/filesystem/tree/v6.3.0" }, "funding": [ { @@ -5069,7 +4939,7 @@ "type": "tidelift" } ], - "time": "2023-04-18T13:46:08+00:00" + "time": "2023-05-30T17:12:32+00:00" }, { "name": "symfony/polyfill-ctype", @@ -5486,16 +5356,16 @@ }, { "name": "symfony/string", - "version": "v6.2.8", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef" + "reference": "f2e190ee75ff0f5eced645ec0be5c66fac81f51f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/193e83bbd6617d6b2151c37fff10fa7168ebddef", - "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef", + "url": "https://api.github.com/repos/symfony/string/zipball/f2e190ee75ff0f5eced645ec0be5c66fac81f51f", + "reference": "f2e190ee75ff0f5eced645ec0be5c66fac81f51f", "shasum": "" }, "require": { @@ -5506,13 +5376,13 @@ "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": "<2.0" + "symfony/translation-contracts": "<2.5" }, "require-dev": { "symfony/error-handler": "^5.4|^6.0", "symfony/http-client": "^5.4|^6.0", "symfony/intl": "^6.2", - "symfony/translation-contracts": "^2.0|^3.0", + "symfony/translation-contracts": "^2.5|^3.0", "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", @@ -5552,7 +5422,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.2.8" + "source": "https://github.com/symfony/string/tree/v6.3.0" }, "funding": [ { @@ -5568,7 +5438,7 @@ "type": "tidelift" } ], - "time": "2023-03-20T16:06:02+00:00" + "time": "2023-03-21T21:06:29+00:00" }, { "name": "theseer/tokenizer", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 69cb15d6d..504e54969 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -3,29 +3,20 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" bootstrap="./vendor/autoload.php" - convertDeprecationsToExceptions="true" - colors="true"> + colors="true" + cacheDirectory=".phpunit.cache" +> ./test/ - - - - disable - - - - - - ./src - - - - - + + + ./src + + From ddf7be248b77d15a70a7fca5105ed55cce7f399c Mon Sep 17 00:00:00 2001 From: George Steel Date: Wed, 31 May 2023 11:52:00 +0100 Subject: [PATCH 02/32] Replace and fix calls to methods and assertions removed in PHPUnit 10 Signed-off-by: George Steel --- psalm-baseline.xml | 68 ------------------- test/Helper/GravatarTest.php | 32 +++++++-- test/Helper/HeadLinkTest.php | 12 ++-- test/Helper/HeadMetaTest.php | 43 +++++++----- test/Helper/HeadScriptTest.php | 57 +++++++++------- test/Helper/HeadStyleTest.php | 30 ++++---- test/Helper/JsonTest.php | 19 +++++- test/Resolver/PrefixPathStackResolverTest.php | 20 ++---- 8 files changed, 131 insertions(+), 150 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index e94c9d9fe..6ad504dc7 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -2373,12 +2373,6 @@ - conditionalStylesheet]]> - conditionalStylesheet]]> - conditionalStylesheet]]> - conditionalStylesheet]]> - conditionalStylesheet]]> - media]]> href]]> href]]> href]]> @@ -2411,21 +2405,6 @@ - $item - $item - $item - $item - $item - $item - $item - $item - $item - $item - $item - $item - type]]> - type]]> - type]]> $modifiers $modifiers $value @@ -2439,12 +2418,6 @@ $values $values - - - - $values[$i] - $values[100] - $item $item @@ -2476,10 +2449,6 @@ type]]> type]]> type]]> - {$item->type}]]> - {$item->type}]]> - {$item->type}]]> - modifiers]]> getArrayCopy @@ -2519,23 +2488,9 @@ $values - attributes['src']]]> $items[$i] - $values[$i] - $values[$i] - $values[$i] - attributes['src']]]> - $values[0] - $values[0] - $values[0] - attributes['src']]]> - $values[5] - $values[5] - $values[5] - attributes['src']]]> - $first $item $item $items @@ -2549,22 +2504,9 @@ ]]> - attributes]]> - source]]> - type]]> - attributes]]> source]]> source]]> source]]> - attributes]]> - source]]> - type]]> - attributes]]> - source]]> - type]]> - attributes]]> - source]]> - type]]> getArrayCopy @@ -2590,15 +2532,9 @@ $values $values $values - content]]> - content]]> - content]]> $values[$i] - $values[0] - $values[1] - $values[2] $item @@ -2613,10 +2549,6 @@ content]]> content]]> - attributes]]> - content]]> - content]]> - content]]> bogusMethod diff --git a/test/Helper/GravatarTest.php b/test/Helper/GravatarTest.php index 04c6076a9..6e912614c 100644 --- a/test/Helper/GravatarTest.php +++ b/test/Helper/GravatarTest.php @@ -11,9 +11,13 @@ use ReflectionMethod; use function method_exists; +use function restore_error_handler; +use function set_error_handler; use function strtoupper; use function urlencode; +use const E_USER_DEPRECATED; + /** @psalm-suppress DeprecatedClass */ class GravatarTest extends TestCase { @@ -274,9 +278,17 @@ public function testEmailIsProperlyNormalized(): void public function testSetAttribsIsDeprecated(): void { - $this->expectDeprecation(); - - $this->helper->setAttribs([]); + set_error_handler(function ($code, $error) { + throw new Exception\RuntimeException($error, $code); + }, E_USER_DEPRECATED); + try { + $this->helper->setAttribs([]); + $this->fail('An exception was not thrown'); + } catch (Exception\RuntimeException $e) { + self::assertStringContainsString('setAttribs is deprecated', $e->getMessage()); + } finally { + restore_error_handler(); + } } public function testSetAttribsDocCommentHasDeprecated(): void @@ -289,9 +301,17 @@ public function testSetAttribsDocCommentHasDeprecated(): void public function testGetAttribsIsDeprecated(): void { - $this->expectDeprecation(); - - $this->helper->getAttribs(); + set_error_handler(function ($code, $error) { + throw new Exception\RuntimeException($error, $code); + }, E_USER_DEPRECATED); + try { + $this->helper->getAttribs(); + $this->fail('An exception was not thrown'); + } catch (Exception\RuntimeException $e) { + self::assertStringContainsString('getAttribs is deprecated', $e->getMessage()); + } finally { + restore_error_handler(); + } } public function testGetAttribsDocCommentHasDeprecated(): void diff --git a/test/Helper/HeadLinkTest.php b/test/Helper/HeadLinkTest.php index 300787187..fb9d4b68b 100644 --- a/test/Helper/HeadLinkTest.php +++ b/test/Helper/HeadLinkTest.php @@ -229,8 +229,8 @@ public function testStylesheetAttributesGetSet(): void { $this->helper->setStylesheet('/styles.css', 'projection', 'ie6'); $item = $this->helper->getValue(); - $this->assertObjectHasAttribute('media', $item); - $this->assertObjectHasAttribute('conditionalStylesheet', $item); + $this->assertObjectHasProperty('media', $item); + $this->assertObjectHasProperty('conditionalStylesheet', $item); $this->assertEquals('projection', $item->media); $this->assertEquals('ie6', $item->conditionalStylesheet); @@ -240,7 +240,7 @@ public function testConditionalStylesheetNotCreatedByDefault(): void { $this->helper->setStylesheet('/styles.css'); $item = $this->helper->getValue(); - $this->assertObjectHasAttribute('conditionalStylesheet', $item); + $this->assertObjectHasProperty('conditionalStylesheet', $item); $this->assertFalse($item->conditionalStylesheet); $attributeEscaper = $this->attributeEscaper; @@ -256,7 +256,7 @@ public function testConditionalStylesheetCreationOccursWhenRequested(): void { $this->helper->setStylesheet('/styles.css', 'screen', 'ie6'); $item = $this->helper->getValue(); - $this->assertObjectHasAttribute('conditionalStylesheet', $item); + $this->assertObjectHasProperty('conditionalStylesheet', $item); $this->assertEquals('ie6', $item->conditionalStylesheet); $attributeEscaper = $this->attributeEscaper; @@ -271,7 +271,7 @@ public function testConditionalStylesheetCreationNoIE(): void { $this->helper->setStylesheet('/styles.css', 'screen', '!IE'); $item = $this->helper->getValue(); - $this->assertObjectHasAttribute('conditionalStylesheet', $item); + $this->assertObjectHasProperty('conditionalStylesheet', $item); $this->assertEquals('!IE', $item->conditionalStylesheet); $attributeEscaper = $this->attributeEscaper; @@ -286,7 +286,7 @@ public function testConditionalStylesheetCreationNoIEWidthSpaces(): void { $this->helper->setStylesheet('/styles.css', 'screen', '! IE'); $item = $this->helper->getValue(); - $this->assertObjectHasAttribute('conditionalStylesheet', $item); + $this->assertObjectHasProperty('conditionalStylesheet', $item); $this->assertEquals('! IE', $item->conditionalStylesheet); $attributeEscaper = $this->attributeEscaper; diff --git a/test/Helper/HeadMetaTest.php b/test/Helper/HeadMetaTest.php index f245e1e87..a0ff212fc 100644 --- a/test/Helper/HeadMetaTest.php +++ b/test/Helper/HeadMetaTest.php @@ -99,14 +99,16 @@ protected function executeOverloadAppend(string $type): void for ($i = 0; $i < 3; ++$i) { $string .= ' foo'; $this->helper->$action('keywords', $string); - $values = $this->helper->getArrayCopy(); - $this->assertEquals($i + 1, count($values)); + $values = $this->helper->getContainer()->getArrayCopy(); + $this->assertCount($i + 1, $values); $item = $values[$i]; - $this->assertObjectHasAttribute('type', $item); - $this->assertObjectHasAttribute('modifiers', $item); - $this->assertObjectHasAttribute('content', $item); - $this->assertObjectHasAttribute($item->type, $item); + self::assertIsObject($item); + $this->assertObjectHasProperty('type', $item); + $this->assertObjectHasProperty('modifiers', $item); + $this->assertObjectHasProperty('content', $item); + self::assertIsString($item->type); + $this->assertObjectHasProperty($item->type, $item); $this->assertEquals('keywords', $item->{$item->type}); $this->assertEquals($string, $item->content); } @@ -119,14 +121,15 @@ protected function executeOverloadPrepend(string $type): void for ($i = 0; $i < 3; ++$i) { $string .= ' foo'; $this->helper->$action('keywords', $string); - $values = $this->helper->getArrayCopy(); - $this->assertEquals($i + 1, count($values)); + $values = $this->helper->getContainer()->getArrayCopy(); + self::assertCount($i + 1, $values); $item = array_shift($values); - - $this->assertObjectHasAttribute('type', $item); - $this->assertObjectHasAttribute('modifiers', $item); - $this->assertObjectHasAttribute('content', $item); - $this->assertObjectHasAttribute($item->type, $item); + self::assertIsObject($item); + $this->assertObjectHasProperty('type', $item); + $this->assertObjectHasProperty('modifiers', $item); + $this->assertObjectHasProperty('content', $item); + self::assertIsString($item->type); + $this->assertObjectHasProperty($item->type, $item); $this->assertEquals('keywords', $item->{$item->type}); $this->assertEquals($string, $item->content); } @@ -142,14 +145,18 @@ protected function executeOverloadSet(string $type): void $string .= ' foo'; } $this->helper->$setAction('keywords', $string); + $values = $this->helper->getArrayCopy(); + self::assertIsArray($values); $this->assertCount(1, $values); $item = array_shift($values); + self::assertIsObject($item); - $this->assertObjectHasAttribute('type', $item); - $this->assertObjectHasAttribute('modifiers', $item); - $this->assertObjectHasAttribute('content', $item); - $this->assertObjectHasAttribute($item->type, $item); + $this->assertObjectHasProperty('type', $item); + $this->assertObjectHasProperty('modifiers', $item); + $this->assertObjectHasProperty('content', $item); + self::assertIsString($item->type); + $this->assertObjectHasProperty($item->type, $item); $this->assertEquals('keywords', $item->{$item->type}); $this->assertEquals($string, $item->content); } @@ -203,7 +210,7 @@ public function testCanBuildMetaTagsWithAttributes(): void $this->helper->setName('keywords', 'foo bar', ['lang' => 'us_en', 'scheme' => 'foo', 'bogus' => 'unused']); $value = $this->helper->getValue(); - $this->assertObjectHasAttribute('modifiers', $value); + $this->assertObjectHasProperty('modifiers', $value); $modifiers = $value->modifiers; $this->assertArrayHasKey('lang', $modifiers); $this->assertEquals('us_en', $modifiers['lang']); diff --git a/test/Helper/HeadScriptTest.php b/test/Helper/HeadScriptTest.php index 4a18089f7..6b4ae2ef8 100644 --- a/test/Helper/HeadScriptTest.php +++ b/test/Helper/HeadScriptTest.php @@ -90,14 +90,17 @@ private function executeOverloadAppend(string $type): void for ($i = 0; $i < 3; ++$i) { $string .= ' foo'; $this->helper->$action($string); - $values = $this->helper->getArrayCopy(); - $this->assertCount($i + 1, $values); + $values = $this->helper->getContainer()->getArrayCopy(); + self::assertCount($i + 1, $values); + $item = $values[$i]; + self::assertIsObject($item); if ('file' === $type) { - $this->assertEquals($string, $values[$i]->attributes['src']); + self::assertIsArray($item->attributes); + self::assertEquals($string, $item->attributes['src']); } elseif ('script' === $type) { - $this->assertEquals($string, $values[$i]->source); + self::assertEquals($string, $item->source); } - $this->assertEquals('text/javascript', $values[$i]->type); + self::assertEquals('text/javascript', $item->type); } } @@ -108,15 +111,17 @@ private function executeOverloadPrepend(string $type): void for ($i = 0; $i < 3; ++$i) { $string .= ' foo'; $this->helper->$action($string); - $values = $this->helper->getArrayCopy(); - $this->assertCount($i + 1, $values); + $values = $this->helper->getContainer()->getArrayCopy(); + self::assertCount($i + 1, $values); $first = array_shift($values); + self::assertIsObject($first); if ('file' === $type) { - $this->assertEquals($string, $first->attributes['src']); + self::assertIsArray($first->attributes); + self::assertEquals($string, $first->attributes['src']); } elseif ('script' === $type) { - $this->assertEquals($string, $first->source); + self::assertEquals($string, $first->source); } - $this->assertEquals('text/javascript', $first->type); + self::assertEquals('text/javascript', $first->type); } } @@ -129,14 +134,17 @@ private function executeOverloadSet(string $type): void $string .= ' foo'; } $this->helper->$action($string); - $values = $this->helper->getArrayCopy(); - $this->assertCount(1, $values); + $values = $this->helper->getContainer()->getArrayCopy(); + self::assertCount(1, $values); + $item = $values[0]; + self::assertIsObject($item); if ('file' === $type) { - $this->assertEquals($string, $values[0]->attributes['src']); + self::assertIsArray($item->attributes); + self::assertEquals($string, $item->attributes['src']); } elseif ('script' === $type) { - $this->assertEquals($string, $values[0]->source); + self::assertEquals($string, $item->source); } - $this->assertEquals('text/javascript', $values[0]->type); + self::assertEquals('text/javascript', $item->type); } private function executeOverloadOffsetSet(string $type): void @@ -144,14 +152,17 @@ private function executeOverloadOffsetSet(string $type): void $action = 'offsetSet' . $this->inflectAction($type); $string = 'foo'; $this->helper->$action(5, $string); - $values = $this->helper->getArrayCopy(); - $this->assertCount(1, $values); + $values = $this->helper->getContainer()->getArrayCopy(); + self::assertCount(1, $values); + $item = $values[5]; + self::assertIsObject($item); if ('file' === $type) { - $this->assertEquals($string, $values[5]->attributes['src']); + self::assertIsArray($item->attributes); + self::assertEquals($string, $item->attributes['src']); } elseif ('script' === $type) { - $this->assertEquals($string, $values[5]->source); + self::assertEquals($string, $item->source); } - $this->assertEquals('text/javascript', $values[5]->type); + self::assertEquals('text/javascript', $item->type); } public function testOverloadAppendFileAppendsScriptsToStack(): void @@ -228,16 +239,16 @@ public function testHeadScriptAppropriatelySetsScriptItems(): void $item = $items[$i]; switch ($i) { case 0: - $this->assertObjectHasAttribute('source', $item); + $this->assertObjectHasProperty('source', $item); $this->assertEquals('bar', $item->source); break; case 1: - $this->assertObjectHasAttribute('attributes', $item); + $this->assertObjectHasProperty('attributes', $item); $this->assertTrue(isset($item->attributes['src'])); $this->assertEquals('foo', $item->attributes['src']); break; case 2: - $this->assertObjectHasAttribute('source', $item); + $this->assertObjectHasProperty('source', $item); $this->assertEquals('baz', $item->source); break; } diff --git a/test/Helper/HeadStyleTest.php b/test/Helper/HeadStyleTest.php index df244fdfe..dbf7c5889 100644 --- a/test/Helper/HeadStyleTest.php +++ b/test/Helper/HeadStyleTest.php @@ -79,8 +79,8 @@ public function testOverloadAppendStyleAppendsStyleToStack(): void $item = $values[$i]; $this->assertInstanceOf(stdClass::class, $item); - $this->assertObjectHasAttribute('content', $item); - $this->assertObjectHasAttribute('attributes', $item); + $this->assertObjectHasProperty('content', $item); + $this->assertObjectHasProperty('attributes', $item); $this->assertEquals($string, $item->content); } } @@ -96,8 +96,8 @@ public function testOverloadPrependStylePrependsStyleToStack(): void $item = array_shift($values); $this->assertInstanceOf(stdClass::class, $item); - $this->assertObjectHasAttribute('content', $item); - $this->assertObjectHasAttribute('attributes', $item); + $this->assertObjectHasProperty('content', $item); + $this->assertObjectHasProperty('attributes', $item); $this->assertEquals($string, $item->content); } } @@ -115,8 +115,8 @@ public function testOverloadSetOversitesStack(): void $item = array_shift($values); $this->assertInstanceOf(stdClass::class, $item); - $this->assertObjectHasAttribute('content', $item); - $this->assertObjectHasAttribute('attributes', $item); + $this->assertObjectHasProperty('content', $item); + $this->assertObjectHasProperty('attributes', $item); $this->assertEquals($string, $item->content); } @@ -131,7 +131,7 @@ public function testCanBuildStyleTagsWithAttributes(): void ]); $value = $this->helper->getValue(); - $this->assertObjectHasAttribute('attributes', $value); + $this->assertObjectHasProperty('attributes', $value); $attributes = $value->attributes; $this->assertTrue(isset($attributes['lang'])); @@ -183,11 +183,17 @@ public function testHeadStyleProxiesProperly(): void $this->helper->__invoke($style1, 'SET') ->__invoke($style2, 'PREPEND') ->__invoke($style3, 'APPEND'); - $this->assertEquals(3, count($this->helper)); - $values = $this->helper->getArrayCopy(); - $this->assertStringContainsString($values[0]->content, $style2); - $this->assertStringContainsString($values[1]->content, $style1); - $this->assertStringContainsString($values[2]->content, $style3); + self::assertCount(3, $this->helper); + $values = $this->helper->getContainer()->getArrayCopy(); + self::assertIsObject($values[0]); + self::assertIsObject($values[1]); + self::assertIsObject($values[2]); + self::assertIsString($values[0]->content); + self::assertIsString($values[1]->content); + self::assertIsString($values[2]->content); + self::assertStringContainsString($values[0]->content, $style2); + self::assertStringContainsString($values[1]->content, $style1); + self::assertStringContainsString($values[2]->content, $style3); } public function testToStyleGeneratesValidHtml(): void diff --git a/test/Helper/JsonTest.php b/test/Helper/JsonTest.php index a4de7196b..99f4f7e94 100644 --- a/test/Helper/JsonTest.php +++ b/test/Helper/JsonTest.php @@ -7,9 +7,15 @@ use Laminas\Http\Header\HeaderInterface; use Laminas\Http\Response; use Laminas\Json\Json as JsonFormatter; +use Laminas\View\Exception\RuntimeException; use Laminas\View\Helper\Json as JsonHelper; use PHPUnit\Framework\TestCase; +use function restore_error_handler; +use function set_error_handler; + +use const E_USER_DEPRECATED; + class JsonTest extends TestCase { private Response $response; @@ -50,8 +56,17 @@ public function testJsonHelperReturnsJsonEncodedString(): void public function testThatADeprecationErrorIsTriggeredWhenExpressionFinderOptionIsUsed(): void { - $this->expectDeprecation(); - $this->helper->__invoke(['foo'], ['enableJsonExprFinder' => true]); + set_error_handler(function ($code, $error) { + throw new RuntimeException($error, $code); + }, E_USER_DEPRECATED); + try { + $this->helper->__invoke(['foo'], ['enableJsonExprFinder' => true]); + $this->fail('An exception was not thrown'); + } catch (RuntimeException $e) { + self::assertStringContainsString('Json Expression functionality is deprecated', $e->getMessage()); + } finally { + restore_error_handler(); + } } public function testThatADeprecationErrorIsNotTriggeredWhenExpressionFinderOptionIsNotUsed(): void diff --git a/test/Resolver/PrefixPathStackResolverTest.php b/test/Resolver/PrefixPathStackResolverTest.php index ad6fbfda3..14ecd992f 100644 --- a/test/Resolver/PrefixPathStackResolverTest.php +++ b/test/Resolver/PrefixPathStackResolverTest.php @@ -5,7 +5,7 @@ namespace LaminasTest\View\Resolver; use Laminas\View\Resolver\PrefixPathStackResolver; -use Laminas\View\Resolver\ResolverInterface; +use Laminas\View\Resolver\TemplateMapResolver; use PHPUnit\Framework\TestCase; use function realpath; @@ -63,21 +63,11 @@ public function testResolveWithCongruentPrefix(): void public function testSetCustomPathStackResolver(): void { - $mockResolver = $this->createMock(ResolverInterface::class); - $mockResolver->expects(self::exactly(3)) - ->method('resolve') - ->withConsecutive( - ['/bar', null], - ['/baz', null], - ['/tab', null] - )->willReturnOnConsecutiveCalls( - '1111', - '2222', - false - ); - $resolver = new PrefixPathStackResolver([ - 'foo' => $mockResolver, + 'foo' => new TemplateMapResolver([ + '/bar' => '1111', + '/baz' => '2222', + ]), ]); $this->assertSame('1111', $resolver->resolve('foo/bar')); From bb6788ca17af42e27413bf630cac255271cb7bf0 Mon Sep 17 00:00:00 2001 From: George Steel Date: Wed, 31 May 2023 12:39:35 +0100 Subject: [PATCH 03/32] Rename test assets to avoid being interpreted as test cases and cleanup resulting psalm issues Signed-off-by: George Steel --- psalm-baseline.xml | 49 ----------------- test/Helper/Navigation/AbstractHelperTest.php | 2 +- ...{AbstractTest.php => AbstractTestCase.php} | 24 +++++---- test/Helper/Navigation/BreadcrumbsTest.php | 2 +- test/Helper/Navigation/LinksTest.php | 2 +- test/Helper/Navigation/MenuTest.php | 2 +- test/Helper/Navigation/NavigationTest.php | 2 +- test/Helper/Navigation/SitemapTest.php | 2 +- test/Helper/PartialLoopTest.php | 52 +++++++------------ ...rTest.php => PartialLoopBogusIterator.php} | 2 +- ...eratorTest.php => PartialLoopIterator.php} | 7 +-- ...php => PartialLoopIteratorWithToArray.php} | 13 ++--- ...t.php => PartialLoopRecursiveIterator.php} | 25 +++------ ....php => PartialLoopToArrayImplementor.php} | 2 +- test/HelperPluginManagerTest.php | 29 +++-------- 15 files changed, 62 insertions(+), 153 deletions(-) rename test/Helper/Navigation/{AbstractTest.php => AbstractTestCase.php} (90%) rename test/Helper/TestAsset/{BogusIteratorTest.php => PartialLoopBogusIterator.php} (72%) rename test/Helper/TestAsset/{IteratorTest.php => PartialLoopIterator.php} (89%) rename test/Helper/TestAsset/{IteratorWithToArrayTest.php => PartialLoopIteratorWithToArray.php} (84%) rename test/Helper/TestAsset/{RecursiveIteratorTest.php => PartialLoopRecursiveIterator.php} (58%) rename test/Helper/TestAsset/{ToArrayTest.php => PartialLoopToArrayImplementor.php} (88%) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 6ad504dc7..35614eda9 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -2603,28 +2603,6 @@ _helper]]> - - - getDependencyConfig())]]> - - - $app - - - bootstrap - getMvcEvent - loadModules - setRouteMatch - - - null - null - null - - - - - @@ -2936,12 +2914,6 @@ $value $value - - $item - $item - $item - $item - $result $result @@ -3006,10 +2978,6 @@ addPath addPath - - new TestAsset\BogusIteratorTest($data) - new TestAsset\BogusIteratorTest($data) - addPath addPath @@ -3045,8 +3013,6 @@ message]]> - $data - $data $key $key $key @@ -3138,16 +3104,6 @@ Bar - - - Iterator - - - - - Iterator - - $value @@ -3162,11 +3118,6 @@ MockContainer - - - Iterator - - getDependencyConfig())]]> diff --git a/test/Helper/Navigation/AbstractHelperTest.php b/test/Helper/Navigation/AbstractHelperTest.php index 885e69761..3d4e6ee4c 100644 --- a/test/Helper/Navigation/AbstractHelperTest.php +++ b/test/Helper/Navigation/AbstractHelperTest.php @@ -10,7 +10,7 @@ /** * @psalm-suppress MissingConstructor */ -class AbstractHelperTest extends AbstractTest +class AbstractHelperTest extends AbstractTestCase { /** * View helper diff --git a/test/Helper/Navigation/AbstractTest.php b/test/Helper/Navigation/AbstractTestCase.php similarity index 90% rename from test/Helper/Navigation/AbstractTest.php rename to test/Helper/Navigation/AbstractTestCase.php index 7870d222f..b0e7307bd 100644 --- a/test/Helper/Navigation/AbstractTest.php +++ b/test/Helper/Navigation/AbstractTestCase.php @@ -5,6 +5,8 @@ namespace LaminasTest\View\Helper\Navigation; use Laminas\I18n\Translator\Translator; +use Laminas\ModuleManager\ModuleManager; +use Laminas\Mvc\Application; use Laminas\Mvc\Service\ServiceManagerConfig; use Laminas\Navigation\Navigation; use Laminas\Navigation\Service\DefaultNavigationFactory; @@ -30,7 +32,7 @@ * * @psalm-suppress MissingConstructor */ -abstract class AbstractTest extends TestCase +abstract class AbstractTestCase extends TestCase { /** @var ServiceManager */ protected $serviceManager; @@ -136,17 +138,19 @@ protected function setUp(): void } $sm->setService('ApplicationConfig', $smConfig); - $sm->get('ModuleManager')->loadModules(); - $sm->get('Application')->bootstrap(); + $moduleManager = $sm->get('ModuleManager'); + self::assertInstanceOf(ModuleManager::class, $moduleManager); + $moduleManager->loadModules(); + $application = $sm->get('Application'); + self::assertInstanceOf(Application::class, $application); + $application->bootstrap(); $sm->setFactory('Navigation', DefaultNavigationFactory::class); $sm->setService('nav1', $this->nav1); $sm->setService('nav2', $this->nav2); $sm->setAllowOverride(false); - - $app = $this->serviceManager->get('Application'); - $app->getMvcEvent()->setRouteMatch(new RouteMatch([ + $application->getMvcEvent()->setRouteMatch(new RouteMatch([ 'controller' => 'post', 'action' => 'view', 'id' => '1337', @@ -175,7 +179,7 @@ protected function getAcl(): array $acl->addResource(new GenericResource('guest_foo')); $acl->addResource(new GenericResource('member_foo'), 'guest_foo'); - $acl->addResource(new GenericResource('admin_foo', 'member_foo')); + $acl->addResource(new GenericResource('admin_foo')); $acl->addResource(new GenericResource('special_foo'), 'member_foo'); $acl->allow('guest', 'guest_foo'); @@ -201,7 +205,7 @@ protected function getTranslator(): Translator ]; $translator = new Translator(); $translator->getPluginManager()->setService('default', $loader); - $translator->addTranslationFile('default', null); + $translator->addTranslationFile('default', __FILE__); return $translator; } @@ -230,8 +234,8 @@ protected function getTranslatorWithTextDomain(): Translator $translator = new Translator(); $translator->getPluginManager()->setService('default1', $loader1); $translator->getPluginManager()->setService('default2', $loader2); - $translator->addTranslationFile('default1', null, 'LaminasTest_1'); - $translator->addTranslationFile('default2', null, 'LaminasTest_2'); + $translator->addTranslationFile('default1', __FILE__, 'LaminasTest_1'); + $translator->addTranslationFile('default2', __FILE__, 'LaminasTest_2'); return $translator; } } diff --git a/test/Helper/Navigation/BreadcrumbsTest.php b/test/Helper/Navigation/BreadcrumbsTest.php index 086f54a06..539b5317c 100644 --- a/test/Helper/Navigation/BreadcrumbsTest.php +++ b/test/Helper/Navigation/BreadcrumbsTest.php @@ -13,7 +13,7 @@ use function substr; use function trim; -class BreadcrumbsTest extends AbstractTest +class BreadcrumbsTest extends AbstractTestCase { /** * View helper. diff --git a/test/Helper/Navigation/LinksTest.php b/test/Helper/Navigation/LinksTest.php index 5a1e830e0..72438e7a6 100644 --- a/test/Helper/Navigation/LinksTest.php +++ b/test/Helper/Navigation/LinksTest.php @@ -27,7 +27,7 @@ /** * @psalm-suppress MissingConstructor */ -class LinksTest extends AbstractTest +class LinksTest extends AbstractTestCase { /** * View helper diff --git a/test/Helper/Navigation/MenuTest.php b/test/Helper/Navigation/MenuTest.php index 797aa0e14..0d8994317 100644 --- a/test/Helper/Navigation/MenuTest.php +++ b/test/Helper/Navigation/MenuTest.php @@ -20,7 +20,7 @@ /** * @psalm-suppress MissingConstructor */ -class MenuTest extends AbstractTest +class MenuTest extends AbstractTestCase { /** * View helper. diff --git a/test/Helper/Navigation/NavigationTest.php b/test/Helper/Navigation/NavigationTest.php index 2ce626115..0144a7021 100644 --- a/test/Helper/Navigation/NavigationTest.php +++ b/test/Helper/Navigation/NavigationTest.php @@ -29,7 +29,7 @@ /** * @psalm-suppress MissingConstructor */ -class NavigationTest extends AbstractTest +class NavigationTest extends AbstractTestCase { /** * View helper diff --git a/test/Helper/Navigation/SitemapTest.php b/test/Helper/Navigation/SitemapTest.php index f6843c84d..6bc260844 100644 --- a/test/Helper/Navigation/SitemapTest.php +++ b/test/Helper/Navigation/SitemapTest.php @@ -19,7 +19,7 @@ /** * @psalm-suppress MissingConstructor */ -class SitemapTest extends AbstractTest +class SitemapTest extends AbstractTestCase { /** @var array */ private array $oldServer = []; diff --git a/test/Helper/PartialLoopTest.php b/test/Helper/PartialLoopTest.php index 45a3978c9..32f7a1181 100644 --- a/test/Helper/PartialLoopTest.php +++ b/test/Helper/PartialLoopTest.php @@ -59,7 +59,7 @@ public function testPartialLoopIteratesOverIterator(): void ['message' => 'baz'], ['message' => 'bat'], ]; - $o = new TestAsset\IteratorTest($data); + $o = new TestAsset\PartialLoopIterator($data); $view = new View(); $view->resolver()->addPath($this->basePath . '/application/views/scripts'); @@ -74,12 +74,12 @@ public function testPartialLoopIteratesOverIterator(): void public function testPartialLoopIteratesOverRecursiveIterator(): void { - $rIterator = new TestAsset\RecursiveIteratorTest(); + $rIterator = new TestAsset\PartialLoopRecursiveIterator(); for ($i = 0; $i < 5; ++$i) { $data = [ 'message' => 'foo' . $i, ]; - $rIterator->addItem(new TestAsset\IteratorTest($data)); + $rIterator->addItem(new TestAsset\PartialLoopIterator($data)); } $view = new View(); @@ -88,7 +88,7 @@ public function testPartialLoopIteratesOverRecursiveIterator(): void $result = $this->helper->__invoke('partialLoop.phtml', $rIterator); foreach ($rIterator as $item) { - foreach ($item as $key => $value) { + foreach ($item as $value) { $this->assertStringContainsString($value, $result, var_export($value, true)); } } @@ -96,21 +96,14 @@ public function testPartialLoopIteratesOverRecursiveIterator(): void public function testPartialLoopThrowsExceptionWithBadIterator(): void { - $data = [ - ['message' => 'foo'], - ['message' => 'bar'], - ['message' => 'baz'], - ['message' => 'bat'], - ]; - $o = new TestAsset\BogusIteratorTest($data); - $view = new View(); $view->resolver()->addPath($this->basePath . '/application/views/scripts'); $this->helper->setView($view); $this->expectException(Exception\InvalidArgumentException::class); $this->expectExceptionMessage('PartialLoop helper requires iterable data'); - $this->helper->__invoke('partialLoop.phtml', $o); + /** @psalm-suppress InvalidArgument */ + $this->helper->__invoke('partialLoop.phtml', new TestAsset\PartialLoopBogusIterator()); } public function testPassingNullDataThrowsException(): void @@ -158,7 +151,7 @@ public function testShouldAllowIteratingOverObjectsImplementingToArray(): void ['message' => 'baz'], ['message' => 'bat'], ]; - $o = new TestAsset\ToArrayTest($data); + $o = new TestAsset\PartialLoopToArrayImplementor($data); $view = new View(); $view->resolver()->addPath($this->basePath . '/application/views/scripts'); @@ -179,7 +172,7 @@ public function testShouldNotCastToArrayIfObjectIsTraversable(): void new TestAsset\IteratorWithToArrayTestContainer(['message' => 'baz']), new TestAsset\IteratorWithToArrayTestContainer(['message' => 'bat']), ]; - $o = new TestAsset\IteratorWithToArrayTest($data); + $o = new TestAsset\PartialLoopIteratorWithToArray($data); $view = new View(); $view->resolver()->addPath($this->basePath . '/application/views/scripts'); @@ -242,12 +235,12 @@ public function testPartialLoopPartialCounterResets(): void public function testShouldNotConvertToArrayRecursivelyIfModelIsTraversable(): void { - $rIterator = new TestAsset\RecursiveIteratorTest(); + $rIterator = new TestAsset\PartialLoopRecursiveIterator(); for ($i = 0; $i < 5; ++$i) { $data = [ 'message' => 'foo' . $i, ]; - $rIterator->addItem(new TestAsset\IteratorTest($data)); + $rIterator->addItem(new TestAsset\PartialLoopIterator($data)); } $view = new View(); @@ -360,7 +353,7 @@ public function testPartialLoopIteratesOverIteratorInLoopMethod(): void ['message' => 'baz'], ['message' => 'bat'], ]; - $o = new TestAsset\IteratorTest($data); + $o = new TestAsset\PartialLoopIterator($data); $view = new View(); $view->resolver()->addPath($this->basePath . '/application/views/scripts'); @@ -375,12 +368,12 @@ public function testPartialLoopIteratesOverIteratorInLoopMethod(): void public function testPartialLoopIteratesOverRecursiveIteratorInLoopMethod(): void { - $rIterator = new TestAsset\RecursiveIteratorTest(); + $rIterator = new TestAsset\PartialLoopRecursiveIterator(); for ($i = 0; $i < 5; ++$i) { $data = [ 'message' => 'foo' . $i, ]; - $rIterator->addItem(new TestAsset\IteratorTest($data)); + $rIterator->addItem(new TestAsset\PartialLoopIterator($data)); } $view = new View(); @@ -397,20 +390,13 @@ public function testPartialLoopIteratesOverRecursiveIteratorInLoopMethod(): void public function testPartialLoopThrowsExceptionWithBadIteratorInLoopMethod(): void { - $data = [ - ['message' => 'foo'], - ['message' => 'bar'], - ['message' => 'baz'], - ['message' => 'bat'], - ]; - $o = new TestAsset\BogusIteratorTest($data); - $view = new View(); $view->resolver()->addPath($this->basePath . '/application/views/scripts'); $this->helper->setView($view); $this->expectException(Exception\InvalidArgumentException::class); $this->expectExceptionMessage('PartialLoop helper requires iterable data'); - $this->helper->Loop('partialLoop.phtml', $o); + /** @psalm-suppress InvalidArgument */ + $this->helper->Loop('partialLoop.phtml', new TestAsset\PartialLoopBogusIterator()); } public function testPassingNullDataThrowsExceptionInLoopMethod(): void @@ -452,7 +438,7 @@ public function testShouldAllowIteratingOverObjectsImplementingToArrayInLoopMeth ['message' => 'baz'], ['message' => 'bat'], ]; - $o = new TestAsset\ToArrayTest($data); + $o = new TestAsset\PartialLoopToArrayImplementor($data); $view = new View(); $view->resolver()->addPath($this->basePath . '/application/views/scripts'); @@ -473,7 +459,7 @@ public function testShouldNotCastToArrayIfObjectIsTraversableInLoopMethod(): voi new TestAsset\IteratorWithToArrayTestContainer(['message' => 'baz']), new TestAsset\IteratorWithToArrayTestContainer(['message' => 'bat']), ]; - $o = new TestAsset\IteratorWithToArrayTest($data); + $o = new TestAsset\PartialLoopIteratorWithToArray($data); $view = new View(); $view->resolver()->addPath($this->basePath . '/application/views/scripts'); @@ -536,12 +522,12 @@ public function testPartialLoopPartialCounterResetsInLoopMethod(): void public function testShouldNotConvertToArrayRecursivelyIfModelIsTraversableInLoopMethod(): void { - $rIterator = new TestAsset\RecursiveIteratorTest(); + $rIterator = new TestAsset\PartialLoopRecursiveIterator(); for ($i = 0; $i < 5; ++$i) { $data = [ 'message' => 'foo' . $i, ]; - $rIterator->addItem(new TestAsset\IteratorTest($data)); + $rIterator->addItem(new TestAsset\PartialLoopIterator($data)); } $view = new View(); diff --git a/test/Helper/TestAsset/BogusIteratorTest.php b/test/Helper/TestAsset/PartialLoopBogusIterator.php similarity index 72% rename from test/Helper/TestAsset/BogusIteratorTest.php rename to test/Helper/TestAsset/PartialLoopBogusIterator.php index 061548f3b..ad1704a7c 100644 --- a/test/Helper/TestAsset/BogusIteratorTest.php +++ b/test/Helper/TestAsset/PartialLoopBogusIterator.php @@ -4,6 +4,6 @@ namespace LaminasTest\View\Helper\TestAsset; -class BogusIteratorTest +class PartialLoopBogusIterator { } diff --git a/test/Helper/TestAsset/IteratorTest.php b/test/Helper/TestAsset/PartialLoopIterator.php similarity index 89% rename from test/Helper/TestAsset/IteratorTest.php rename to test/Helper/TestAsset/PartialLoopIterator.php index 2adfe5e5c..f339a68cc 100644 --- a/test/Helper/TestAsset/IteratorTest.php +++ b/test/Helper/TestAsset/PartialLoopIterator.php @@ -14,11 +14,12 @@ /** * @template T + * @implements Iterator */ -class IteratorTest implements Iterator +class PartialLoopIterator implements Iterator { /** @var array */ - public $items; + public array $items; /** @param array $array */ public function __construct(array $array) @@ -27,7 +28,7 @@ public function __construct(array $array) } /** - * @return T|false + * @return T|null */ #[ReturnTypeWillChange] public function current() diff --git a/test/Helper/TestAsset/IteratorWithToArrayTest.php b/test/Helper/TestAsset/PartialLoopIteratorWithToArray.php similarity index 84% rename from test/Helper/TestAsset/IteratorWithToArrayTest.php rename to test/Helper/TestAsset/PartialLoopIteratorWithToArray.php index 7453c4629..c35fb58ab 100644 --- a/test/Helper/TestAsset/IteratorWithToArrayTest.php +++ b/test/Helper/TestAsset/PartialLoopIteratorWithToArray.php @@ -14,11 +14,12 @@ /** * @template T + * @implements Iterator */ -class IteratorWithToArrayTest implements Iterator +class PartialLoopIteratorWithToArray implements Iterator { /** @var array */ - public $items; + public array $items; /** @param array $array */ public function __construct(array $array) @@ -33,7 +34,7 @@ public function toArray(): array } /** - * @return T|false + * @return T */ #[ReturnTypeWillChange] public function current() @@ -41,11 +42,7 @@ public function current() return current($this->items); } - /** - * @return array-key|null - */ - #[ReturnTypeWillChange] - public function key() + public function key(): int|string { return key($this->items); } diff --git a/test/Helper/TestAsset/RecursiveIteratorTest.php b/test/Helper/TestAsset/PartialLoopRecursiveIterator.php similarity index 58% rename from test/Helper/TestAsset/RecursiveIteratorTest.php rename to test/Helper/TestAsset/PartialLoopRecursiveIterator.php index 028ccc03e..585276a7e 100644 --- a/test/Helper/TestAsset/RecursiveIteratorTest.php +++ b/test/Helper/TestAsset/PartialLoopRecursiveIterator.php @@ -5,61 +5,48 @@ namespace LaminasTest\View\Helper\TestAsset; use Iterator; -use ReturnTypeWillChange; // phpcs:ignore use function current; use function key; use function next; use function reset; -class RecursiveIteratorTest implements Iterator +/** @implements Iterator */ +class PartialLoopRecursiveIterator implements Iterator { /** @var array */ - public $items; + public array $items; public function __construct() { $this->items = []; } - /** - * @return $this - */ - public function addItem(Iterator $iterator): self + public function addItem(Iterator $iterator): void { $this->items[] = $iterator; - return $this; } - /** @return Iterator|false */ - #[ReturnTypeWillChange] - public function current() + public function current(): Iterator { return current($this->items); } - /** - * @return array-key|null - */ - #[ReturnTypeWillChange] - public function key() + public function key(): int|string { return key($this->items); } - #[ReturnTypeWillChange] public function next(): void { next($this->items); } - #[ReturnTypeWillChange] public function rewind(): void { reset($this->items); } - #[ReturnTypeWillChange] public function valid(): bool { return current($this->items) !== false; diff --git a/test/Helper/TestAsset/ToArrayTest.php b/test/Helper/TestAsset/PartialLoopToArrayImplementor.php similarity index 88% rename from test/Helper/TestAsset/ToArrayTest.php rename to test/Helper/TestAsset/PartialLoopToArrayImplementor.php index 704a87394..48dbaa22b 100644 --- a/test/Helper/TestAsset/ToArrayTest.php +++ b/test/Helper/TestAsset/PartialLoopToArrayImplementor.php @@ -4,7 +4,7 @@ namespace LaminasTest\View\Helper\TestAsset; -class ToArrayTest +class PartialLoopToArrayImplementor { private array $data; diff --git a/test/HelperPluginManagerTest.php b/test/HelperPluginManagerTest.php index cad1ada77..1bd19e922 100644 --- a/test/HelperPluginManagerTest.php +++ b/test/HelperPluginManagerTest.php @@ -9,8 +9,8 @@ use Laminas\Mvc\I18n\Translator as MvcTranslator; use Laminas\ServiceManager\Config; use Laminas\ServiceManager\Exception\InvalidServiceException; +use Laminas\ServiceManager\Exception\ServiceNotFoundException; use Laminas\ServiceManager\ServiceManager; -use Laminas\View\Exception\InvalidHelperException; use Laminas\View\Helper\Doctype; use Laminas\View\Helper\HeadTitle; use Laminas\View\Helper\HelperInterface; @@ -20,8 +20,6 @@ use Laminas\View\Renderer\PhpRenderer; use PHPUnit\Framework\TestCase; -use function method_exists; - class HelperPluginManagerTest extends TestCase { private HelperPluginManager $helpers; @@ -57,25 +55,21 @@ public function testNoRendererInjectedInHelperWhenRendererIsNotPresent(): void $this->assertNull($helper->getView()); } - public function testRegisteringInvalidHelperRaisesException(): void + public function testRegisteringInvalidHelperRaisesInvalidServiceException(): void { $helpers = new HelperPluginManager(new ServiceManager(), [ 'factories' => [ 'test' => fn() => $this, ], ]); - $this->expectException($this->getServiceNotFoundException($helpers)); + $this->expectException(InvalidServiceException::class); $helpers->get('test'); } - public function testLoadingInvalidHelperRaisesException(): void + public function testRequestingAnUnregisteredHelperRaisesServiceNotFoundException(): void { - $helpers = new HelperPluginManager(new ServiceManager(), [ - 'invokables' => [ - 'test' => static::class, - ], - ]); - $this->expectException($this->getServiceNotFoundException($helpers)); + $helpers = new HelperPluginManager(new ServiceManager(), []); + $this->expectException(ServiceNotFoundException::class); $helpers->get('test'); } @@ -196,15 +190,4 @@ public function testDoctypeFactoryExists(): void { self::assertTrue($this->helpers->has(Doctype::class)); } - - /** - * @psalm-return InvalidHelperException::class|InvalidServiceException::class - */ - private function getServiceNotFoundException(HelperPluginManager $manager): string - { - if (method_exists($manager, 'configure')) { - return InvalidServiceException::class; - } - return InvalidHelperException::class; - } } From c0ba1d6bc124e36f1b9125af504b447b9643a0e7 Mon Sep 17 00:00:00 2001 From: George Steel Date: Wed, 31 May 2023 13:02:43 +0100 Subject: [PATCH 04/32] Static data providers and annotations to attributes Signed-off-by: George Steel --- psalm-baseline.xml | 18 ------------ test/Helper/AbstractHtmlElementTest.php | 15 +++++----- test/Helper/AssetTest.php | 16 +++++------ test/Helper/BasePathTest.php | 5 ++-- test/Helper/EscapeCssTest.php | 7 ++--- test/Helper/EscapeHtmlAttrTest.php | 7 ++--- test/Helper/EscapeHtmlTest.php | 7 ++--- test/Helper/EscapeJsTest.php | 7 ++--- test/Helper/EscapeUrlTest.php | 7 ++--- test/Helper/EscaperEncodingsTrait.php | 6 ++-- test/Helper/FlashMessengerTest.php | 24 ---------------- test/Helper/HeadLinkTest.php | 6 ++-- test/Helper/HeadScriptTest.php | 9 +++--- test/Helper/Navigation/SitemapTest.php | 9 +++--- test/Helper/Service/AssetFactoryTest.php | 9 +++--- test/Helper/Service/BasePathFactoryTest.php | 5 ++-- test/Helper/Service/IdentityFactoryTest.php | 5 ++-- test/HelperPluginManagerCompatibilityTest.php | 6 ++-- test/Model/ViewModelTest.php | 28 ++++++++----------- test/PhpRendererTest.php | 16 ++++------- test/Renderer/JsonRendererTest.php | 17 ++++------- test/Resolver/PrefixPathStackResolverTest.php | 7 ++--- .../Resolver/RelativeFallbackResolverTest.php | 5 ++-- test/Resolver/TemplatePathStackTest.php | 16 +++++------ test/Strategy/JsonStrategyTest.php | 10 +++---- 25 files changed, 101 insertions(+), 166 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 35614eda9..d0aff1057 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -2356,9 +2356,6 @@ $value $value - - iterable - @@ -2466,9 +2463,6 @@ - - public function booleanAttributeDataProvider(): Generator - @@ -2500,9 +2494,6 @@ $values $values - - ]]> - source]]> source]]> @@ -3170,15 +3161,6 @@ 'factories' => $factories, ])]]> - - $target - $target - - - $alias - $aliases - $target - ]]> diff --git a/test/Helper/AbstractHtmlElementTest.php b/test/Helper/AbstractHtmlElementTest.php index 371304435..d295e6c5c 100644 --- a/test/Helper/AbstractHtmlElementTest.php +++ b/test/Helper/AbstractHtmlElementTest.php @@ -4,15 +4,16 @@ namespace LaminasTest\View\Helper; +use Laminas\View\Helper\AbstractHtmlElement; use Laminas\View\Renderer\PhpRenderer; use LaminasTest\View\Helper\TestAsset\ConcreteElementHelper; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use function sprintf; -/** - * @covers \Laminas\View\Helper\AbstractHtmlElement - */ +#[CoversClass(AbstractHtmlElement::class)] class AbstractHtmlElementTest extends TestCase { /** @var ConcreteElementHelper */ @@ -38,10 +39,8 @@ public function testThatAttributesWithANullValueArePresentedAsAnEmptyString(): v self::assertStringContainsString($expect, $this->helper->compileAttributes(['something' => null])); } - /** - * @param scalar|scalar[]|null $attributeValue - * @dataProvider attributeValuesProvider - */ + /** @param scalar|scalar[]|null $attributeValue */ + #[DataProvider('attributeValuesProvider')] public function testThatAttributesOfVariousNativeTypesProduceTheExpectedAttributeString( $attributeValue, string $expected, @@ -55,7 +54,7 @@ public function testThatAttributesOfVariousNativeTypesProduceTheExpectedAttribut } /** @return array */ - public function attributeValuesProvider(): array + public static function attributeValuesProvider(): array { return [ 'Integer' => [1, '"1"', '"1"'], diff --git a/test/Helper/AssetTest.php b/test/Helper/AssetTest.php index 5e5c312d6..f8810c8f9 100644 --- a/test/Helper/AssetTest.php +++ b/test/Helper/AssetTest.php @@ -8,12 +8,12 @@ use Laminas\View\Exception; use Laminas\View\Helper\Asset; use Laminas\View\HelperPluginManager; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class AssetTest extends TestCase { - /** @var array */ - protected $resourceMap = [ + private const RESOURCE_MAP = [ 'css/style.css' => 'css/style-3a97ff4ee3.css', 'js/vendor.js' => 'js/vendor-a507086eba.js', ]; @@ -24,7 +24,7 @@ protected function setUp(): void { parent::setUp(); - $this->asset = new Asset($this->resourceMap); + $this->asset = new Asset(self::RESOURCE_MAP); } public function testHelperPluginManagerReturnsAssetHelper(): void @@ -51,10 +51,8 @@ public function testInvalidAssetName(): void $this->asset->__invoke('unknown'); } - /** - * @dataProvider assets - * @param non-empty-string $name - */ + /** @param non-empty-string $name */ + #[DataProvider('assets')] public function testInvokeResult(string $name, string $expected): void { $result = $this->asset->__invoke($name); @@ -65,10 +63,10 @@ public function testInvokeResult(string $name, string $expected): void /** * @return array */ - public function assets(): array + public static function assets(): array { $data = []; - foreach ($this->resourceMap as $key => $value) { + foreach (self::RESOURCE_MAP as $key => $value) { $data[] = [$key, $value]; } return $data; diff --git a/test/Helper/BasePathTest.php b/test/Helper/BasePathTest.php index bb88f9037..9939233f6 100644 --- a/test/Helper/BasePathTest.php +++ b/test/Helper/BasePathTest.php @@ -6,12 +6,13 @@ use Laminas\View\Exception\RuntimeException; use Laminas\View\Helper\BasePath; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class BasePathTest extends TestCase { /** @return array */ - public function basePathDataProvider(): array + public static function basePathDataProvider(): array { return [ ['/foo', null, '/foo'], @@ -32,7 +33,7 @@ public function basePathDataProvider(): array ]; } - /** @dataProvider basePathDataProvider */ + #[DataProvider('basePathDataProvider')] public function testBasePathHelperYieldsExpectedOutput(string $basePath, ?string $argument, string $expect): void { $helper = new BasePath($basePath); diff --git a/test/Helper/EscapeCssTest.php b/test/Helper/EscapeCssTest.php index 2657f1caa..bfe246020 100644 --- a/test/Helper/EscapeCssTest.php +++ b/test/Helper/EscapeCssTest.php @@ -7,6 +7,7 @@ use Laminas\Escaper\Escaper; use Laminas\Escaper\Exception\InvalidArgumentException; use Laminas\View\Helper\EscapeCss as EscapeHelper; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use stdClass; @@ -165,10 +166,8 @@ public function testSettingEncodingToEmptyStringShouldThrowException(): void $this->helper->getEscaper(); } - /** - * @dataProvider supportedEncodingsProvider - * @param non-empty-string $encoding - */ + /** @param non-empty-string $encoding */ + #[DataProvider('supportedEncodingsProvider')] public function testSettingValidEncodingShouldNotThrowExceptions(string $encoding): void { $this->helper->setEncoding($encoding); diff --git a/test/Helper/EscapeHtmlAttrTest.php b/test/Helper/EscapeHtmlAttrTest.php index 5b2924c3f..d473eddac 100644 --- a/test/Helper/EscapeHtmlAttrTest.php +++ b/test/Helper/EscapeHtmlAttrTest.php @@ -7,6 +7,7 @@ use Laminas\Escaper\Escaper; use Laminas\View\Exception\InvalidArgumentException; use Laminas\View\Helper\EscapeHtmlAttr as EscapeHelper; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use stdClass; @@ -165,10 +166,8 @@ public function testSettingEncodingToEmptyStringShouldThrowException(): void $this->helper->getEscaper(); } - /** - * @dataProvider supportedEncodingsProvider - * @param non-empty-string $encoding - */ + /** @param non-empty-string $encoding */ + #[DataProvider('supportedEncodingsProvider')] public function testSettingValidEncodingShouldNotThrowExceptions(string $encoding): void { $this->helper->setEncoding($encoding); diff --git a/test/Helper/EscapeHtmlTest.php b/test/Helper/EscapeHtmlTest.php index 519a26360..07285da1f 100644 --- a/test/Helper/EscapeHtmlTest.php +++ b/test/Helper/EscapeHtmlTest.php @@ -7,6 +7,7 @@ use Laminas\Escaper\Escaper; use Laminas\View\Exception\InvalidArgumentException; use Laminas\View\Helper\EscapeHtml as EscapeHelper; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use stdClass; @@ -162,10 +163,8 @@ public function testSettingEncodingToEmptyStringShouldThrowException(): void $this->helper->getEscaper(); } - /** - * @dataProvider supportedEncodingsProvider - * @param non-empty-string $encoding - */ + /** @param non-empty-string $encoding */ + #[DataProvider('supportedEncodingsProvider')] public function testSettingValidEncodingShouldNotThrowExceptions(string $encoding): void { $this->helper->setEncoding($encoding); diff --git a/test/Helper/EscapeJsTest.php b/test/Helper/EscapeJsTest.php index 122805e53..d8a90a174 100644 --- a/test/Helper/EscapeJsTest.php +++ b/test/Helper/EscapeJsTest.php @@ -7,6 +7,7 @@ use Laminas\Escaper\Escaper; use Laminas\View\Exception\InvalidArgumentException; use Laminas\View\Helper\EscapeJs as EscapeHelper; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use stdClass; @@ -165,10 +166,8 @@ public function testSettingEncodingToEmptyStringShouldThrowException(): void $this->helper->getEscaper(); } - /** - * @dataProvider supportedEncodingsProvider - * @param non-empty-string $encoding - */ + /** @param non-empty-string $encoding */ + #[DataProvider('supportedEncodingsProvider')] public function testSettingValidEncodingShouldNotThrowExceptions(string $encoding): void { $this->helper->setEncoding($encoding); diff --git a/test/Helper/EscapeUrlTest.php b/test/Helper/EscapeUrlTest.php index 08f8dcabe..64b9fcaf7 100644 --- a/test/Helper/EscapeUrlTest.php +++ b/test/Helper/EscapeUrlTest.php @@ -7,6 +7,7 @@ use Laminas\Escaper\Escaper; use Laminas\View\Exception\InvalidArgumentException; use Laminas\View\Helper\EscapeUrl as EscapeHelper; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use stdClass; @@ -165,10 +166,8 @@ public function testSettingEncodingToEmptyStringShouldThrowException(): void $this->helper->getEscaper(); } - /** - * @dataProvider supportedEncodingsProvider - * @param non-empty-string $encoding - */ + /** @param non-empty-string $encoding */ + #[DataProvider('supportedEncodingsProvider')] public function testSettingValidEncodingShouldNotThrowExceptions(string $encoding): void { $this->helper->setEncoding($encoding); diff --git a/test/Helper/EscaperEncodingsTrait.php b/test/Helper/EscaperEncodingsTrait.php index d7af16360..932e66240 100644 --- a/test/Helper/EscaperEncodingsTrait.php +++ b/test/Helper/EscaperEncodingsTrait.php @@ -9,7 +9,7 @@ trait EscaperEncodingsTrait { /** @var list */ - private array $supportedEncodings = [ + private static array $supportedEncodings = [ 'iso-8859-1', 'iso8859-1', 'iso-8859-5', @@ -47,9 +47,9 @@ trait EscaperEncodingsTrait ]; /** @return iterable> */ - public function supportedEncodingsProvider(): iterable + public static function supportedEncodingsProvider(): iterable { - foreach ($this->supportedEncodings as $encoding) { + foreach (self::$supportedEncodings as $encoding) { assert(! empty($encoding)); yield $encoding => [$encoding]; } diff --git a/test/Helper/FlashMessengerTest.php b/test/Helper/FlashMessengerTest.php index 608f573be..453a957a3 100644 --- a/test/Helper/FlashMessengerTest.php +++ b/test/Helper/FlashMessengerTest.php @@ -436,9 +436,6 @@ public function testCanSetAutoEscape(): void $this->assertTrue($this->helper->getAutoEscape()); } - /** - * @covers \Laminas\View\Helper\FlashMessenger::render - */ public function testMessageIsEscapedByDefault(): void { $helper = new FlashMessenger(); @@ -450,9 +447,6 @@ public function testMessageIsEscapedByDefault(): void $this->assertSame($displayAssertion, $display); } - /** - * @covers \Laminas\View\Helper\FlashMessenger::render - */ public function testMessageIsNotEscapedWhenAutoEscapeIsFalse(): void { $helper = new FlashMessenger(); @@ -465,9 +459,6 @@ public function testMessageIsNotEscapedWhenAutoEscapeIsFalse(): void $this->assertSame($displayAssertion, $display); } - /** - * @covers \Laminas\View\Helper\FlashMessenger::render - */ public function testCanSetAutoEscapeOnRender(): void { $helper = new FlashMessenger(); @@ -479,9 +470,6 @@ public function testCanSetAutoEscapeOnRender(): void $this->assertSame($displayAssertion, $display); } - /** - * @covers \Laminas\View\Helper\FlashMessenger::render - */ public function testRenderUsesCurrentAutoEscapeByDefault(): void { $helper = new FlashMessenger(); @@ -503,9 +491,6 @@ public function testRenderUsesCurrentAutoEscapeByDefault(): void $this->assertSame($displayAssertion, $display); } - /** - * @covers \Laminas\View\Helper\FlashMessenger::renderCurrent - */ public function testCurrentMessageIsEscapedByDefault(): void { $this->helper->addMessage('Foo
bar'); @@ -515,9 +500,6 @@ public function testCurrentMessageIsEscapedByDefault(): void $this->assertSame($displayAssertion, $display); } - /** - * @covers \Laminas\View\Helper\FlashMessenger::renderCurrent - */ public function testCurrentMessageIsNotEscapedWhenAutoEscapeIsFalse(): void { $this->helper->addMessage('Foo
bar'); @@ -528,9 +510,6 @@ public function testCurrentMessageIsNotEscapedWhenAutoEscapeIsFalse(): void $this->assertSame($displayAssertion, $display); } - /** - * @covers \Laminas\View\Helper\FlashMessenger::renderCurrent - */ public function testCanSetAutoEscapeOnRenderCurrent(): void { $this->helper->addMessage('Foo
bar'); @@ -540,9 +519,6 @@ public function testCanSetAutoEscapeOnRenderCurrent(): void $this->assertSame($displayAssertion, $display); } - /** - * @covers \Laminas\View\Helper\FlashMessenger::renderCurrent - */ public function testRenderCurrentUsesCurrentAutoEscapeByDefault(): void { $this->helper->addMessage('Foo
bar'); diff --git a/test/Helper/HeadLinkTest.php b/test/Helper/HeadLinkTest.php index fb9d4b68b..f47ea7a3e 100644 --- a/test/Helper/HeadLinkTest.php +++ b/test/Helper/HeadLinkTest.php @@ -10,6 +10,7 @@ use Laminas\View\Helper\EscapeHtmlAttr; use Laminas\View\Helper\HeadLink; use Laminas\View\Renderer\PhpRenderer as View; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use function array_fill; @@ -297,7 +298,8 @@ public function testConditionalStylesheetCreationNoIEWidthSpaces(): void $this->assertStringContainsString('', $string); } - public function argumentCountProvider(): iterable + /** @return array */ + public static function argumentCountProvider(): array { return [ 'One' => [1], @@ -305,7 +307,7 @@ public function argumentCountProvider(): iterable ]; } - /** @dataProvider argumentCountProvider */ + #[DataProvider('argumentCountProvider')] public function testSettingAlternateWithTooFewArgsRaisesException(int $argumentCount): void { $arguments = array_fill(0, $argumentCount, 'foo'); diff --git a/test/Helper/HeadScriptTest.php b/test/Helper/HeadScriptTest.php index 6b4ae2ef8..46dbf0257 100644 --- a/test/Helper/HeadScriptTest.php +++ b/test/Helper/HeadScriptTest.php @@ -9,6 +9,7 @@ use Laminas\View; use Laminas\View\Helper; use Laminas\View\Helper\Doctype; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use function array_shift; @@ -536,8 +537,8 @@ public function testSupportsNonceAttribute(): void ); } - /** @return Generator */ - public function booleanAttributeDataProvider(): Generator + /** @return Generator> */ + public static function booleanAttributeDataProvider(): Generator { $values = ['async', 'defer', 'nomodule']; @@ -546,7 +547,7 @@ public function booleanAttributeDataProvider(): Generator } } - /** @dataProvider booleanAttributeDataProvider */ + #[DataProvider('booleanAttributeDataProvider')] public function testBooleanAttributesUseTheKeyNameAsTheValue(string $attribute): void { ($this->helper)()->appendScript( @@ -561,7 +562,7 @@ public function testBooleanAttributesUseTheKeyNameAsTheValue(string $attribute): ); } - /** @dataProvider booleanAttributeDataProvider */ + #[DataProvider('booleanAttributeDataProvider')] public function testBooleanAttributesCanBeAppliedToModules(string $attribute): void { ($this->helper)()->appendScript( diff --git a/test/Helper/Navigation/SitemapTest.php b/test/Helper/Navigation/SitemapTest.php index 6bc260844..9e84b6aca 100644 --- a/test/Helper/Navigation/SitemapTest.php +++ b/test/Helper/Navigation/SitemapTest.php @@ -8,6 +8,7 @@ use Laminas\View; use Laminas\View\Helper\BasePath; use Laminas\View\Helper\Navigation\Sitemap; +use PHPUnit\Framework\Attributes\DataProvider; use Throwable; // phpcs:ignore use function count; @@ -206,7 +207,7 @@ public function testDisablingValidators(): void } /** @return array, 2:string}> */ - public function invalidServerUrlDataProvider(): array + public static function invalidServerUrlDataProvider(): array { return [ 'muppets' => [ @@ -217,10 +218,8 @@ public function invalidServerUrlDataProvider(): array ]; } - /** - * @param class-string $expectedType - * @dataProvider invalidServerUrlDataProvider - */ + /** @param class-string $expectedType */ + #[DataProvider('invalidServerUrlDataProvider')] public function testSetServerUrlRequiresValidUri( string $invalidServerUrl, string $expectedType, diff --git a/test/Helper/Service/AssetFactoryTest.php b/test/Helper/Service/AssetFactoryTest.php index ddbcd3df1..807d0c19d 100644 --- a/test/Helper/Service/AssetFactoryTest.php +++ b/test/Helper/Service/AssetFactoryTest.php @@ -8,6 +8,7 @@ use Laminas\View\Exception; use Laminas\View\Helper\Asset; use Laminas\View\Helper\Service\AssetFactory; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class AssetFactoryTest extends TestCase @@ -80,7 +81,7 @@ public function testThatAnExceptionWillBeThrownWhenTheResourceMapIsSetToANonArra /** * @return array}> */ - public function validConfigProvider(): array + public static function validConfigProvider(): array { return [ 'No View Helper Configuration' => [ @@ -122,10 +123,8 @@ public function validConfigProvider(): array ]; } - /** - * @dataProvider validConfigProvider - * @param array $config - */ + /** @param array $config */ + #[DataProvider('validConfigProvider')] public function testThatAnExceptionWillNotBeThrownWhenGivenUnsetOrEmptyArrayConfiguration(array $config): void { $container = $this->getServices($config); diff --git a/test/Helper/Service/BasePathFactoryTest.php b/test/Helper/Service/BasePathFactoryTest.php index 708137079..b93e3b3e5 100644 --- a/test/Helper/Service/BasePathFactoryTest.php +++ b/test/Helper/Service/BasePathFactoryTest.php @@ -8,6 +8,7 @@ use Laminas\View\Helper\BasePath; use Laminas\View\Helper\Service\BasePathFactory; use Laminas\View\HelperPluginManager; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class BasePathFactoryTest extends TestCase @@ -21,7 +22,7 @@ protected function setUp(): void } /** @return array */ - public function configDataProvider(): array + public static function configDataProvider(): array { return [ 'Empty Config' => [[]], @@ -31,7 +32,7 @@ public function configDataProvider(): array ]; } - /** @dataProvider configDataProvider */ + #[DataProvider('configDataProvider')] public function testFactoryWithVariousConfigurationSetups(array $config): void { $this->container->setService('config', $config); diff --git a/test/Helper/Service/IdentityFactoryTest.php b/test/Helper/Service/IdentityFactoryTest.php index 3b92991d3..400d31d5a 100644 --- a/test/Helper/Service/IdentityFactoryTest.php +++ b/test/Helper/Service/IdentityFactoryTest.php @@ -10,6 +10,7 @@ use Laminas\View\Helper\Identity; use Laminas\View\Helper\Service\IdentityFactory; use LaminasTest\View\Helper\TestAsset\AuthenticationServiceStub; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class IdentityFactoryTest extends TestCase @@ -29,7 +30,7 @@ public function testThatAHelperCanBeCreatedWhenThereAreNoAuthenticationServicesF } /** @return array */ - public function serviceNameProvider(): array + public static function serviceNameProvider(): array { // phpcs:disable WebimpressCodingStandard.Formatting.StringClassReference return [ @@ -46,7 +47,7 @@ private function authService(?string $id): AuthenticationServiceStub return new AuthenticationServiceStub($id); } - /** @dataProvider serviceNameProvider */ + #[DataProvider('serviceNameProvider')] public function testThatAFoundAuthenticationServiceWillBeUsed(string $serviceId): void { $service = $this->authService('james bond'); diff --git a/test/HelperPluginManagerCompatibilityTest.php b/test/HelperPluginManagerCompatibilityTest.php index 85ce4f6ae..c2ae2b425 100644 --- a/test/HelperPluginManagerCompatibilityTest.php +++ b/test/HelperPluginManagerCompatibilityTest.php @@ -55,13 +55,15 @@ protected function getV2InvalidPluginException(): string /** * @psalm-return Generator */ - public function aliasProvider(): Generator + public static function aliasProvider(): Generator { - $pluginManager = $this->getPluginManager(); + $pluginManager = self::getPluginManager(); $r = new ReflectionProperty($pluginManager, 'aliases'); $aliases = $r->getValue($pluginManager); + self::assertIsArray($aliases); foreach ($aliases as $alias => $target) { + self::assertIsString($target); // Skipping conditionally since it depends on laminas-mvc if (! class_exists(ControllerPluginManager::class) && strpos($target, '\\FlashMessenger')) { continue; diff --git a/test/Model/ViewModelTest.php b/test/Model/ViewModelTest.php index a2a66922f..fba20da43 100644 --- a/test/Model/ViewModelTest.php +++ b/test/Model/ViewModelTest.php @@ -11,6 +11,7 @@ use Laminas\View\Model\ViewModel; use Laminas\View\Variables as ViewVariables; use LaminasTest\View\Model\TestAsset\Variable; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use stdClass; @@ -369,7 +370,7 @@ public function testCloneWithArray(): void * 2: null|string, * }> */ - public function variableValue(): array + public static function variableValue(): array { return [ // variables default expected @@ -392,26 +393,21 @@ public function variableValue(): array ]; } - /** - * @dataProvider variableValue - * @param array|ArrayObject $variables - * @param string|null $default - * @param string|null $expected - */ - public function testGetVariableSetByConstruct($variables, $default, $expected): void - { + /** @param array|ArrayObject $variables */ + #[DataProvider('variableValue')] + public function testGetVariableSetByConstruct( + iterable $variables, + string|null $default, + string|null $expected + ): void { $model = new ViewModel($variables); self::assertSame($expected, $model->getVariable('foo', $default)); } - /** - * @dataProvider variableValue - * @param array|ArrayObject $variables - * @param string|null $default - * @param string|null $expected - */ - public function testGetVariableSetBySetter($variables, $default, $expected): void + /** @param array|ArrayObject $variables */ + #[DataProvider('variableValue')] + public function testGetVariableSetBySetter(iterable $variables, string|null $default, string|null $expected): void { $model = new ViewModel(); $model->setVariables($variables); diff --git a/test/PhpRendererTest.php b/test/PhpRendererTest.php index 9f0fde52c..4af9a58e1 100644 --- a/test/PhpRendererTest.php +++ b/test/PhpRendererTest.php @@ -23,6 +23,7 @@ use LaminasTest\View\TestAsset\Invokable; use LaminasTest\View\TestAsset\SharedInstance; use LaminasTest\View\TestAsset\Uninvokable; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use ReflectionObject; use stdClass; @@ -126,7 +127,7 @@ public function testPassingValidStringClassToSetHelperPluginManagerCreatesIt(): /** * @psalm-return array */ - public function invalidPluginManagers(): array + public static function invalidPluginManagers(): array { return [ [true], @@ -137,11 +138,8 @@ public function invalidPluginManagers(): array ]; } - /** - * @dataProvider invalidPluginManagers - * @param mixed $plugins - */ - public function testPassingInvalidArgumentToSetHelperPluginManagerRaisesException($plugins): void + #[DataProvider('invalidPluginManagers')] + public function testPassingInvalidArgumentToSetHelperPluginManagerRaisesException(mixed $plugins): void { $this->expectException(ExceptionInterface::class); $this->expectExceptionMessage('must extend'); @@ -359,7 +357,7 @@ public function testRendererRaisesExceptionIfResolverCannotResolveTemplate(): vo * @return string[][] * @psalm-return array{0: array{0: '/does/not/exists'}, 1: array{0: '.'}} */ - public function invalidTemplateFiles(): array + public static function invalidTemplateFiles(): array { return [ ['/does/not/exists'], @@ -367,9 +365,7 @@ public function invalidTemplateFiles(): array ]; } - /** - * @dataProvider invalidTemplateFiles - */ + #[DataProvider('invalidTemplateFiles')] public function testRendererRaisesExceptionIfResolvedTemplateIsInvalid(string $template): void { $resolver = new TemplateMapResolver([ diff --git a/test/Renderer/JsonRendererTest.php b/test/Renderer/JsonRendererTest.php index db55521d8..d360e5ab1 100644 --- a/test/Renderer/JsonRendererTest.php +++ b/test/Renderer/JsonRendererTest.php @@ -9,6 +9,7 @@ use Laminas\View\Model\JsonModel; use Laminas\View\Model\ViewModel; use Laminas\View\Renderer\JsonRenderer; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use stdClass; @@ -101,7 +102,7 @@ public function testCanMergeChildModelsWithoutCaptureToValues(): void /** * @psalm-return array */ - public function getNonObjectModels(): array + public static function getNonObjectModels(): array { return [ ['string'], @@ -112,11 +113,8 @@ public function getNonObjectModels(): array ]; } - /** - * @dataProvider getNonObjectModels - * @param mixed $model - */ - public function testRendersNonObjectModelAsJson($model): void + #[DataProvider('getNonObjectModels')] + public function testRendersNonObjectModelAsJson(mixed $model): void { $expected = json_encode($model, JSON_THROW_ON_ERROR); /** @psalm-suppress MixedArgument $test */ @@ -183,11 +181,8 @@ public function testRendersViewModelsWithoutChildrenWithJsonpCallback(): void $this->assertEquals($expected, $test); } - /** - * @dataProvider getNonObjectModels - * @param mixed $model - */ - public function testRendersNonObjectModelAsJsonWithJsonpCallback($model): void + #[DataProvider('getNonObjectModels')] + public function testRendersNonObjectModelAsJsonWithJsonpCallback(mixed $model): void { $expected = 'callback(' . json_encode($model, JSON_THROW_ON_ERROR) . ');'; $this->renderer->setJsonpCallback('callback'); diff --git a/test/Resolver/PrefixPathStackResolverTest.php b/test/Resolver/PrefixPathStackResolverTest.php index 14ecd992f..2ceff477a 100644 --- a/test/Resolver/PrefixPathStackResolverTest.php +++ b/test/Resolver/PrefixPathStackResolverTest.php @@ -6,15 +6,12 @@ use Laminas\View\Resolver\PrefixPathStackResolver; use Laminas\View\Resolver\TemplateMapResolver; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use function realpath; -/** - * Tests for {@see \Laminas\View\Resolver\PrefixPathStackResolver} - * - * @covers \Laminas\View\Resolver\PrefixPathStackResolver - */ +#[CoversClass(PrefixPathStackResolver::class)] class PrefixPathStackResolverTest extends TestCase { private string $basePath; diff --git a/test/Resolver/RelativeFallbackResolverTest.php b/test/Resolver/RelativeFallbackResolverTest.php index 22ecabcc4..6fd8e15f7 100644 --- a/test/Resolver/RelativeFallbackResolverTest.php +++ b/test/Resolver/RelativeFallbackResolverTest.php @@ -12,14 +12,13 @@ use Laminas\View\Resolver\ResolverInterface; use Laminas\View\Resolver\TemplateMapResolver; use Laminas\View\Resolver\TemplatePathStack; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use stdClass; use function realpath; -/** - * @covers \Laminas\View\Resolver\RelativeFallbackResolver - */ +#[CoversClass(RelativeFallbackResolver::class)] class RelativeFallbackResolverTest extends TestCase { public function testReturnsResourceFromTheSameNameSpaceWithMapResolver(): void diff --git a/test/Resolver/TemplatePathStackTest.php b/test/Resolver/TemplatePathStackTest.php index 77928ebc4..636366e26 100644 --- a/test/Resolver/TemplatePathStackTest.php +++ b/test/Resolver/TemplatePathStackTest.php @@ -7,6 +7,7 @@ use ArrayObject; use Laminas\View\Exception; use Laminas\View\Resolver\TemplatePathStack; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use stdClass; @@ -176,7 +177,7 @@ public function testReturnsPathWithStreamProtocolWhenStreamWrapperEnabled(): voi /** * @psalm-return array */ - public function invalidOptions(): array + public static function invalidOptions(): array { return [ [true], @@ -187,11 +188,8 @@ public function invalidOptions(): array ]; } - /** - * @param mixed $options - * @dataProvider invalidOptions - */ - public function testSettingOptionsWithInvalidArgumentRaisesException($options): void + #[DataProvider('invalidOptions')] + public function testSettingOptionsWithInvalidArgumentRaisesException(mixed $options): void { $this->expectException(Exception\ExceptionInterface::class); /** @psalm-suppress MixedArgument */ @@ -201,7 +199,7 @@ public function testSettingOptionsWithInvalidArgumentRaisesException($options): /** * @return array|ArrayObject}> */ - public function validOptions(): array + public static function validOptions(): array { $options = [ 'lfi_protection' => false, @@ -216,8 +214,8 @@ public function validOptions(): array /** * @param array|ArrayObject $options - * @dataProvider validOptions */ + #[DataProvider('validOptions')] public function testAllowsSettingOptions($options): void { $options['script_paths'] = $this->paths; @@ -235,8 +233,8 @@ public function testAllowsSettingOptions($options): void /** * @param array|ArrayObject $options - * @dataProvider validOptions */ + #[DataProvider('validOptions')] public function testAllowsPassingOptionsToConstructor($options): void { $options['script_paths'] = $this->paths; diff --git a/test/Strategy/JsonStrategyTest.php b/test/Strategy/JsonStrategyTest.php index 214dbfbfd..0daa7efb3 100644 --- a/test/Strategy/JsonStrategyTest.php +++ b/test/Strategy/JsonStrategyTest.php @@ -14,6 +14,7 @@ use Laminas\View\Renderer\JsonRenderer; use Laminas\View\Strategy\JsonStrategy; use Laminas\View\ViewEvent; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use function iterator_to_array; @@ -308,7 +309,7 @@ public function testCharsetIsMutable(): void * @return string[][] * @psalm-return array{utf-16: array{0: 'utf-16'}, utf-32: array{0: 'utf-32'}} */ - public function multibyteCharsets(): array + public static function multibyteCharsets(): array { return [ 'utf-16' => ['utf-16'], @@ -316,11 +317,8 @@ public function multibyteCharsets(): array ]; } - /** - * @dataProvider multibyteCharsets - * @param string $charset - */ - public function testContentTransferEncodingHeaderSetToBinaryForSpecificMultibyteCharsets($charset): void + #[DataProvider('multibyteCharsets')] + public function testContentTransferEncodingHeaderSetToBinaryForSpecificMultibyteCharsets(string $charset): void { $this->strategy->setCharset($charset); From 8c03be77e8dda45d786d806e913fa9215ed0843f Mon Sep 17 00:00:00 2001 From: George Steel Date: Wed, 31 May 2023 13:11:02 +0100 Subject: [PATCH 05/32] Tighten up PHPUnit config and fix test that was not testing anything Signed-off-by: George Steel --- phpunit.xml.dist | 9 +++++++++ test/PhpRendererTest.php | 14 +++++++------- test/_templates/exception.phtml | 3 +++ 3 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 test/_templates/exception.phtml diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 504e54969..63b4bd3dc 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -5,6 +5,15 @@ bootstrap="./vendor/autoload.php" colors="true" cacheDirectory=".phpunit.cache" + displayDetailsOnSkippedTests="true" + displayDetailsOnTestsThatTriggerDeprecations="true" + displayDetailsOnTestsThatTriggerErrors="true" + displayDetailsOnTestsThatTriggerNotices="true" + displayDetailsOnTestsThatTriggerWarnings="true" + displayDetailsOnIncompleteTests="true" + failOnWarning="true" + failOnDeprecation="true" + failOnNotice="true" > diff --git a/test/PhpRendererTest.php b/test/PhpRendererTest.php index 4af9a58e1..53d57ccc2 100644 --- a/test/PhpRendererTest.php +++ b/test/PhpRendererTest.php @@ -32,8 +32,11 @@ use function assert; use function realpath; use function restore_error_handler; +use function set_error_handler; use function str_replace; +use const E_WARNING; + class PhpRendererTest extends TestCase { private PhpRenderer $renderer; @@ -330,19 +333,16 @@ public function testRenderedViewModelIsRegisteredAsCurrentViewModel(): void public function testRendererRaisesExceptionInCaseOfExceptionInView(): void { $resolver = new TemplateMapResolver([ - 'exception' => __DIR__ . '../../Mvc/View/_files/exception.phtml', + 'exception' => __DIR__ . '/_templates/exception.phtml', ]); $this->renderer->setResolver($resolver); $model = new ViewModel(); $model->setTemplate('exception'); - try { - $this->renderer->render($model); - $this->fail('Exception from renderer should propagate'); - } catch (Throwable $e) { - $this->assertInstanceOf(Exception::class, $e); - } + $this->expectException(DomainException::class); + $this->expectExceptionMessage('I was thrown in the view'); + $this->renderer->render($model); } public function testRendererRaisesExceptionIfResolverCannotResolveTemplate(): void diff --git a/test/_templates/exception.phtml b/test/_templates/exception.phtml new file mode 100644 index 000000000..ce368bb24 --- /dev/null +++ b/test/_templates/exception.phtml @@ -0,0 +1,3 @@ + Date: Wed, 31 May 2023 13:20:09 +0100 Subject: [PATCH 06/32] Reset baseline with new deprecation Signed-off-by: George Steel --- psalm-baseline.xml | 47 +++++----------------------------------------- 1 file changed, 5 insertions(+), 42 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index d0aff1057..64174e059 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -2331,7 +2331,6 @@ $item $item $item - $item $order[$key] @@ -2403,53 +2402,33 @@ $modifiers - $modifiers $value $values $values $values $values - $values - $values - $values - $values - $values - $item - $item - $item $item $item $modifiers $value $values $values - $values - $values - $values - content]]> - content]]> - content]]> content]]> content]]> name]]> name]]> type]]> type]]> - type]]> - type]]> - type]]> - getArrayCopy - getArrayCopy getArrayCopy getArrayCopy getArrayCopy @@ -2475,11 +2454,6 @@ source]]> $values $values - $values - $values - $values - $values - $values $items[$i] @@ -2489,21 +2463,11 @@ $item $items $values - $values - $values - $values - $values source]]> - source]]> - source]]> - getArrayCopy - getArrayCopy - getArrayCopy - getArrayCopy getArrayCopy getArrayCopy setIndent @@ -2535,7 +2499,6 @@ $values $values $values - $values content]]> @@ -2548,7 +2511,6 @@ getArrayCopy getArrayCopy getArrayCopy - getArrayCopy getValue setIndent setIndent @@ -2594,6 +2556,11 @@ _helper]]> + + + getDependencyConfig())]]> + + @@ -2872,8 +2839,6 @@ $o $o $o - $o - $o $rIterator $rIterator $rIterator @@ -2891,7 +2856,6 @@ $key $key $key - $key $value $value $value @@ -3007,7 +2971,6 @@ $key $key $key - $key From ca94d845aa3ddc89c766bb5e4bd4c29b2654ada2 Mon Sep 17 00:00:00 2001 From: George Steel Date: Wed, 31 May 2023 13:20:58 +0100 Subject: [PATCH 07/32] Remove unused use Signed-off-by: George Steel --- test/PhpRendererTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/test/PhpRendererTest.php b/test/PhpRendererTest.php index 53d57ccc2..7be4b4875 100644 --- a/test/PhpRendererTest.php +++ b/test/PhpRendererTest.php @@ -5,7 +5,6 @@ namespace LaminasTest\View; use ArrayObject; -use Exception; use Laminas\Filter\FilterChain; use Laminas\ServiceManager\ServiceManager; use Laminas\View\Exception\DomainException; From dc41fe587d23b168d8aeee8bacf2f2d279de4032 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 2 Jun 2023 01:21:03 +0000 Subject: [PATCH 08/32] Lock file maintenance Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- composer.lock | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index c5d9eaf2b..cc916227f 100644 --- a/composer.lock +++ b/composer.lock @@ -2477,16 +2477,16 @@ }, { "name": "laminas/laminas-validator", - "version": "2.31.0", + "version": "2.32.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-validator.git", - "reference": "7dc274aa5afd5e23be0dbea13363e3d66ba5808b" + "reference": "c5f73b1dc9b657af24736b56318bcd880d9fee94" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-validator/zipball/7dc274aa5afd5e23be0dbea13363e3d66ba5808b", - "reference": "7dc274aa5afd5e23be0dbea13363e3d66ba5808b", + "url": "https://api.github.com/repos/laminas/laminas-validator/zipball/c5f73b1dc9b657af24736b56318bcd880d9fee94", + "reference": "c5f73b1dc9b657af24736b56318bcd880d9fee94", "shasum": "" }, "require": { @@ -2502,7 +2502,6 @@ "laminas/laminas-coding-standard": "^2.5", "laminas/laminas-db": "^2.18", "laminas/laminas-filter": "^2.32", - "laminas/laminas-http": "^2.18", "laminas/laminas-i18n": "^2.23", "laminas/laminas-session": "^2.16", "laminas/laminas-uri": "^2.10.0", @@ -2510,7 +2509,7 @@ "psalm/plugin-phpunit": "^0.18.4", "psr/http-client": "^1.0.2", "psr/http-factory": "^1.0.2", - "vimeo/psalm": "^5.11" + "vimeo/psalm": "^5.12" }, "suggest": { "laminas/laminas-db": "Laminas\\Db component, required by the (No)RecordExists validator", @@ -2558,7 +2557,7 @@ "type": "community_bridge" } ], - "time": "2023-05-19T09:42:26+00:00" + "time": "2023-06-01T08:43:15+00:00" }, { "name": "myclabs/deep-copy", From 216e257cd98532644ad4f9156e2294473d6c083a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 3 Jun 2023 03:34:46 +0000 Subject: [PATCH 09/32] Lock file maintenance Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index cc916227f..e9e3213a3 100644 --- a/composer.lock +++ b/composer.lock @@ -3367,16 +3367,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.1.3", + "version": "10.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "2379ebafc1737e71cdc84f402acb6b7f04198b9d" + "reference": "3aad97fde1f3e490e2b316ba56bc4680310e3c3f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2379ebafc1737e71cdc84f402acb6b7f04198b9d", - "reference": "2379ebafc1737e71cdc84f402acb6b7f04198b9d", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3aad97fde1f3e490e2b316ba56bc4680310e3c3f", + "reference": "3aad97fde1f3e490e2b316ba56bc4680310e3c3f", "shasum": "" }, "require": { @@ -3416,7 +3416,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "10.1-dev" + "dev-main": "10.2-dev" } }, "autoload": { @@ -3448,7 +3448,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.1.3" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.2.0" }, "funding": [ { @@ -3464,7 +3464,7 @@ "type": "tidelift" } ], - "time": "2023-05-11T05:16:22+00:00" + "time": "2023-06-02T05:42:13+00:00" }, { "name": "psalm/plugin-phpunit", From 4097c9edd79b4b38e6d66d7e622e6e45d8071721 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 6 Jun 2023 00:15:48 +0000 Subject: [PATCH 10/32] Lock file maintenance Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index e9e3213a3..0b18895ac 100644 --- a/composer.lock +++ b/composer.lock @@ -3367,16 +3367,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.2.0", + "version": "10.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "3aad97fde1f3e490e2b316ba56bc4680310e3c3f" + "reference": "599b33294350e8f51163119d5670512f98b0490d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3aad97fde1f3e490e2b316ba56bc4680310e3c3f", - "reference": "3aad97fde1f3e490e2b316ba56bc4680310e3c3f", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/599b33294350e8f51163119d5670512f98b0490d", + "reference": "599b33294350e8f51163119d5670512f98b0490d", "shasum": "" }, "require": { @@ -3448,7 +3448,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.2.0" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.2.1" }, "funding": [ { @@ -3464,7 +3464,7 @@ "type": "tidelift" } ], - "time": "2023-06-02T05:42:13+00:00" + "time": "2023-06-05T05:15:51+00:00" }, { "name": "psalm/plugin-phpunit", From 506382b8336ac934364e6019f7b0dee91915f577 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 00:23:31 +0000 Subject: [PATCH 11/32] Lock file maintenance Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 0b18895ac..986a47744 100644 --- a/composer.lock +++ b/composer.lock @@ -3367,16 +3367,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.2.1", + "version": "10.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "599b33294350e8f51163119d5670512f98b0490d" + "reference": "1ab521b24b88b88310c40c26c0cc4a94ba40ff95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/599b33294350e8f51163119d5670512f98b0490d", - "reference": "599b33294350e8f51163119d5670512f98b0490d", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1ab521b24b88b88310c40c26c0cc4a94ba40ff95", + "reference": "1ab521b24b88b88310c40c26c0cc4a94ba40ff95", "shasum": "" }, "require": { @@ -3448,7 +3448,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.2.1" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.2.2" }, "funding": [ { @@ -3464,7 +3464,7 @@ "type": "tidelift" } ], - "time": "2023-06-05T05:15:51+00:00" + "time": "2023-06-11T06:15:20+00:00" }, { "name": "psalm/plugin-phpunit", From c6a6ecda4ba964d24b6571cbb7ec9f3702ddba07 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 13 Jun 2023 01:34:58 +0000 Subject: [PATCH 12/32] Lock file maintenance Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 986a47744..ecdc3ed1c 100644 --- a/composer.lock +++ b/composer.lock @@ -2477,16 +2477,16 @@ }, { "name": "laminas/laminas-validator", - "version": "2.32.0", + "version": "2.33.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-validator.git", - "reference": "c5f73b1dc9b657af24736b56318bcd880d9fee94" + "reference": "1d82b5c0ede9316263e14d11e9284dfb3130f158" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-validator/zipball/c5f73b1dc9b657af24736b56318bcd880d9fee94", - "reference": "c5f73b1dc9b657af24736b56318bcd880d9fee94", + "url": "https://api.github.com/repos/laminas/laminas-validator/zipball/1d82b5c0ede9316263e14d11e9284dfb3130f158", + "reference": "1d82b5c0ede9316263e14d11e9284dfb3130f158", "shasum": "" }, "require": { @@ -2557,7 +2557,7 @@ "type": "community_bridge" } ], - "time": "2023-06-01T08:43:15+00:00" + "time": "2023-06-12T09:43:54+00:00" }, { "name": "myclabs/deep-copy", From 1c0022f9fa2d3fff71abd00348f9300081f0ecf5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 01:41:15 +0000 Subject: [PATCH 13/32] Lock file maintenance Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index ecdc3ed1c..c4f1ec03d 100644 --- a/composer.lock +++ b/composer.lock @@ -2671,16 +2671,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.5", + "version": "v4.16.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e" + "reference": "19526a33fb561ef417e822e85f08a00db4059c17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/11e2663a5bc9db5d714eedb4277ee300403b4a9e", - "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/19526a33fb561ef417e822e85f08a00db4059c17", + "reference": "19526a33fb561ef417e822e85f08a00db4059c17", "shasum": "" }, "require": { @@ -2721,9 +2721,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.5" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.16.0" }, - "time": "2023-05-19T20:20:00+00:00" + "time": "2023-06-25T14:52:30+00:00" }, { "name": "phar-io/manifest", From 0ca595066cd30ad993f3326484d681078caa020d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 27 Jun 2023 00:21:19 +0000 Subject: [PATCH 14/32] Lock file maintenance Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index c4f1ec03d..aeb7462f9 100644 --- a/composer.lock +++ b/composer.lock @@ -4879,16 +4879,16 @@ }, { "name": "symfony/filesystem", - "version": "v6.3.0", + "version": "v6.3.1", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "97b698e1d77d356304def77a8d0cd73090b359ea" + "reference": "edd36776956f2a6fcf577edb5b05eb0e3bdc52ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/97b698e1d77d356304def77a8d0cd73090b359ea", - "reference": "97b698e1d77d356304def77a8d0cd73090b359ea", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/edd36776956f2a6fcf577edb5b05eb0e3bdc52ae", + "reference": "edd36776956f2a6fcf577edb5b05eb0e3bdc52ae", "shasum": "" }, "require": { @@ -4922,7 +4922,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.3.0" + "source": "https://github.com/symfony/filesystem/tree/v6.3.1" }, "funding": [ { @@ -4938,7 +4938,7 @@ "type": "tidelift" } ], - "time": "2023-05-30T17:12:32+00:00" + "time": "2023-06-01T08:30:39+00:00" }, { "name": "symfony/polyfill-ctype", @@ -5491,16 +5491,16 @@ }, { "name": "vimeo/psalm", - "version": "5.12.0", + "version": "5.13.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "f90118cdeacd0088e7215e64c0c99ceca819e176" + "reference": "a0a9c27630bcf8301ee78cb06741d2907d8c9fef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/f90118cdeacd0088e7215e64c0c99ceca819e176", - "reference": "f90118cdeacd0088e7215e64c0c99ceca819e176", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/a0a9c27630bcf8301ee78cb06741d2907d8c9fef", + "reference": "a0a9c27630bcf8301ee78cb06741d2907d8c9fef", "shasum": "" }, "require": { @@ -5591,9 +5591,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.12.0" + "source": "https://github.com/vimeo/psalm/tree/5.13.0" }, - "time": "2023-05-22T21:19:03+00:00" + "time": "2023-06-24T17:05:12+00:00" }, { "name": "webimpress/coding-standard", From ea8f9562baf4a08c82fd6dc4f84a3b2e779601e3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 28 Jun 2023 02:44:07 +0000 Subject: [PATCH 15/32] Lock file maintenance Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index aeb7462f9..885549210 100644 --- a/composer.lock +++ b/composer.lock @@ -5491,16 +5491,16 @@ }, { "name": "vimeo/psalm", - "version": "5.13.0", + "version": "5.13.1", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "a0a9c27630bcf8301ee78cb06741d2907d8c9fef" + "reference": "086b94371304750d1c673315321a55d15fc59015" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/a0a9c27630bcf8301ee78cb06741d2907d8c9fef", - "reference": "a0a9c27630bcf8301ee78cb06741d2907d8c9fef", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/086b94371304750d1c673315321a55d15fc59015", + "reference": "086b94371304750d1c673315321a55d15fc59015", "shasum": "" }, "require": { @@ -5591,9 +5591,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.13.0" + "source": "https://github.com/vimeo/psalm/tree/5.13.1" }, - "time": "2023-06-24T17:05:12+00:00" + "time": "2023-06-27T16:39:49+00:00" }, { "name": "webimpress/coding-standard", From 5e0aaf2b80b495d4cad72c0a3ebdf9f4870d6057 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 2 Jul 2023 00:25:19 +0000 Subject: [PATCH 16/32] Lock file maintenance Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 885549210..d355cb29b 100644 --- a/composer.lock +++ b/composer.lock @@ -3367,16 +3367,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.2.2", + "version": "10.2.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1ab521b24b88b88310c40c26c0cc4a94ba40ff95" + "reference": "35c8cac1734ede2ae354a6644f7088356ff5b08e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1ab521b24b88b88310c40c26c0cc4a94ba40ff95", - "reference": "1ab521b24b88b88310c40c26c0cc4a94ba40ff95", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/35c8cac1734ede2ae354a6644f7088356ff5b08e", + "reference": "35c8cac1734ede2ae354a6644f7088356ff5b08e", "shasum": "" }, "require": { @@ -3448,7 +3448,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.2.2" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.2.3" }, "funding": [ { @@ -3464,7 +3464,7 @@ "type": "tidelift" } ], - "time": "2023-06-11T06:15:20+00:00" + "time": "2023-06-30T06:17:38+00:00" }, { "name": "psalm/plugin-phpunit", From 6452857d4cd01c03dcc400cd68b4857508ad5f85 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 4 Jul 2023 01:05:26 +0000 Subject: [PATCH 17/32] Lock file maintenance Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index d355cb29b..c03406a73 100644 --- a/composer.lock +++ b/composer.lock @@ -2477,16 +2477,16 @@ }, { "name": "laminas/laminas-validator", - "version": "2.33.0", + "version": "2.34.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-validator.git", - "reference": "1d82b5c0ede9316263e14d11e9284dfb3130f158" + "reference": "74a9701d12ed71e2110ddc291a0caaba5832a4ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-validator/zipball/1d82b5c0ede9316263e14d11e9284dfb3130f158", - "reference": "1d82b5c0ede9316263e14d11e9284dfb3130f158", + "url": "https://api.github.com/repos/laminas/laminas-validator/zipball/74a9701d12ed71e2110ddc291a0caaba5832a4ca", + "reference": "74a9701d12ed71e2110ddc291a0caaba5832a4ca", "shasum": "" }, "require": { @@ -2557,7 +2557,7 @@ "type": "community_bridge" } ], - "time": "2023-06-12T09:43:54+00:00" + "time": "2023-07-03T07:58:17+00:00" }, { "name": "myclabs/deep-copy", From 8ba92b698f357c0e70478510b23586f87046546f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 11 Jul 2023 02:16:38 +0000 Subject: [PATCH 18/32] Lock file maintenance Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- composer.lock | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/composer.lock b/composer.lock index c03406a73..7392199ca 100644 --- a/composer.lock +++ b/composer.lock @@ -2477,16 +2477,16 @@ }, { "name": "laminas/laminas-validator", - "version": "2.34.0", + "version": "2.35.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-validator.git", - "reference": "74a9701d12ed71e2110ddc291a0caaba5832a4ca" + "reference": "7a4a30f6c526a518ba9af50e037c2f97cb595958" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-validator/zipball/74a9701d12ed71e2110ddc291a0caaba5832a4ca", - "reference": "74a9701d12ed71e2110ddc291a0caaba5832a4ca", + "url": "https://api.github.com/repos/laminas/laminas-validator/zipball/7a4a30f6c526a518ba9af50e037c2f97cb595958", + "reference": "7a4a30f6c526a518ba9af50e037c2f97cb595958", "shasum": "" }, "require": { @@ -2557,7 +2557,7 @@ "type": "community_bridge" } ], - "time": "2023-07-03T07:58:17+00:00" + "time": "2023-07-10T07:32:01+00:00" }, { "name": "myclabs/deep-copy", @@ -3367,16 +3367,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.2.3", + "version": "10.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "35c8cac1734ede2ae354a6644f7088356ff5b08e" + "reference": "68484779b5a2ed711fbdeba6ca01910d87acdff2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/35c8cac1734ede2ae354a6644f7088356ff5b08e", - "reference": "35c8cac1734ede2ae354a6644f7088356ff5b08e", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/68484779b5a2ed711fbdeba6ca01910d87acdff2", + "reference": "68484779b5a2ed711fbdeba6ca01910d87acdff2", "shasum": "" }, "require": { @@ -3448,7 +3448,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.2.3" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.2.4" }, "funding": [ { @@ -3464,7 +3464,7 @@ "type": "tidelift" } ], - "time": "2023-06-30T06:17:38+00:00" + "time": "2023-07-10T04:06:08+00:00" }, { "name": "psalm/plugin-phpunit", From 24cda9a3e25bbfa16dfecdbacaf6e2d3b18c2c6c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 12 Jul 2023 00:50:00 +0000 Subject: [PATCH 19/32] Lock file maintenance Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 7392199ca..07ee22183 100644 --- a/composer.lock +++ b/composer.lock @@ -1179,16 +1179,16 @@ }, { "name": "laminas/laminas-authentication", - "version": "2.13.0", + "version": "2.14.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-authentication.git", - "reference": "12bfb36b8b20052a5fee2ae69b0f12064ce16fa9" + "reference": "758604b93889bff20522323b3cfcd8b5a044ed91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-authentication/zipball/12bfb36b8b20052a5fee2ae69b0f12064ce16fa9", - "reference": "12bfb36b8b20052a5fee2ae69b0f12064ce16fa9", + "url": "https://api.github.com/repos/laminas/laminas-authentication/zipball/758604b93889bff20522323b3cfcd8b5a044ed91", + "reference": "758604b93889bff20522323b3cfcd8b5a044ed91", "shasum": "" }, "require": { @@ -1203,13 +1203,13 @@ "laminas/laminas-crypt": "^2.6.0 || ^3.9.0", "laminas/laminas-db": "^2.15.0", "laminas/laminas-http": "^2.17.0", - "laminas/laminas-ldap": "^2.15.0", + "laminas/laminas-ldap": "^2.16", "laminas/laminas-session": "^2.13.0", "laminas/laminas-uri": "^2.10.0", "laminas/laminas-validator": "^2.26.0", "phpunit/phpunit": "^9.5.25", "psalm/plugin-phpunit": "^0.17.0", - "squizlabs/php_codesniffer": "^3.6.0", + "squizlabs/php_codesniffer": "^3.7.1", "vimeo/psalm": "^4.29.0" }, "suggest": { @@ -1251,7 +1251,7 @@ "type": "community_bridge" } ], - "time": "2022-10-24T08:02:04+00:00" + "time": "2023-07-11T19:04:48+00:00" }, { "name": "laminas/laminas-coding-standard", From b14701ced1573bbccfb2887e1fc5f8aac14761f3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 13 Jul 2023 01:34:42 +0000 Subject: [PATCH 20/32] Lock file maintenance Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 07ee22183..205fb4457 100644 --- a/composer.lock +++ b/composer.lock @@ -1179,16 +1179,16 @@ }, { "name": "laminas/laminas-authentication", - "version": "2.14.0", + "version": "2.15.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-authentication.git", - "reference": "758604b93889bff20522323b3cfcd8b5a044ed91" + "reference": "9036ae55a84862b16f8631460f90eeea6c19c54e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-authentication/zipball/758604b93889bff20522323b3cfcd8b5a044ed91", - "reference": "758604b93889bff20522323b3cfcd8b5a044ed91", + "url": "https://api.github.com/repos/laminas/laminas-authentication/zipball/9036ae55a84862b16f8631460f90eeea6c19c54e", + "reference": "9036ae55a84862b16f8631460f90eeea6c19c54e", "shasum": "" }, "require": { @@ -1251,7 +1251,7 @@ "type": "community_bridge" } ], - "time": "2023-07-11T19:04:48+00:00" + "time": "2023-07-12T08:21:19+00:00" }, { "name": "laminas/laminas-coding-standard", From 3c47a578d29c78800976085b70b33b20b6e2e928 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 15 Jul 2023 01:17:25 +0000 Subject: [PATCH 21/32] Lock file maintenance Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 205fb4457..312e7371b 100644 --- a/composer.lock +++ b/composer.lock @@ -3367,16 +3367,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.2.4", + "version": "10.2.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "68484779b5a2ed711fbdeba6ca01910d87acdff2" + "reference": "15a89f123d8ca9c1e1598d6d87a56a8bf28c72cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/68484779b5a2ed711fbdeba6ca01910d87acdff2", - "reference": "68484779b5a2ed711fbdeba6ca01910d87acdff2", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/15a89f123d8ca9c1e1598d6d87a56a8bf28c72cd", + "reference": "15a89f123d8ca9c1e1598d6d87a56a8bf28c72cd", "shasum": "" }, "require": { @@ -3448,7 +3448,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.2.4" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.2.5" }, "funding": [ { @@ -3464,7 +3464,7 @@ "type": "tidelift" } ], - "time": "2023-07-10T04:06:08+00:00" + "time": "2023-07-14T04:18:47+00:00" }, { "name": "psalm/plugin-phpunit", From b3f5fa8e2539370a9ad0cc3201b723eaf11b1178 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 18 Jul 2023 01:40:03 +0000 Subject: [PATCH 22/32] Lock file maintenance Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 312e7371b..ba44360be 100644 --- a/composer.lock +++ b/composer.lock @@ -3367,16 +3367,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.2.5", + "version": "10.2.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "15a89f123d8ca9c1e1598d6d87a56a8bf28c72cd" + "reference": "1c17815c129f133f3019cc18e8d0c8622e6d9bcd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/15a89f123d8ca9c1e1598d6d87a56a8bf28c72cd", - "reference": "15a89f123d8ca9c1e1598d6d87a56a8bf28c72cd", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1c17815c129f133f3019cc18e8d0c8622e6d9bcd", + "reference": "1c17815c129f133f3019cc18e8d0c8622e6d9bcd", "shasum": "" }, "require": { @@ -3448,7 +3448,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.2.5" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.2.6" }, "funding": [ { @@ -3464,7 +3464,7 @@ "type": "tidelift" } ], - "time": "2023-07-14T04:18:47+00:00" + "time": "2023-07-17T12:08:28+00:00" }, { "name": "psalm/plugin-phpunit", From f4a9eef1bca8e9907a868e6b8b2fbd7f6f61dd7c Mon Sep 17 00:00:00 2001 From: George Steel Date: Wed, 19 Jul 2023 12:01:28 +0100 Subject: [PATCH 23/32] Clean up HeadStyle View Helper Closes #6 It is not necessary to comment CSS within style tags so output has changed from: `` to `` The `'; + if ( isset($item->attributes['conditional']) && ! empty($item->attributes['conditional']) && is_string($item->attributes['conditional']) ) { - $escapeStart = null; - $escapeEnd = null; - } - - $html = ''; - - if (null === $escapeStart && null === $escapeEnd) { // inner wrap with comment end and start if !IE if (str_replace(' ', '', $item->attributes['conditional']) === '!IE') { $html = '' . $html . '', $value); + + $expect = << + a {} + + HTML; + self::assertSame($expect, $this->helper->toString()); } public function testRenderedStyleTagsContainsDefaultMedia(): void { $this->helper->setStyle('a {}', []); $value = $this->helper->toString(); - $this->assertMatchesRegularExpression('#'); - $this->assertEquals(3, $styles); - $this->assertStringContainsString($style3, $html); - $this->assertStringContainsString($style2, $html); - $this->assertStringContainsString($style1, $html); + self::assertEquals(3, $styles); + self::assertStringContainsString($style3, $html); + self::assertStringContainsString($style2, $html); + self::assertStringContainsString($style1, $html); } public function testCapturingCapturesToObject(): void @@ -225,26 +230,33 @@ public function testCapturingCapturesToObject(): void $this->helper->captureStart(); echo 'foobar'; $this->helper->captureEnd(); - $values = $this->helper->getArrayCopy(); - $this->assertEquals(1, count($values)); + $values = $this->helper->getContainer()->getArrayCopy(); + self::assertCount(1, $values); $item = array_shift($values); - $this->assertStringContainsString('foobar', $item->content); + self::assertIsObject($item); + self::assertObjectHasProperty('content', $item); + self::assertIsString($item->content); + self::assertStringContainsString('foobar', $item->content); } public function testOverloadingOffsetSetWritesToSpecifiedIndex(): void { $this->helper->offsetSetStyle(100, 'foobar'); - $values = $this->helper->getArrayCopy(); - $this->assertEquals(1, count($values)); - $this->assertTrue(isset($values[100])); + $values = $this->helper->getContainer()->getArrayCopy(); + self::assertCount(1, $values); + self::assertTrue(isset($values[100])); $item = $values[100]; - $this->assertStringContainsString('foobar', $item->content); + self::assertIsObject($item); + self::assertObjectHasProperty('content', $item); + self::assertIsString($item->content); + self::assertStringContainsString('foobar', $item->content); } public function testInvalidMethodRaisesException(): void { $this->expectException(View\Exception\BadMethodCallException::class); $this->expectExceptionMessage('Method "bogusMethod" does not exist'); + /** @psalm-suppress UndefinedMagicMethod */ $this->helper->bogusMethod(); } @@ -256,27 +268,41 @@ public function testTooFewArgumentsRaisesException(): void $this->helper->appendStyle(); } - public function testIndentationIsHonored(): void + public function testThatEmptyStylesWillYieldAnEmptyValue(): void { - $this->helper->setIndent(4); - $this->helper->appendStyle(' -a { - display: none; -}'); - $this->helper->appendStyle(' -h1 { - font-weight: bold -}'); - $string = $this->helper->toString(); + $this->helper->appendStyle('', ['media' => 'screen']); + self::assertSame('', $this->helper->toString()); + } - $scripts = substr_count($string, ' assertEquals(2, $scripts); - $this->assertStringContainsString(' <', $test); - $this->assertStringContainsString('', $test); + self::assertStringContainsString('<', $test); + self::assertStringContainsString('', $test); } public function testConditionalScriptNoIEWidthSpace(): void @@ -367,8 +412,8 @@ public function testConditionalScriptNoIEWidthSpace(): void display: none; }', ['media' => 'screen,projection', 'conditional' => '! IE']); $test = $this->helper->toString(); - $this->assertStringContainsString('<', $test); - $this->assertStringContainsString('', $test); + self::assertStringContainsString('<', $test); + self::assertStringContainsString('', $test); } public function testContainerMaintainsCorrectOrderOfItems(): void @@ -380,18 +425,19 @@ public function testContainerMaintainsCorrectOrderOfItems(): void $this->helper->offsetSetStyle(5, $style2); $test = $this->helper->toString(); - $expected = '' . PHP_EOL - . ''; - - $this->assertEquals($expected, $test); + $expected = '' + . PHP_EOL + . ''; + + self::assertEquals($expected, $test); } public function testRenderConditionalCommentsShouldNotContainHtmlEscaping(): void @@ -402,7 +448,7 @@ public function testRenderConditionalCommentsShouldNotContainHtmlEscaping(): voi ]); $value = $this->helper->toString(); - $this->assertStringNotContainsString('', $value); + self::assertStringNotContainsString('', $value); } } From 0a87f322d2de54cdd519bee301a0045cdaa47f5d Mon Sep 17 00:00:00 2001 From: George Steel Date: Wed, 19 Jul 2023 17:33:03 +0100 Subject: [PATCH 24/32] Improve type inference for stateful container implementations Adds templates to the container and abstract placeholder view helper classes and documents the types used by each implementing view helper. A lot of incorrect docblocks have been fixed, additional magic methods documented and a decent reduction in the baseline. Several implementations store values as plain objects and were in places (parameter) type hinting on `stdClass`. All references to `stdClass` have been replaced with `object` and `instanceof` conditions replaced with `is_object`. There's no BC break because `object` is more general than `stdClass`. The main purpose here is that it's not possible to express object shapes with `stdClass` which is central to the significant improvements in type inference. Various public and protected methods have been marked `@internal` so that they can be made private in the next major, and there are a handful of deprecations for unused, un-documented and un-tested public methods. Signed-off-by: George Steel --- psalm-baseline.xml | 303 +++--------------- src/Helper/HeadLink.php | 94 +++--- src/Helper/HeadMeta.php | 90 ++++-- src/Helper/HeadScript.php | 107 ++++--- src/Helper/HeadStyle.php | 77 ++--- src/Helper/HeadTitle.php | 41 ++- src/Helper/InlineScript.php | 12 +- src/Helper/Placeholder.php | 7 +- src/Helper/Placeholder/Container.php | 8 +- .../Container/AbstractContainer.php | 60 ++-- .../Container/AbstractStandalone.php | 58 ++-- test/Helper/HeadLinkTest.php | 10 +- test/Helper/HeadMetaTest.php | 7 +- test/Helper/HeadScriptTest.php | 37 +-- test/Helper/HeadStyleTest.php | 13 +- test/Helper/HeadTitleTest.php | 51 +-- test/Helper/Placeholder/ContainerTest.php | 84 +++-- .../Placeholder/StandaloneContainerTest.php | 16 +- test/Helper/TestAsset/Bar.php | 1 + test/Helper/TestAsset/Foo.php | 1 + test/Helper/TestAsset/MockContainer.php | 8 + test/Helper/TestAsset/NonStringableObject.php | 9 + 22 files changed, 498 insertions(+), 596 deletions(-) create mode 100644 test/Helper/TestAsset/NonStringableObject.php diff --git a/psalm-baseline.xml b/psalm-baseline.xml index eadf3b3a1..01fd07451 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -225,18 +225,6 @@ - - $item - - - getContainer()->set($value)]]> - - - HeadLink - - - (object) $attributes - offsetSet @@ -252,7 +240,6 @@ $item autoEscape ? $this->escapeAttribute($attributes[$itemKey]) : $attributes[$itemKey]]]> autoEscape ? $this->escapeAttribute($value) : $value]]> - getSeparator()]]> $value @@ -269,42 +256,17 @@ $extras $href $href - $indent $index $item $item - $item $media $title $type $value - - HeadLink - - - $indent - $indent - - - href]]> - rel]]> - - - - - - $value - - - stdClass - $index - - $item - $index view]]> @@ -312,24 +274,12 @@ (string) $conditionalStylesheet - - getIndent - getSeparator - getWhitespace - setSeparator - - - ! $item instanceof stdClass - - - $item + $value - - - $item - + $value + offsetSet offsetUnset @@ -347,22 +297,21 @@ autoEscape ? $this->escapeAttribute($item->$type) : $item->$type]]> autoEscape ? $this->escapeAttribute($item->content) : $item->content]]> autoEscape ? $this->escapeAttribute($value) : $value]]> - getSeparator()]]> $type $value + $value $doctype $indent $index $item - $item $key $type $value - HeadMeta + $this isHtml5 @@ -376,20 +325,10 @@ $indent $indent - - type]]> - {$item->type}]]> - parent::__call($method, $args) parent::__call($method, $args) - - $value - - - offsetSet($index, $item)]]> - $index $index @@ -408,53 +347,43 @@ plugin - getIndent - getSeparator getWhitespace - setSeparator - - - offsetSet $content $content - $indent $index $index - attributes]]> attributes['conditional']]]> type]]> type]]> $key autoEscape ? $this->escapeAttribute($value) : $value]]> - getSeparator()]]> $value + + $attrs + $attrs + $content - $indent $index $item - $item $key - captureType]]> $type - $useCdata $value - HeadScript + $this isHtml5 - isXhtml attributes['conditional']]]> @@ -462,10 +391,8 @@ $type - attributes]]> attributes]]> source]]> - source]]> type]]> @@ -475,14 +402,6 @@ $index - - null - - - $captureLock - $captureScriptType - $captureType - (bool) $flag @@ -492,16 +411,21 @@ plugin - plugin - - getIndent - getSeparator - getWhitespace - setSeparator - + + $item + + + content)]]> + content)]]> + content) || ! is_string($item->content)]]> + isValid($value)]]> + isValid($value)]]> + isValid($value)]]> + isValid($value)]]> + offsetSet @@ -509,6 +433,9 @@ $content $index + + $attrs + $content $index @@ -520,41 +447,14 @@ is_string($content) - - setSeparator - - - $item - $item - - - $item]]> - $item - $separator - - $items - - $indent $item - $items[] - $postfix - $prefix - $separator - - $indent - $postfix - $prefix - - - translate - @@ -645,19 +545,6 @@ (bool) $useNamespaces - - - parent::__invoke($mode, $spec, $placement, $attrs, $type) - - - InlineScript - - - InlineScript - InlineScript - InlineScript - - $response @@ -1237,18 +1124,6 @@ - - containerClass($value)]]> - - - items[$key]]]> - - - AbstractContainer - - - items]]> - (string) $key (string) $key @@ -1256,91 +1131,62 @@ (string) $key (string) $name - - - - Container - Container - + + containerClass($value)]]> + - self + $this + + $data + $data + $data + $data + nextIndex()]]> + nextIndex()]]> + $this[$key] .= $data + + + max($keys) + 1 + + + int + __toString - - AbstractContainer - $items + getArrayCopy()]]> + $values - - $this[$key] - - - $key - - - int - $this[$key] max($keys) - - max($keys) + 1 - - - $captureKey - $captureType - - (string) $indent (string) $postfix (string) $prefix (string) $separator - - captureKey]]> - - - containerClass()]]> - - - container]]> - __toString - - ArrayAccess - IteratorAggregate - - $container[$key] $return - - AbstractContainer - - - null - - - containerClass()]]> - (bool) $autoEscape (string) $string (string) $string - - container]]> - + + containerClass()]]> + @@ -2253,10 +2099,6 @@ - - - - @@ -2327,7 +2169,6 @@ getValue getValue getValue - setIndent @@ -2370,7 +2211,6 @@ type]]>
- getArrayCopy getArrayCopy getArrayCopy getValue @@ -2379,7 +2219,6 @@ offsetSetName offsetSetName offsetSetName - setIndent @@ -2389,39 +2228,7 @@ - $item - $item - $item - source]]> - $values - $values - - $items[$i] - - - $item - $item - $items - $values - - - source]]> - - - getArrayCopy - getArrayCopy - setIndent - setIndent - - - - - $placeholder - - - renderTitle - @@ -2950,23 +2757,11 @@ translations]]> - - - Bar - Bar - - $value - - - MockContainer - MockContainer - - getDependencyConfig())]]> diff --git a/src/Helper/HeadLink.php b/src/Helper/HeadLink.php index 96c0f6a64..977ad7b28 100644 --- a/src/Helper/HeadLink.php +++ b/src/Helper/HeadLink.php @@ -5,17 +5,17 @@ namespace Laminas\View\Helper; use Laminas\View\Exception; -use stdClass; +use Laminas\View\Helper\Placeholder\Container\AbstractContainer; +use Laminas\View\Helper\Placeholder\Container\AbstractStandalone; use function array_intersect; use function array_keys; use function array_shift; -use function call_user_func_array; use function count; -use function func_get_args; use function get_object_vars; use function implode; use function is_array; +use function is_object; use function is_string; use function method_exists; use function preg_match; @@ -24,11 +24,8 @@ use const PHP_EOL; -// @codingStandardsIgnoreStart /** - * Laminas_Layout_View_Helper_HeadLink - * - * @see http://www.w3.org/TR/xhtml1/dtds.html + * @extends AbstractStandalone * * Creates the following virtual methods: * @method HeadLink appendStylesheet($href, $media = 'screen', $conditionalStylesheet = '', $extras = []) @@ -40,8 +37,7 @@ * @method HeadLink prependAlternate($href, $type, $title, $extras = []) * @method HeadLink setAlternate($href, $type, $title, $extras = []) */ -class HeadLink extends Placeholder\Container\AbstractStandalone -// @codingStandardsIgnoreEnd +class HeadLink extends AbstractStandalone { /** * Allowed attributes @@ -84,13 +80,13 @@ public function __construct() * Allows calling $helper->headLink(), but, more importantly, chaining calls * like ->appendStylesheet()->headLink(). * - * @param array|null $attributes + * @param array|null $attributes * @param string $placement * @return HeadLink */ - public function headLink(?array $attributes = null, $placement = Placeholder\Container\AbstractContainer::APPEND) + public function headLink(?array $attributes = null, $placement = AbstractContainer::APPEND) { - return call_user_func_array([$this, '__invoke'], func_get_args()); + return $this->__invoke($attributes, $placement); } /** @@ -99,22 +95,22 @@ public function headLink(?array $attributes = null, $placement = Placeholder\Con * Returns current object instance. Optionally, allows passing array of * values to build link. * - * @param array|null $attributes - * @param string $placement - * @return HeadLink + * @param array|null $attributes + * @param string $placement + * @return $this */ - public function __invoke(?array $attributes = null, $placement = Placeholder\Container\AbstractContainer::APPEND) + public function __invoke(?array $attributes = null, $placement = AbstractContainer::APPEND) { if (null !== $attributes) { $item = $this->createData($attributes); switch ($placement) { - case Placeholder\Container\AbstractContainer::SET: + case AbstractContainer::SET: $this->set($item); break; - case Placeholder\Container\AbstractContainer::PREPEND: + case AbstractContainer::PREPEND: $this->prepend($item); break; - case Placeholder\Container\AbstractContainer::APPEND: + case AbstractContainer::APPEND: default: $this->append($item); break; @@ -201,12 +197,14 @@ public function __call($method, $args) /** * Check if value is valid * - * @param mixed $value + * @internal This method will become private in version 3.0 + * + * @param mixed $value * @return bool */ protected function isValid($value) { - if (! $value instanceof stdClass) { + if (! is_object($value)) { return false; } @@ -223,9 +221,9 @@ protected function isValid($value) /** * append() * - * @param mixed $value + * @param object $value * @throws Exception\InvalidArgumentException - * @return Placeholder\Container\AbstractContainer + * @return AbstractContainer */ public function append($value) { @@ -241,8 +239,8 @@ public function append($value) /** * offsetSet() * - * @param string|int $index - * @param array $value + * @param int $index + * @param object $value * @throws Exception\InvalidArgumentException * @return void */ @@ -260,9 +258,9 @@ public function offsetSet($index, $value) /** * prepend() * - * @param mixed $value + * @param object $value * @throws Exception\InvalidArgumentException - * @return Placeholder\Container\AbstractContainer + * @return AbstractContainer */ public function prepend($value) { @@ -278,9 +276,9 @@ public function prepend($value) /** * set() * - * @param array $value + * @param object $value * @throws Exception\InvalidArgumentException - * @return HeadLink + * @return $this */ public function set($value) { @@ -290,15 +288,19 @@ public function set($value) ); } - return $this->getContainer()->set($value); + $this->getContainer()->set($value); + + return $this; } /** * Create HTML link element from data item * + * @internal This method will become private in version 3.0 + * * @return string */ - public function itemToString(stdClass $item) + public function itemToString(object $item) { $attributes = (array) $item; $link = 'getWhitespace($indent) - : $this->getIndent(); + ? $this->getContainer()->getWhitespace($indent) + : $this->getContainer()->getIndent(); $items = []; $this->getContainer()->ksort(); @@ -366,14 +368,16 @@ public function toString($indent = null) $items[] = $this->itemToString($item); } - return $indent . implode($this->escape($this->getSeparator()) . $indent, $items); + return $indent . implode($this->escape($this->getContainer()->getSeparator()) . $indent, $items); } /** * Create data item for stack * - * @param array $attributes - * @return stdClass + * @internal This method will become private in version 3.0 + * + * @param array $attributes + * @return object */ public function createData(array $attributes) { @@ -383,8 +387,10 @@ public function createData(array $attributes) /** * Create item for stylesheet link item * + * @deprecated This method is unused and will be removed in version 3.0 of this component + * * @param array $args - * @return stdClass|false Returns false if stylesheet is a duplicate + * @return object|false Returns false if stylesheet is a duplicate */ public function createDataStylesheet(array $args) { @@ -435,6 +441,8 @@ public function createDataStylesheet(array $args) /** * Is the linked stylesheet a duplicate? * + * @internal This method will become private in version 3.0 + * * @param string $uri * @return bool */ @@ -452,9 +460,11 @@ protected function isDuplicateStylesheet($uri) /** * Create item for alternate link item * + * @deprecated This method is unused and will be removed in version 3.0 of this component + * * @param array $args * @throws Exception\InvalidArgumentException - * @return stdClass + * @return object */ public function createDataAlternate(array $args) { @@ -493,8 +503,10 @@ public function createDataAlternate(array $args) /** * Create item for a prev relationship (mainly used for pagination) * + * @deprecated This method is unused and will be removed in version 3.0 of this component + * * @param array $args - * @return stdClass + * @return object */ public function createDataPrev(array $args) { @@ -507,8 +519,10 @@ public function createDataPrev(array $args) /** * Create item for a prev relationship (mainly used for pagination) * + * @deprecated This method is unused and will be removed in version 3.0 of this component + * * @param array $args - * @return stdClass + * @return object */ public function createDataNext(array $args) { diff --git a/src/Helper/HeadMeta.php b/src/Helper/HeadMeta.php index 8e460b295..a0982ab89 100644 --- a/src/Helper/HeadMeta.php +++ b/src/Helper/HeadMeta.php @@ -6,6 +6,8 @@ use Laminas\View; use Laminas\View\Exception; +use Laminas\View\Helper\Placeholder\Container\AbstractContainer; +use Laminas\View\Helper\Placeholder\Container\AbstractStandalone; use stdClass; use function array_shift; @@ -14,6 +16,7 @@ use function count; use function implode; use function in_array; +use function is_object; use function is_string; use function method_exists; use function preg_match; @@ -49,40 +52,49 @@ * @method HeadMeta offsetGetItemprop($index, $keyValue, $content, $modifiers = array()) * @method HeadMeta prependItemprop($keyValue, $content, $modifiers = array()) * @method HeadMeta setItemprop($keyValue, $content, $modifiers = array()) + * + * @psalm-type ObjectShape = object{ + * type: string, + * content: string, + * modifiers: array, + * name?: string, + * http-equiv?: string, + * charset?: string, + * property?: string, + * itemprop?: string, + * } + * @extends AbstractStandalone */ -class HeadMeta extends Placeholder\Container\AbstractStandalone +class HeadMeta extends AbstractStandalone { /** * Allowed key types * - * @var array + * @var list */ protected $typeKeys = ['name', 'http-equiv', 'charset', 'property', 'itemprop']; /** * Required attributes for meta tag * - * @var array + * @deprecated This property is unused and will be removed in version 3.0 + * + * @var list */ protected $requiredKeys = ['content']; /** * Allowed modifier keys * - * @var array + * @var list */ protected $modifierKeys = ['lang', 'scheme']; - /** - * Constructor - * - * Set separator to PHP_EOL - */ public function __construct() { parent::__construct(); - $this->setSeparator(PHP_EOL); + $this->getContainer()->setSeparator(PHP_EOL); } /** @@ -93,14 +105,14 @@ public function __construct() * @param string $keyType * @param array $modifiers * @param string $placement - * @return HeadMeta + * @return $this */ public function __invoke( $content = null, $keyValue = null, $keyType = 'name', $modifiers = [], - $placement = Placeholder\Container\AbstractContainer::APPEND + $placement = AbstractContainer::APPEND ) { if ((null !== $content) && (null !== $keyValue)) { $item = $this->createData($keyType, $keyValue, $content, $modifiers); @@ -126,7 +138,7 @@ public function __invoke( * @param string $method * @param array $args * @throws Exception\BadMethodCallException - * @return HeadMeta + * @return $this */ public function __call($method, $args) { @@ -162,7 +174,9 @@ public function __call($method, $args) $item = $this->createData($type, $args[0], $args[1], $args[2]); if ('offsetSet' === $action) { - return $this->offsetSet($index, $item); + $this->offsetSet($index, $item); + + return $this; } $this->$action($item); @@ -214,30 +228,33 @@ public function toString($indent = null) /** * Create data item for inserting into stack * + * @internal This method will become private in version 3.0 + * * @param string $type * @param string $typeValue * @param string $content * @param array $modifiers - * @return stdClass + * @return object */ public function createData($type, $typeValue, $content, array $modifiers) { - $data = new stdClass(); - $data->type = $type; - $data->$type = $typeValue; - $data->content = $content; - $data->modifiers = $modifiers; - - return $data; + return (object) [ + 'type' => $type, + $type => $typeValue, + 'content' => $content, + 'modifiers' => $modifiers, + ]; } /** * Build meta HTML string * + * @internal This method will become private in version 3.0 + * * @throws Exception\InvalidArgumentException * @return string */ - public function itemToString(stdClass $item) + public function itemToString(object $item) { if (! in_array($item->type, $this->typeKeys)) { throw new Exception\InvalidArgumentException(sprintf( @@ -312,6 +329,8 @@ public function itemToString(stdClass $item) /** * Normalize type attribute of meta * + * @internal This method will become private in version 3.0 + * * @param string $type type in CamelCase * @throws Exception\DomainException * @return string @@ -338,13 +357,16 @@ protected function normalizeType($type) /** * Determine if item is valid * - * @param stdClass $item + * @internal This method will become private in version 3.0 + * + * @param mixed $item * @return bool + * @psalm-param-out ObjectShape $item */ protected function isValid($item) { if ( - ! $item instanceof stdClass + ! is_object($item) || ! isset($item->type) || ! isset($item->modifiers) ) { @@ -386,7 +408,7 @@ protected function isValid($item) /** * Append * - * @param stdClass $value + * @param object $value * @return View\Helper\Placeholder\Container\AbstractContainer * @throws Exception\InvalidArgumentException */ @@ -404,8 +426,8 @@ public function append($value) /** * OffsetSet * - * @param string|int $index - * @param string $value + * @param int $index + * @param mixed $value * @return void * @throws Exception\InvalidArgumentException */ @@ -423,7 +445,7 @@ public function offsetSet($index, $value) /** * OffsetUnset * - * @param string|int $index + * @param int $index * @return void * @throws Exception\InvalidArgumentException */ @@ -439,9 +461,9 @@ public function offsetUnset($index) /** * Prepend * - * @param stdClass $value + * @param object $value * @throws Exception\InvalidArgumentException - * @return View\Helper\Placeholder\Container\AbstractContainer + * @return AbstractContainer */ public function prepend($value) { @@ -457,9 +479,9 @@ public function prepend($value) /** * Set * - * @param stdClass $value + * @param object $value * @throws Exception\InvalidArgumentException - * @return View\Helper\Placeholder\Container\AbstractContainer + * @return AbstractContainer */ public function set($value) { @@ -484,7 +506,7 @@ public function set($value) * * @param string $charset * @throws Exception\InvalidArgumentException - * @return static + * @return $this */ public function setCharset($charset) { diff --git a/src/Helper/HeadScript.php b/src/Helper/HeadScript.php index 880cf594b..b2123c3ac 100644 --- a/src/Helper/HeadScript.php +++ b/src/Helper/HeadScript.php @@ -5,14 +5,18 @@ namespace Laminas\View\Helper; use Laminas\View\Exception; -use stdClass; +use Laminas\View\Helper\Placeholder\Container\AbstractContainer; +use Laminas\View\Helper\Placeholder\Container\AbstractStandalone; +use Laminas\View\Renderer\PhpRenderer; use function array_key_exists; use function array_shift; +use function assert; use function count; use function filter_var; use function implode; use function in_array; +use function is_object; use function is_string; use function ob_get_clean; use function ob_start; @@ -38,8 +42,14 @@ * @method HeadScript offsetSetScript($index, $src, $type = 'text/javascript', $attrs = []) * @method HeadScript prependScript($script, $type = 'text/javascript', $attrs = []) * @method HeadScript setScript($script, $type = 'text/javascript', $attrs = []) + * @psalm-type ObjectShape = object{ + * type: string, + * attributes: array, + * source: string|null, + * } + * @extends AbstractStandalone */ -class HeadScript extends Placeholder\Container\AbstractStandalone +class HeadScript extends AbstractStandalone { /** * Script type constants @@ -66,33 +76,33 @@ class HeadScript extends Placeholder\Container\AbstractStandalone * * @var bool */ - protected $captureLock; + protected $captureLock = false; /** * Capture type * - * @var string + * @var string|null */ protected $captureScriptType; /** * Capture attributes * - * @var null|array + * @var null|array */ protected $captureScriptAttrs; /** * Capture type (append, prepend, set) * - * @var string + * @var string|null */ protected $captureType; /** * Optional allowed attributes for script tag * - * @var array + * @var list */ protected $optionalAttributes = [ 'charset', @@ -111,7 +121,7 @@ class HeadScript extends Placeholder\Container\AbstractStandalone /** * Script attributes that behave as booleans * - * @var string[] + * @var list */ private array $booleanAttributes = [ 'nomodule', @@ -122,7 +132,9 @@ class HeadScript extends Placeholder\Container\AbstractStandalone /** * Required attributes for script tag * - * @var string + * @deprecated This property is unused and will be removed in version 3.0 of this component + * + * @var list */ protected $requiredAttributes = ['type']; @@ -134,16 +146,11 @@ class HeadScript extends Placeholder\Container\AbstractStandalone */ public $useCdata = false; - /** - * Constructor - * - * Set separator to PHP_EOL. - */ public function __construct() { parent::__construct(); - $this->setSeparator(PHP_EOL); + $this->getContainer()->setSeparator(PHP_EOL); } /** @@ -155,9 +162,9 @@ public function __construct() * @param string $mode Script or file * @param string $spec Script/url * @param string $placement Append, prepend, or set - * @param array $attrs Array of script attributes + * @param array $attrs Array of script attributes * @param string $type Script type and/or array of script attributes - * @return HeadScript + * @return $this */ public function __invoke( $mode = self::FILE, @@ -191,7 +198,7 @@ public function __invoke( * @param string $method Method to call * @param array $args Arguments of method * @throws Exception\BadMethodCallException If too few arguments or invalid method. - * @return HeadScript + * @return $this */ public function __call($method, $args) { @@ -266,11 +273,14 @@ public function __call($method, $args) public function toString($indent = null) { $indent = null !== $indent - ? $this->getWhitespace($indent) - : $this->getIndent(); + ? $this->getContainer()->getWhitespace($indent) + : $this->getContainer()->getIndent(); + + if ($this->view instanceof PhpRenderer) { + $doctype = $this->view->plugin('doctype'); + assert($doctype instanceof Doctype); - if ($this->view) { - $useCdata = $this->view->plugin('doctype')->isXhtml(); + $useCdata = $doctype->isXhtml(); } else { $useCdata = $this->useCdata; } @@ -294,14 +304,14 @@ public function toString($indent = null) /** * Start capture action * - * @param mixed $captureType Type of capture - * @param string $type Type of script - * @param array $attrs Attributes of capture + * @param string $captureType Type of capture + * @param string $type Type of script + * @param array $attrs Attributes of capture * @throws Exception\RuntimeException * @return void */ public function captureStart( - $captureType = Placeholder\Container\AbstractContainer::APPEND, + $captureType = AbstractContainer::APPEND, $type = self::DEFAULT_SCRIPT_TYPE, $attrs = [] ) { @@ -331,9 +341,9 @@ public function captureEnd() $this->captureLock = false; switch ($this->captureType) { - case Placeholder\Container\AbstractContainer::SET: - case Placeholder\Container\AbstractContainer::PREPEND: - case Placeholder\Container\AbstractContainer::APPEND: + case AbstractContainer::SET: + case AbstractContainer::PREPEND: + case AbstractContainer::APPEND: $action = strtolower($this->captureType) . 'Script'; break; default: @@ -347,19 +357,20 @@ public function captureEnd() /** * Create data item containing all necessary components of script * + * @internal This method will become private in version 3.0 + * * @param string $type Type of data - * @param array $attributes Attributes of data + * @param array $attributes Attributes of data * @param string $content Content of data - * @return stdClass + * @return ObjectShape */ public function createData($type, array $attributes, $content = null) { - $data = new stdClass(); - $data->type = $type; - $data->attributes = $attributes; - $data->source = $content; - - return $data; + return (object) [ + 'type' => $type, + 'attributes' => $attributes, + 'source' => $content, + ]; } /** @@ -386,13 +397,15 @@ protected function isDuplicate($file) /** * Is the script provided valid? * + * @internal This method will become private in version 3.0 + * * @param mixed $value Is the given script valid? * @return bool */ protected function isValid($value) { if ( - ! $value instanceof stdClass + ! is_object($value) || ! isset($value->type) || (! isset($value->source) && ! isset($value->attributes)) @@ -406,6 +419,8 @@ protected function isValid($value) /** * Create script HTML * + * @internal This method will become private in version 3.0 + * * @param mixed $item Item to convert * @param string $indent String to add before the item * @param string $escapeStart Starting sequence @@ -484,9 +499,9 @@ public function itemToString($item, $indent, $escapeStart, $escapeEnd) /** * Override append * - * @param string $value Append script or file + * @param ObjectShape $value Append script or file * @throws Exception\InvalidArgumentException - * @return Placeholder\Container\AbstractContainer + * @return AbstractContainer */ public function append($value) { @@ -503,9 +518,9 @@ public function append($value) /** * Override prepend * - * @param string $value Prepend script or file + * @param ObjectShape $value Prepend script or file * @throws Exception\InvalidArgumentException - * @return Placeholder\Container\AbstractContainer + * @return AbstractContainer */ public function prepend($value) { @@ -522,7 +537,7 @@ public function prepend($value) /** * Override set * - * @param string $value Set script or file + * @param ObjectShape $value Set script or file * @throws Exception\InvalidArgumentException * @return void */ @@ -540,8 +555,8 @@ public function set($value) /** * Override offsetSet * - * @param string|int $index Set script of file offset - * @param mixed $value + * @param int $index Set script of file offset + * @param ObjectShape $value * @throws Exception\InvalidArgumentException * @return void */ @@ -561,7 +576,7 @@ public function offsetSet($index, $value) * Set flag indicating if arbitrary attributes are allowed * * @param bool $flag Set flag - * @return HeadScript + * @return $this */ public function setAllowArbitraryAttributes($flag) { diff --git a/src/Helper/HeadStyle.php b/src/Helper/HeadStyle.php index a68b8ea6b..adc6f91ac 100644 --- a/src/Helper/HeadStyle.php +++ b/src/Helper/HeadStyle.php @@ -6,6 +6,8 @@ use Laminas\View; use Laminas\View\Exception; +use Laminas\View\Helper\Placeholder\Container\AbstractContainer; +use Laminas\View\Helper\Placeholder\Container\AbstractStandalone; use stdClass; use function array_filter; @@ -28,17 +30,22 @@ use const PHP_EOL; /** - * Helper for setting and retrieving stylesheets + * Helper for adding inline CSS to the head in style tags * - * Allows the following method calls: + * @psalm-type ObjectShape = object{ + * attributes: array, + * content: string, + * } + * @extends AbstractStandalone * - * @method HeadStyle appendStyle($content, $attributes = array()) - * @method HeadStyle offsetSetStyle($index, $content, $attributes = array()) - * @method HeadStyle prependStyle($content, $attributes = array()) - * @method HeadStyle setStyle($content, $attributes = array()) + * Allows the following method calls: + * @method HeadStyle appendStyle(string $content, array $attributes = []) + * @method HeadStyle offsetSetStyle(int $index, string $content, array $attributes = []) + * @method HeadStyle prependStyle(string $content, array $attributes = []) + * @method HeadStyle setStyle(string $content, array $attributes = []) * @method HeadStyle setIndent(int|string $indent) */ -class HeadStyle extends Placeholder\Container\AbstractStandalone +class HeadStyle extends AbstractStandalone { /** * Allowed optional attributes @@ -93,7 +100,7 @@ public function __construct() { parent::__construct(); - $this->setSeparator(PHP_EOL); + $this->getContainer()->setSeparator(PHP_EOL); } /** @@ -106,17 +113,17 @@ public function __construct() * @param string|array $attributes Optional attributes to utilize * @return HeadStyle */ - public function __invoke($content = null, $placement = 'APPEND', $attributes = []) + public function __invoke($content = null, $placement = AbstractContainer::APPEND, $attributes = []) { if ((null !== $content) && is_string($content)) { switch (strtoupper($placement)) { - case 'SET': + case AbstractContainer::SET: $action = 'setStyle'; break; - case 'PREPEND': + case AbstractContainer::PREPEND: $action = 'prependStyle'; break; - case 'APPEND': + case AbstractContainer::APPEND: default: $action = 'appendStyle'; break; @@ -210,7 +217,7 @@ public function toString($indent = null) * @throws Exception\RuntimeException * @return void */ - public function captureStart($type = Placeholder\Container\AbstractContainer::APPEND, $attrs = null) + public function captureStart($type = AbstractContainer::APPEND, $attrs = null) { if ($this->captureLock) { throw new Exception\RuntimeException('Cannot nest headStyle captures'); @@ -230,18 +237,18 @@ public function captureStart($type = Placeholder\Container\AbstractContainer::AP public function captureEnd() { $content = ob_get_clean(); - $attrs = $this->captureAttrs; + $attrs = $this->captureAttrs ?? []; $this->captureAttrs = null; $this->captureLock = false; switch ($this->captureType) { - case Placeholder\Container\AbstractContainer::SET: + case AbstractContainer::SET: $this->setStyle($content, $attrs); break; - case Placeholder\Container\AbstractContainer::PREPEND: + case AbstractContainer::PREPEND: $this->prependStyle($content, $attrs); break; - case Placeholder\Container\AbstractContainer::APPEND: + case AbstractContainer::APPEND: default: $this->appendStyle($content, $attrs); break; @@ -254,8 +261,8 @@ public function captureEnd() * @internal This method is internal and will be made private in version 3.0 * * @param string $content - * @param array $attributes - * @return stdClass + * @param array $attributes + * @return ObjectShape */ public function createData($content, array $attributes) { @@ -263,11 +270,10 @@ public function createData($content, array $attributes) $attributes['media'] = 'screen'; } - $data = new stdClass(); - $data->content = $content; - $data->attributes = $attributes; - - return $data; + return (object) [ + 'content' => $content, + 'attributes' => $attributes, + ]; } /** @@ -275,11 +281,10 @@ public function createData($content, array $attributes) * * @internal This method is internal and will be made private in version 3.0 * - * @param mixed $value * @return bool - * @psalm-assert-if-true stdClass $value + * @psalm-assert-if-true ObjectShape $value */ - protected function isValid($value) + protected function isValid(mixed $value) { if (! $value instanceof stdClass || ! isset($value->content) || ! isset($value->attributes)) { return false; @@ -360,11 +365,11 @@ private function styleTagAttributesString(object $item): string * * @internal This method is internal and will be made private in version 3.0 * - * @param stdClass $item Item to render + * @param ObjectShape $item Item to render * @param string $indent Indentation to use * @return string */ - public function itemToString(stdClass $item, $indent) + public function itemToString(object $item, $indent) { if (! isset($item->content) || ! is_string($item->content) || $item->content === '') { return ''; @@ -396,9 +401,9 @@ public function itemToString(stdClass $item, $indent) /** * Override append to enforce style creation * - * @param mixed $value + * @param ObjectShape $value * @throws Exception\InvalidArgumentException - * @return Placeholder\Container\AbstractContainer + * @return AbstractContainer */ public function append($value) { @@ -414,8 +419,8 @@ public function append($value) /** * Override offsetSet to enforce style creation * - * @param string|int $index - * @param mixed $value + * @param int $index + * @param ObjectShape $value * @throws Exception\InvalidArgumentException * @return void */ @@ -433,9 +438,9 @@ public function offsetSet($index, $value) /** * Override prepend to enforce style creation * - * @param mixed $value + * @param ObjectShape $value * @throws Exception\InvalidArgumentException - * @return Placeholder\Container\AbstractContainer + * @return AbstractContainer */ public function prepend($value) { @@ -451,7 +456,7 @@ public function prepend($value) /** * Override set to enforce style creation * - * @param mixed $value + * @param ObjectShape $value * @throws Exception\InvalidArgumentException * @return void */ diff --git a/src/Helper/HeadTitle.php b/src/Helper/HeadTitle.php index ccfce1934..61e8eff32 100644 --- a/src/Helper/HeadTitle.php +++ b/src/Helper/HeadTitle.php @@ -5,7 +5,10 @@ namespace Laminas\View\Helper; use Laminas\View\Exception; +use Laminas\View\Helper\Placeholder\Container\AbstractContainer; +use Laminas\View\Helper\Placeholder\Container\AbstractStandalone; +use function assert; use function implode; use function in_array; @@ -13,8 +16,13 @@ * Helper for setting and retrieving title element for HTML head. * * Duck-types against Laminas\I18n\Translator\TranslatorAwareInterface. + * + * @extends AbstractStandalone + * @method HeadTitle set(string $string) + * @method HeadTitle prepend(string $string) + * @method HeadTitle append(string $string) */ -class HeadTitle extends Placeholder\Container\AbstractStandalone +class HeadTitle extends AbstractStandalone { use TranslatorAwareTrait; @@ -36,14 +44,14 @@ public function __invoke($title = null, $setType = null) { if (null === $setType) { $setType = $this->getDefaultAttachOrder() - ?? Placeholder\Container\AbstractContainer::APPEND; + ?? AbstractContainer::APPEND; } $title = (string) $title; if ($title !== '') { - if ($setType === Placeholder\Container\AbstractContainer::SET) { + if ($setType === AbstractContainer::SET) { $this->set($title); - } elseif ($setType === Placeholder\Container\AbstractContainer::PREPEND) { + } elseif ($setType === AbstractContainer::PREPEND) { $this->prepend($title); } else { $this->append($title); @@ -62,8 +70,8 @@ public function __invoke($title = null, $setType = null) public function toString($indent = null) { $indent = null !== $indent - ? $this->getWhitespace($indent) - : $this->getIndent(); + ? $this->getContainer()->getWhitespace($indent) + : $this->getContainer()->getIndent(); $output = $this->renderTitle(); @@ -84,24 +92,22 @@ public function renderTitle() $items[] = $itemCallback($item); } - $separator = $this->getSeparator(); + $separator = $this->getContainer()->getSeparator(); $output = ''; - $prefix = $this->getPrefix(); + $prefix = $this->getContainer()->getPrefix(); if ($prefix) { $output .= $prefix; } $output .= implode($separator, $items); - $postfix = $this->getPostfix(); + $postfix = $this->getContainer()->getPostfix(); if ($postfix) { $output .= $postfix; } - $output = $this->autoEscape ? $this->escape($output) : $output; - - return $output; + return $this->autoEscape ? $this->escape($output) : $output; } /** @@ -109,15 +115,15 @@ public function renderTitle() * * @param string $setType * @throws Exception\DomainException - * @return HeadTitle + * @return $this */ public function setDefaultAttachOrder($setType) { if ( ! in_array($setType, [ - Placeholder\Container\AbstractContainer::APPEND, - Placeholder\Container\AbstractContainer::SET, - Placeholder\Container\AbstractContainer::PREPEND, + AbstractContainer::APPEND, + AbstractContainer::SET, + AbstractContainer::PREPEND, ], true) ) { throw new Exception\DomainException( @@ -146,7 +152,7 @@ public function getDefaultAttachOrder() * callable that simply returns the provided item; otherwise, returns a * callable that returns a translation of the provided item. * - * @return callable + * @return callable(string): string */ private function getTitleItemCallback() { @@ -155,6 +161,7 @@ private function getTitleItemCallback() } $translator = $this->getTranslator(); + assert($translator !== null); $textDomain = $this->getTranslatorTextDomain(); return static fn($item) => $translator->translate($item, $textDomain); } diff --git a/src/Helper/InlineScript.php b/src/Helper/InlineScript.php index 124cc88b4..b8299e50c 100644 --- a/src/Helper/InlineScript.php +++ b/src/Helper/InlineScript.php @@ -16,12 +16,12 @@ class InlineScript extends HeadScript * Returns InlineScript helper object; optionally, allows specifying a * script or script file to include. * - * @param string $mode Script or file - * @param string $spec Script/url - * @param string $placement Append, prepend, or set - * @param array $attrs Array of script attributes - * @param string $type Script type and/or array of script attributes - * @return InlineScript + * @param string $mode Script or file + * @param string $spec Script/url + * @param string $placement Append, prepend, or set + * @param array $attrs Array of script attributes + * @param string $type Script type and/or array of script attributes + * @return $this */ public function __invoke( $mode = self::FILE, diff --git a/src/Helper/Placeholder.php b/src/Helper/Placeholder.php index d6713cca6..a747668c8 100644 --- a/src/Helper/Placeholder.php +++ b/src/Helper/Placeholder.php @@ -21,14 +21,14 @@ class Placeholder extends AbstractHelper /** * Placeholder items * - * @var AbstractContainer[] + * @var array */ protected $items = []; /** * Default container class * - * @var string + * @var class-string */ protected $containerClass = Container::class; @@ -47,8 +47,7 @@ public function __invoke($name = null) ); } - $name = (string) $name; - return $this->getContainer($name); + return $this->getContainer((string) $name); } /** diff --git a/src/Helper/Placeholder/Container.php b/src/Helper/Placeholder/Container.php index 09611c493..ebb171baf 100644 --- a/src/Helper/Placeholder/Container.php +++ b/src/Helper/Placeholder/Container.php @@ -4,9 +4,15 @@ namespace Laminas\View\Helper\Placeholder; +use Laminas\View\Helper\Placeholder\Container\AbstractContainer; + /** * Container for placeholder values + * + * @template TKey + * @template TValue + * @extends AbstractContainer */ -class Container extends Container\AbstractContainer +class Container extends AbstractContainer { } diff --git a/src/Helper/Placeholder/Container/AbstractContainer.php b/src/Helper/Placeholder/Container/AbstractContainer.php index be8bdcb6e..1341c84f4 100644 --- a/src/Helper/Placeholder/Container/AbstractContainer.php +++ b/src/Helper/Placeholder/Container/AbstractContainer.php @@ -6,7 +6,7 @@ use ArrayObject; use Laminas\View\Exception; -use ReturnTypeWillChange; // phpcs:ignore +use ReturnTypeWillChange; use function array_keys; use function array_shift; @@ -23,25 +23,29 @@ /** * Abstract class representing container for placeholder values + * + * @template TKey + * @template TValue + * @extends ArrayObject */ abstract class AbstractContainer extends ArrayObject { /** - * Whether or not to override all contents of placeholder + * Whether to override all contents of placeholder * * @const string */ public const SET = 'SET'; /** - * Whether or not to append contents to placeholder + * Whether to append contents to placeholder * * @const string */ public const APPEND = 'APPEND'; /** - * Whether or not to prepend contents to placeholder + * Whether to prepend contents to placeholder * * @const string */ @@ -50,7 +54,7 @@ abstract class AbstractContainer extends ArrayObject /** * Key to which to capture content * - * @var string + * @var TKey|null */ protected $captureKey; @@ -64,7 +68,7 @@ abstract class AbstractContainer extends ArrayObject /** * What type of capture (overwrite (set), append, prepend) to use * - * @var string + * @var string|null */ protected $captureType; @@ -98,6 +102,8 @@ abstract class AbstractContainer extends ArrayObject /** * Constructor - This is needed so that we can attach a class member as the ArrayObject container + * + * @final */ public function __construct() { @@ -145,7 +151,7 @@ public function toString($indent = null) * Start capturing content to push into placeholder * * @param string $type How to capture content into placeholder; append, prepend, or set - * @param mixed $key Key to which to capture content + * @param TKey $key Key to which to capture content * @throws Exception\RuntimeException If nested captures detected. * @return void */ @@ -159,8 +165,8 @@ public function captureStart($type = self::APPEND, $key = null) $this->captureLock = true; $this->captureType = $type; - if ((null !== $key) && is_scalar($key)) { - $this->captureKey = (string) $key; + if (is_scalar($key)) { + $this->captureKey = $key; } ob_start(); } @@ -173,11 +179,9 @@ public function captureStart($type = self::APPEND, $key = null) public function captureEnd() { $data = ob_get_clean(); - $key = null; + $key = $this->captureKey; $this->captureLock = false; - if (null !== $this->captureKey) { - $key = $this->captureKey; - } + switch ($this->captureType) { case self::SET: if (null !== $key) { @@ -214,13 +218,11 @@ public function captureEnd() /** * Get keys * - * @return array + * @return list */ public function getKeys() { - $array = $this->getArrayCopy(); - - return array_keys($array); + return array_keys($this->getArrayCopy()); } /** @@ -229,7 +231,7 @@ public function getKeys() * If single element registered, returns that element; otherwise, * serializes to array. * - * @return mixed + * @return TValue|array */ public function getValue() { @@ -254,14 +256,14 @@ public function getWhitespace($indent) $indent = str_repeat(' ', $indent); } - return (string) $indent; + return $indent; } /** * Set a single value * - * @param mixed $value - * @return static + * @param TValue $value + * @return $this */ public function set($value) { @@ -273,8 +275,8 @@ public function set($value) /** * Prepend a value to the top of the container * - * @param mixed $value - * @return self + * @param TValue $value + * @return $this */ public function prepend($value) { @@ -288,8 +290,8 @@ public function prepend($value) /** * Append a value to the end of the container * - * @param mixed $value - * @return self + * @param TValue $value + * @return $this */ #[ReturnTypeWillChange] public function append($value) @@ -318,7 +320,7 @@ public function nextIndex() * optionally, if a number is passed, it will be the number of spaces * * @param string|int $indent - * @return self + * @return $this */ public function setIndent($indent) { @@ -340,7 +342,7 @@ public function getIndent() * Set postfix for __toString() serialization * * @param string $postfix - * @return self + * @return $this */ public function setPostfix($postfix) { @@ -362,7 +364,7 @@ public function getPostfix() * Set prefix for __toString() serialization * * @param string $prefix - * @return self + * @return $this */ public function setPrefix($prefix) { @@ -386,7 +388,7 @@ public function getPrefix() * Used to implode elements in container * * @param string $separator - * @return self + * @return $this */ public function setSeparator($separator) { diff --git a/src/Helper/Placeholder/Container/AbstractStandalone.php b/src/Helper/Placeholder/Container/AbstractStandalone.php index 8a3d4fbd4..565ef6f78 100644 --- a/src/Helper/Placeholder/Container/AbstractStandalone.php +++ b/src/Helper/Placeholder/Container/AbstractStandalone.php @@ -12,7 +12,7 @@ use Laminas\View\Exception; use Laminas\View\Helper\AbstractHelper; use Laminas\View\Helper\Placeholder\Container; -use ReturnTypeWillChange; // phpcs:ignore +use ReturnTypeWillChange; use function call_user_func_array; use function class_exists; @@ -25,6 +25,19 @@ /** * Base class for targeted placeholder helpers + * + * @template TKey + * @template TValue + * @implements IteratorAggregate + * @implements ArrayAccess + * @method static setSeparator(string $separator) + * @method string getSeparator() + * @method static setIndent(int|string $indent) + * @method string getIndent() + * @method static setPrefix(string $prefix) + * @method string getPrefix() + * @method static setPostfix(string $postfix) + * @method string getPostfix() */ abstract class AbstractStandalone extends AbstractHelper implements IteratorAggregate, @@ -39,22 +52,19 @@ abstract class AbstractStandalone extends AbstractHelper implements */ protected $autoEscape = true; - /** @var AbstractContainer */ + /** @var AbstractContainer|null */ protected $container; /** * Default container class * - * @var string + * @var class-string */ protected $containerClass = Container::class; /** @var array */ protected $escapers = []; - /** - * Constructor - */ public function __construct() { $this->setContainer($this->getContainer()); @@ -88,8 +98,8 @@ public function __call($method, $args) /** * Overloading: set property value * - * @param string $key - * @param mixed $value + * @param TKey $key + * @param TValue $value * @return void */ public function __set($key, $value) @@ -101,8 +111,8 @@ public function __set($key, $value) /** * Overloading: retrieve property * - * @param string $key - * @return mixed + * @param TKey $key + * @return TValue|null */ public function __get($key) { @@ -115,7 +125,7 @@ public function __get($key) /** * Overloading: check if property is set * - * @param string $key + * @param TKey $key * @return bool */ public function __isset($key) @@ -127,7 +137,7 @@ public function __isset($key) /** * Overloading: unset property * - * @param string $key + * @param TKey $key * @return void */ public function __unset($key) @@ -184,7 +194,7 @@ protected function escapeAttribute($string) * Set whether or not auto escaping should be used * * @param bool $autoEscape whether or not to auto escape output - * @return AbstractStandalone + * @return $this */ public function setAutoEscape($autoEscape = true) { @@ -205,7 +215,7 @@ public function getAutoEscape() /** * Set container on which to operate * - * @return AbstractStandalone + * @return $this */ public function setContainer(AbstractContainer $container) { @@ -216,7 +226,7 @@ public function setContainer(AbstractContainer $container) /** * Retrieve placeholder container * - * @return AbstractContainer + * @return AbstractContainer */ public function getContainer() { @@ -244,10 +254,10 @@ public function deleteContainer() /** * Set the container class to use * - * @param string $name + * @param class-string $name * @throws Exception\InvalidArgumentException * @throws Exception\DomainException - * @return AbstractStandalone + * @return $this */ public function setContainerClass($name) { @@ -272,7 +282,7 @@ public function setContainerClass($name) /** * Retrieve the container class * - * @return string + * @return class-string */ public function getContainerClass() { @@ -325,7 +335,7 @@ public function count() /** * ArrayAccess: offsetExists * - * @param string|int $offset + * @param TKey $offset * @return bool */ #[ReturnTypeWillChange] @@ -337,8 +347,8 @@ public function offsetExists($offset) /** * ArrayAccess: offsetGet * - * @param string|int $offset - * @return mixed + * @param TKey $offset + * @return TValue */ #[ReturnTypeWillChange] public function offsetGet($offset) @@ -349,8 +359,8 @@ public function offsetGet($offset) /** * ArrayAccess: offsetSet * - * @param string|int $offset - * @param mixed $value + * @param TKey $offset + * @param TValue $value * @return void */ #[ReturnTypeWillChange] @@ -362,7 +372,7 @@ public function offsetSet($offset, $value) /** * ArrayAccess: offsetUnset * - * @param string|int $offset + * @param TKey $offset * @return void */ #[ReturnTypeWillChange] diff --git a/test/Helper/HeadLinkTest.php b/test/Helper/HeadLinkTest.php index f47ea7a3e..211573178 100644 --- a/test/Helper/HeadLinkTest.php +++ b/test/Helper/HeadLinkTest.php @@ -25,7 +25,6 @@ class HeadLinkTest extends TestCase { private HeadLink $helper; private EscapeHtmlAttr $attributeEscaper; - private string $basePath; private View $view; /** @@ -35,9 +34,8 @@ class HeadLinkTest extends TestCase protected function setUp(): void { Helper\Doctype::unsetDoctypeRegistry(); - $this->basePath = __DIR__ . '/_files/modules'; - $this->view = new View(); - $this->helper = new HeadLink(); + $this->view = new View(); + $this->helper = new HeadLink(); $this->helper->setView($this->view); $this->attributeEscaper = new EscapeHtmlAttr(); } @@ -51,24 +49,28 @@ public function testHeadLinkReturnsObjectInstance(): void public function testPrependThrowsExceptionWithoutArrayArgument(): void { $this->expectException(Exception\ExceptionInterface::class); + /** @psalm-suppress InvalidArgument */ $this->helper->prepend('foo'); } public function testAppendThrowsExceptionWithoutArrayArgument(): void { $this->expectException(Exception\ExceptionInterface::class); + /** @psalm-suppress InvalidArgument */ $this->helper->append('foo'); } public function testSetThrowsExceptionWithoutArrayArgument(): void { $this->expectException(Exception\ExceptionInterface::class); + /** @psalm-suppress InvalidArgument */ $this->helper->set('foo'); } public function testOffsetSetThrowsExceptionWithoutArrayArgument(): void { $this->expectException(Exception\ExceptionInterface::class); + /** @psalm-suppress InvalidArgument */ $this->helper->offsetSet(1, 'foo'); } diff --git a/test/Helper/HeadMetaTest.php b/test/Helper/HeadMetaTest.php index a0ff212fc..2646b883d 100644 --- a/test/Helper/HeadMetaTest.php +++ b/test/Helper/HeadMetaTest.php @@ -103,11 +103,9 @@ protected function executeOverloadAppend(string $type): void $this->assertCount($i + 1, $values); $item = $values[$i]; - self::assertIsObject($item); $this->assertObjectHasProperty('type', $item); $this->assertObjectHasProperty('modifiers', $item); $this->assertObjectHasProperty('content', $item); - self::assertIsString($item->type); $this->assertObjectHasProperty($item->type, $item); $this->assertEquals('keywords', $item->{$item->type}); $this->assertEquals($string, $item->content); @@ -128,7 +126,6 @@ protected function executeOverloadPrepend(string $type): void $this->assertObjectHasProperty('type', $item); $this->assertObjectHasProperty('modifiers', $item); $this->assertObjectHasProperty('content', $item); - self::assertIsString($item->type); $this->assertObjectHasProperty($item->type, $item); $this->assertEquals('keywords', $item->{$item->type}); $this->assertEquals($string, $item->content); @@ -146,8 +143,7 @@ protected function executeOverloadSet(string $type): void } $this->helper->$setAction('keywords', $string); - $values = $this->helper->getArrayCopy(); - self::assertIsArray($values); + $values = $this->helper->getContainer()->getArrayCopy(); $this->assertCount(1, $values); $item = array_shift($values); self::assertIsObject($item); @@ -155,7 +151,6 @@ protected function executeOverloadSet(string $type): void $this->assertObjectHasProperty('type', $item); $this->assertObjectHasProperty('modifiers', $item); $this->assertObjectHasProperty('content', $item); - self::assertIsString($item->type); $this->assertObjectHasProperty($item->type, $item); $this->assertEquals('keywords', $item->{$item->type}); $this->assertEquals($string, $item->content); diff --git a/test/Helper/HeadScriptTest.php b/test/Helper/HeadScriptTest.php index 46dbf0257..217f62823 100644 --- a/test/Helper/HeadScriptTest.php +++ b/test/Helper/HeadScriptTest.php @@ -7,14 +7,14 @@ use DOMDocument; use Generator; use Laminas\View; -use Laminas\View\Helper; use Laminas\View\Helper\Doctype; +use Laminas\View\Helper\EscapeHtmlAttr; +use Laminas\View\Helper\HeadScript; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use function array_shift; use function assert; -use function count; use function sprintf; use function strtolower; use function substr_count; @@ -25,36 +25,33 @@ class HeadScriptTest extends TestCase { - /** @var Helper\HeadScript */ + /** @var HeadScript */ public $helper; - /** @var Helper\EscapeHtmlAttr */ + /** @var EscapeHtmlAttr */ public $attributeEscaper; - /** @var string */ - public $basePath; - /** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ protected function setUp(): void { - $this->basePath = __DIR__ . '/_files/modules'; - $this->helper = new Helper\HeadScript(); - $this->attributeEscaper = new Helper\EscapeHtmlAttr(); + $this->helper = new HeadScript(); + $this->attributeEscaper = new EscapeHtmlAttr(); } public function testHeadScriptReturnsObjectInstance(): void { $placeholder = $this->helper->__invoke(); - $this->assertInstanceOf(Helper\HeadScript::class, $placeholder); + $this->assertInstanceOf(HeadScript::class, $placeholder); } public function testAppendThrowsExceptionWithInvalidArguments(): void { $this->expectException(View\Exception\InvalidArgumentException::class); $this->expectExceptionMessage('Invalid argument passed to append'); + /** @psalm-suppress InvalidArgument */ $this->helper->append('foo'); } @@ -62,6 +59,7 @@ public function testPrependThrowsExceptionWithInvalidArguments(): void { $this->expectException(View\Exception\InvalidArgumentException::class); $this->expectExceptionMessage('Invalid argument passed to prepend'); + /** @psalm-suppress InvalidArgument */ $this->helper->prepend('foo'); } @@ -69,6 +67,7 @@ public function testSetThrowsExceptionWithInvalidArguments(): void { $this->expectException(View\Exception\InvalidArgumentException::class); $this->expectExceptionMessage('Invalid argument passed to set'); + /** @psalm-suppress InvalidArgument */ $this->helper->set('foo'); } @@ -76,6 +75,7 @@ public function testOffsetSetThrowsExceptionWithInvalidArguments(): void { $this->expectException(View\Exception\InvalidArgumentException::class); $this->expectExceptionMessage('Invalid argument passed to offsetSet'); + /** @psalm-suppress InvalidArgument */ $this->helper->offsetSet(1, 'foo'); } @@ -94,9 +94,7 @@ private function executeOverloadAppend(string $type): void $values = $this->helper->getContainer()->getArrayCopy(); self::assertCount($i + 1, $values); $item = $values[$i]; - self::assertIsObject($item); if ('file' === $type) { - self::assertIsArray($item->attributes); self::assertEquals($string, $item->attributes['src']); } elseif ('script' === $type) { self::assertEquals($string, $item->source); @@ -117,7 +115,6 @@ private function executeOverloadPrepend(string $type): void $first = array_shift($values); self::assertIsObject($first); if ('file' === $type) { - self::assertIsArray($first->attributes); self::assertEquals($string, $first->attributes['src']); } elseif ('script' === $type) { self::assertEquals($string, $first->source); @@ -138,9 +135,7 @@ private function executeOverloadSet(string $type): void $values = $this->helper->getContainer()->getArrayCopy(); self::assertCount(1, $values); $item = $values[0]; - self::assertIsObject($item); if ('file' === $type) { - self::assertIsArray($item->attributes); self::assertEquals($string, $item->attributes['src']); } elseif ('script' === $type) { self::assertEquals($string, $item->source); @@ -156,9 +151,7 @@ private function executeOverloadOffsetSet(string $type): void $values = $this->helper->getContainer()->getArrayCopy(); self::assertCount(1, $values); $item = $values[5]; - self::assertIsObject($item); if ('file' === $type) { - self::assertIsArray($item->attributes); self::assertEquals($string, $item->attributes['src']); } elseif ('script' === $type) { self::assertEquals($string, $item->source); @@ -235,7 +228,7 @@ public function testHeadScriptAppropriatelySetsScriptItems(): void $this->helper->__invoke('FILE', 'foo', 'set') ->__invoke('SCRIPT', 'bar', 'prepend') ->__invoke('SCRIPT', 'baz', 'append'); - $items = $this->helper->getArrayCopy(); + $items = $this->helper->getContainer()->getArrayCopy(); for ($i = 0; $i < 3; ++$i) { $item = $items[$i]; switch ($i) { @@ -288,8 +281,8 @@ public function testCapturingCapturesToObject(): void $this->helper->captureStart(); echo 'foobar'; $this->helper->captureEnd(); - $values = $this->helper->getArrayCopy(); - $this->assertEquals(1, count($values), var_export($values, true)); + $values = $this->helper->getContainer()->getArrayCopy(); + $this->assertCount(1, $values, var_export($values, true)); $item = array_shift($values); $this->assertStringContainsString('foobar', $item->source); } @@ -317,7 +310,7 @@ public function testDoesNotAllowDuplicateFiles(): void { $this->helper->__invoke('FILE', '/js/prototype.js'); $this->helper->__invoke('FILE', '/js/prototype.js'); - $this->assertEquals(1, count($this->helper)); + $this->assertCount(1, $this->helper); } public function testRenderingDoesNotRenderArbitraryAttributesByDefault(): void diff --git a/test/Helper/HeadStyleTest.php b/test/Helper/HeadStyleTest.php index 5924f33b8..9646ea9f0 100644 --- a/test/Helper/HeadStyleTest.php +++ b/test/Helper/HeadStyleTest.php @@ -34,6 +34,7 @@ public function testAppendThrowsExceptionGivenNonStyleArgument(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Invalid value passed to append'); + /** @psalm-suppress InvalidArgument */ $this->helper->append('foo'); } @@ -41,6 +42,7 @@ public function testPrependThrowsExceptionGivenNonStyleArgument(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Invalid value passed to prepend'); + /** @psalm-suppress InvalidArgument */ $this->helper->prepend('foo'); } @@ -48,6 +50,7 @@ public function testSetThrowsExceptionGivenNonStyleArgument(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Invalid value passed to set'); + /** @psalm-suppress InvalidArgument */ $this->helper->set('foo'); } @@ -55,6 +58,7 @@ public function testOffsetSetThrowsExceptionGivenNonStyleArgument(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Invalid value passed to offsetSet'); + /** @psalm-suppress InvalidArgument */ $this->helper->offsetSet(1, 'foo'); } @@ -190,12 +194,6 @@ public function testHeadStyleProxiesProperly(): void ->__invoke($style3, 'APPEND'); self::assertCount(3, $this->helper); $values = $this->helper->getContainer()->getArrayCopy(); - self::assertIsObject($values[0]); - self::assertIsObject($values[1]); - self::assertIsObject($values[2]); - self::assertIsString($values[0]->content); - self::assertIsString($values[1]->content); - self::assertIsString($values[2]->content); self::assertStringContainsString($values[0]->content, $style2); self::assertStringContainsString($values[1]->content, $style1); self::assertStringContainsString($values[2]->content, $style3); @@ -235,7 +233,6 @@ public function testCapturingCapturesToObject(): void $item = array_shift($values); self::assertIsObject($item); self::assertObjectHasProperty('content', $item); - self::assertIsString($item->content); self::assertStringContainsString('foobar', $item->content); } @@ -246,9 +243,7 @@ public function testOverloadingOffsetSetWritesToSpecifiedIndex(): void self::assertCount(1, $values); self::assertTrue(isset($values[100])); $item = $values[100]; - self::assertIsObject($item); self::assertObjectHasProperty('content', $item); - self::assertIsString($item->content); self::assertStringContainsString('foobar', $item->content); } diff --git a/test/Helper/HeadTitleTest.php b/test/Helper/HeadTitleTest.php index 9b19feaf6..759f4841c 100644 --- a/test/Helper/HeadTitleTest.php +++ b/test/Helper/HeadTitleTest.php @@ -5,64 +5,55 @@ namespace LaminasTest\View\Helper; use Laminas\I18n\Translator\Translator; -use Laminas\View\Helper; +use Laminas\View\Helper\HeadTitle; use PHPUnit\Framework\TestCase; class HeadTitleTest extends TestCase { - /** @var Helper\HeadTitle */ + /** @var HeadTitle */ public $helper; - /** @var string */ - public $basePath; - - /** - * Sets up the fixture, for example, open a network connection. - * This method is called before a test is executed. - */ protected function setUp(): void { - $this->basePath = __DIR__ . '/_files/modules'; - $this->helper = new Helper\HeadTitle(); + $this->helper = new HeadTitle(); } - public function testHeadTitleReturnsObjectInstance(): void + public function testInvokeWithNoArgumentsReturnsSelf(): void { - $placeholder = $this->helper->__invoke(); - $this->assertInstanceOf(Helper\HeadTitle::class, $placeholder); + self::assertSame($this->helper, $this->helper->__invoke()); } public function testCanSetTitleViaHeadTitle(): void { $placeholder = $this->helper->__invoke('Foo Bar', 'SET'); - $this->assertEquals('Foo Bar', $placeholder->renderTitle()); + self::assertEquals('Foo Bar', $placeholder->renderTitle()); } public function testToStringWrapsToTitleTag(): void { $placeholder = $this->helper->__invoke('Foo Bar', 'SET'); - $this->assertEquals('Foo Bar', $placeholder->toString()); + self::assertEquals('Foo Bar', $placeholder->toString()); } public function testCanAppendTitleViaHeadTitle(): void { $this->helper->__invoke('Foo'); - $placeholder = $this->helper->__invoke('Bar'); - $this->assertEquals('FooBar', $placeholder->renderTitle()); + $this->helper->__invoke('Bar'); + self::assertEquals('FooBar', $this->helper->renderTitle()); } public function testCanPrependTitleViaHeadTitle(): void { $this->helper->__invoke('Foo'); $placeholder = $this->helper->__invoke('Bar', 'PREPEND'); - $this->assertEquals('BarFoo', $placeholder->renderTitle()); + self::assertEquals('BarFoo', $placeholder->renderTitle()); } public function testReturnedPlaceholderRenderTitleContainsFullTitleElement(): void { $this->helper->__invoke('Foo'); - $placeholder = $this->helper->__invoke('Bar', 'APPEND')->setSeparator(' :: '); - $this->assertEquals('Foo :: Bar', $placeholder->renderTitle()); + $this->helper->__invoke('Bar', 'APPEND')->setSeparator(' :: '); + self::assertEquals('Foo :: Bar', $this->helper->renderTitle()); } public function testRenderTitleEscapesEntries(): void @@ -82,7 +73,7 @@ public function testRenderTitleEscapesSeparator(): void $this->assertStringNotContainsString('
', $string); $this->assertStringContainsString('Foo', $string); $this->assertStringContainsString('Bar', $string); - $this->assertStringContainsString('br /', $string); + $this->assertStringContainsString('<br />', $string); } public function testIndentationIsHonored(): void @@ -106,7 +97,7 @@ public function testAutoEscapeIsHonored(): void $this->assertEquals('Some Title ©right;', $this->helper->renderTitle()); } - public function testLaminas918(): void + public function testThatAPrefixAndPostfixCanBeApplied(): void { $this->helper->__invoke('Some Title'); $this->helper->setPrefix('Prefix: '); @@ -115,7 +106,7 @@ public function testLaminas918(): void $this->assertEquals('Prefix: Some Title :Postfix', $this->helper->renderTitle()); } - public function testLaminas577(): void + public function testThatPrefixAndPostfixAreEscapedProperly(): void { $this->helper->setAutoEscape(true); $this->helper->__invoke('Some Title'); @@ -171,7 +162,17 @@ public function testCanPrependTitlesUsingDefaultAttachOrder(): void public function testReturnTypeDefaultAttachOrder(): void { - $this->assertInstanceOf(Helper\HeadTitle::class, $this->helper->setDefaultAttachOrder('PREPEND')); + $this->assertInstanceOf(HeadTitle::class, $this->helper->setDefaultAttachOrder('PREPEND')); $this->assertEquals('PREPEND', $this->helper->getDefaultAttachOrder()); } + + public function testCommonMagicMethods(): void + { + $this->helper->set('a little'); + $this->helper->prepend('Mary had'); + $this->helper->append('lamb'); + $this->helper->setSeparator(' '); + + self::assertSame('Mary had a little lamb', (string) $this->helper); + } } diff --git a/test/Helper/Placeholder/ContainerTest.php b/test/Helper/Placeholder/ContainerTest.php index 02468897d..0ee42055b 100644 --- a/test/Helper/Placeholder/ContainerTest.php +++ b/test/Helper/Placeholder/ContainerTest.php @@ -5,8 +5,10 @@ namespace LaminasTest\View\Helper\Placeholder; use Exception; -use Laminas\View\Helper\Placeholder\Container as PlaceholderContainer; +use Laminas\View\Helper\Placeholder\Container; +use LaminasTest\View\Helper\TestAsset\NonStringableObject; use PHPUnit\Framework\TestCase; +use Throwable; use function array_keys; use function array_pop; @@ -20,8 +22,8 @@ class ContainerTest extends TestCase { - /** @var PlaceholderContainer */ - public $container; + /** @var Container */ + private Container $container; /** * Sets up the fixture, for example, open a network connection. @@ -29,7 +31,9 @@ class ContainerTest extends TestCase */ protected function setUp(): void { - $this->container = new PlaceholderContainer(); + /** @var Container $container */ + $container = new Container(); + $this->container = $container; } public function testSetSetsASingleValue(): void @@ -136,16 +140,18 @@ public function testCapturingToPlaceholderStoresContent(): void $this->container->captureStart(); echo 'This is content intended for capture'; $this->container->captureEnd(); + $value = $this->container->getValue(); + self::assertIsString($value); $this->assertStringContainsString( 'This is content intended for capture', - (string) $this->container->getValue() + $value, ); } public function testCapturingToPlaceholderAppendsContent(): void { - $this->container[] = 'foo'; - $originalCount = count($this->container); + $this->container->append('foo'); + $originalCount = count($this->container); $this->container->captureStart(); echo 'This is content intended for capture'; @@ -161,14 +167,14 @@ public function testCapturingToPlaceholderAppendsContent(): void $this->assertEquals('foo', $value[$lastIndex - 1]); $this->assertStringContainsString( 'This is content intended for capture', - (string) $value[$lastIndex] + $value[$lastIndex] ); } public function testCapturingToPlaceholderUsingPrependPrependsContent(): void { - $this->container[] = 'foo'; - $originalCount = count($this->container); + $this->container->append('foo'); + $originalCount = count($this->container); $this->container->captureStart('PREPEND'); echo 'This is content intended for capture'; @@ -182,21 +188,23 @@ public function testCapturingToPlaceholderUsingPrependPrependsContent(): void $lastIndex = array_pop($keys); assert(is_int($lastIndex)); $this->assertEquals('foo', $value[$lastIndex]); - $this->assertStringContainsString('This is content intended for capture', (string) $value[$lastIndex - 1]); + $this->assertStringContainsString('This is content intended for capture', $value[$lastIndex - 1]); } public function testCapturingToPlaceholderUsingSetOverwritesContent(): void { - $this->container[] = 'foo'; + $this->container->append('foo'); $this->container->captureStart('SET'); echo 'This is content intended for capture'; $this->container->captureEnd(); $this->assertCount(1, $this->container); + $value = $this->container->getValue(); + self::assertIsString($value); $this->assertStringContainsString( 'This is content intended for capture', - (string) $this->container->getValue() + $value ); } @@ -210,7 +218,7 @@ public function testCapturingToPlaceholderKeyUsingSetCapturesContent(): void $this->assertTrue(isset($this->container['key'])); $this->assertStringContainsString( 'This is content intended for capture', - (string) $this->container['key'] + $this->container['key'] ); } @@ -223,7 +231,7 @@ public function testCapturingToPlaceholderKeyUsingSetReplacesContentAtKey(): voi $this->assertCount(1, $this->container); $this->assertTrue(isset($this->container['key'])); - $value = (string) $this->container['key']; + $value = $this->container['key']; $this->assertStringContainsString('This is content intended for capture', $value); } @@ -236,20 +244,20 @@ public function testCapturingToPlaceholderKeyUsingAppendAppendsContentAtKey(): v $this->assertCount(1, $this->container); $this->assertTrue(isset($this->container['key'])); - $value = (string) $this->container['key']; + $value = $this->container['key']; $this->assertStringContainsString('Foobar This is content intended for capture', $value); } public function testNestedCapturesThrowsException(): void { - $this->container[] = 'foo'; - $caught = false; + $this->container->append('foo'); + $caught = false; try { $this->container->captureStart('SET'); $this->container->captureStart('SET'); $this->container->captureEnd(); $this->container->captureEnd(); - } catch (Exception $e) { + } catch (Exception) { $this->container->captureEnd(); $caught = true; } @@ -275,18 +283,18 @@ public function testToStringWithModifiersAndSingleValueReturnsFormattedValue(): public function testToStringWithNoModifiersAndCollectionReturnsImplodedString(): void { - $this->container[] = 'foo'; - $this->container[] = 'bar'; - $this->container[] = 'baz'; - $value = $this->container->toString(); + $this->container->append('foo'); + $this->container->append('bar'); + $this->container->append('baz'); + $value = $this->container->toString(); $this->assertEquals('foobarbaz', $value); } public function testToStringWithModifiersAndCollectionReturnsFormattedString(): void { - $this->container[] = 'foo'; - $this->container[] = 'bar'; - $this->container[] = 'baz'; + $this->container->append('foo'); + $this->container->append('bar'); + $this->container->append('baz'); $this->container->setPrefix('
  • ') ->setSeparator('
  • ') ->setPostfix('
'); @@ -296,9 +304,9 @@ public function testToStringWithModifiersAndCollectionReturnsFormattedString(): public function testToStringWithModifiersAndCollectionReturnsFormattedStringWithIndentation(): void { - $this->container[] = 'foo'; - $this->container[] = 'bar'; - $this->container[] = 'baz'; + $this->container->append('foo'); + $this->container->append('bar'); + $this->container->append('baz'); $this->container->setPrefix('
  • ') ->setSeparator('
  • ' . PHP_EOL . '
  • ') ->setPostfix('
') @@ -310,9 +318,9 @@ public function testToStringWithModifiersAndCollectionReturnsFormattedStringWith public function testToStringProxiesToToString(): void { - $this->container[] = 'foo'; - $this->container[] = 'bar'; - $this->container[] = 'baz'; + $this->container->append('foo'); + $this->container->append('bar'); + $this->container->append('baz'); $this->container->setPrefix('
  • ') ->setSeparator('
  • ') ->setPostfix('
'); @@ -320,6 +328,18 @@ public function testToStringProxiesToToString(): void $this->assertEquals('
  • foo
  • bar
  • baz
', $value); } + public function testThatToStringBehaviourForNonStringableElementsWillCauseErrors(): void + { + $container = new Container(); + $container->append(new NonStringableObject()); + try { + $container->toString(); + self::fail('An exception was not thrown'); + } catch (Throwable $e) { + self::assertStringContainsString('could not be converted to string', $e->getMessage()); + } + } + public function testPrependPushesValueToTopOfContainer(): void { $this->container['foo'] = 'bar'; diff --git a/test/Helper/Placeholder/StandaloneContainerTest.php b/test/Helper/Placeholder/StandaloneContainerTest.php index ba410090b..0494c0339 100644 --- a/test/Helper/Placeholder/StandaloneContainerTest.php +++ b/test/Helper/Placeholder/StandaloneContainerTest.php @@ -7,6 +7,7 @@ use Laminas\View\Exception\DomainException; use Laminas\View\Exception\InvalidArgumentException; use Laminas\View\Helper\Placeholder\Container; +use Laminas\View\Helper\Placeholder\Container\AbstractContainer; use Laminas\View\Renderer\PhpRenderer as View; use LaminasTest\View\Helper\TestAsset\Bar; use LaminasTest\View\Helper\TestAsset\Foo; @@ -14,8 +15,7 @@ class StandaloneContainerTest extends TestCase { - /** @var Foo */ - protected $helper; + private Foo $helper; /** * Sets up the fixture, for example, open a network connection. @@ -37,14 +37,14 @@ public function testSetContainer(): void public function testGetContainer(): void { $container = $this->helper->getContainer(); - $this->assertInstanceOf(Container::class, $container); + $this->assertInstanceOf(AbstractContainer::class, $container); } public function testGetContainerCreatesNewContainer(): void { $this->helper->deleteContainer(); $container = $this->helper->getContainer(); - $this->assertInstanceOf(Container::class, $container); + $this->assertInstanceOf(AbstractContainer::class, $container); } public function testDeleteContainer(): void @@ -57,12 +57,14 @@ public function testDeleteContainer(): void public function testSetContainerClassThrowsDomainException(): void { $this->expectException(DomainException::class); - $this->helper->setContainerClass('bat'); + /** @psalm-suppress UndefinedClass, ArgumentTypeCoercion */ + $this->helper->setContainerClass('not-a-known-class'); } public function testSetContainerClassThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); + /** @psalm-suppress InvalidArgument */ $this->helper->setContainerClass(static::class); } @@ -82,11 +84,11 @@ public function testViewAccessorWorks(): void public function testContainerDoesNotPersistBetweenInstances(): void { $foo1 = new Foo(); - $foo1->append('Foo'); + $foo1->getContainer()->append('Foo'); $foo1->setSeparator(' - '); $foo2 = new Foo(); - $foo2->append('Bar'); + $foo2->getContainer()->append('Bar'); $test = $foo2->toString(); $this->assertStringNotContainsString('Foo', $test); diff --git a/test/Helper/TestAsset/Bar.php b/test/Helper/TestAsset/Bar.php index 6a233f51a..599558f84 100644 --- a/test/Helper/TestAsset/Bar.php +++ b/test/Helper/TestAsset/Bar.php @@ -6,6 +6,7 @@ use Laminas\View\Helper\Placeholder\Container\AbstractContainer; +/** @extends AbstractContainer */ class Bar extends AbstractContainer { } diff --git a/test/Helper/TestAsset/Foo.php b/test/Helper/TestAsset/Foo.php index c9a9332ba..24968fab6 100644 --- a/test/Helper/TestAsset/Foo.php +++ b/test/Helper/TestAsset/Foo.php @@ -6,6 +6,7 @@ use Laminas\View\Helper\Placeholder\Container\AbstractStandalone; +/** @extends AbstractStandalone */ class Foo extends AbstractStandalone { } diff --git a/test/Helper/TestAsset/MockContainer.php b/test/Helper/TestAsset/MockContainer.php index 39819d984..e25bad837 100644 --- a/test/Helper/TestAsset/MockContainer.php +++ b/test/Helper/TestAsset/MockContainer.php @@ -5,7 +5,15 @@ namespace LaminasTest\View\Helper\TestAsset; use Laminas\View\Helper\Placeholder\Container\AbstractContainer; +use LaminasTest\View\Helper\Placeholder\RegistryTest; +/** + * @deprecated Should be removed in 3.0 when RegistryTest is removed + * + * @see RegistryTest + * + * @psalm-suppress MissingTemplateParam + */ class MockContainer extends AbstractContainer { /** @var array */ diff --git a/test/Helper/TestAsset/NonStringableObject.php b/test/Helper/TestAsset/NonStringableObject.php new file mode 100644 index 000000000..635c9ed43 --- /dev/null +++ b/test/Helper/TestAsset/NonStringableObject.php @@ -0,0 +1,9 @@ + Date: Wed, 19 Jul 2023 20:13:30 +0100 Subject: [PATCH 25/32] Reduce calls to $this->getContainer() in favour of a local variable. Also further type inference improvements and psalm fixes Signed-off-by: George Steel --- psalm-baseline.xml | 26 -------------------------- src/Helper/HeadLink.php | 13 +++++++------ src/Helper/HeadMeta.php | 28 ++++++++++++++-------------- src/Helper/HeadScript.php | 15 ++++++++------- src/Helper/HeadStyle.php | 14 +++++++------- src/Helper/HeadTitle.php | 16 +++++++++------- 6 files changed, 45 insertions(+), 67 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 01fd07451..324c4565b 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -289,7 +289,6 @@ $args[1] $args[2] $index - $item $type]]> content]]> type]]> @@ -303,9 +302,7 @@ $doctype - $indent $index - $item $key $type $value @@ -321,10 +318,6 @@ isRdfa isXhtml - - $indent - $indent - parent::__call($method, $args) parent::__call($method, $args) @@ -346,9 +339,6 @@ plugin plugin - - getWhitespace -
@@ -374,7 +364,6 @@ $content $index - $item $key $type $value @@ -414,17 +403,10 @@ - - $item - content)]]> content)]]> content) || ! is_string($item->content)]]> - isValid($value)]]> - isValid($value)]]> - isValid($value)]]> - isValid($value)]]> offsetSet @@ -448,14 +430,6 @@ is_string($content) - - - $item - - - $item - - $htmlObject diff --git a/src/Helper/HeadLink.php b/src/Helper/HeadLink.php index 977ad7b28..3baea603e 100644 --- a/src/Helper/HeadLink.php +++ b/src/Helper/HeadLink.php @@ -358,17 +358,18 @@ public function itemToString(object $item) */ public function toString($indent = null) { - $indent = null !== $indent - ? $this->getContainer()->getWhitespace($indent) - : $this->getContainer()->getIndent(); + $container = $this->getContainer(); + $indent = null !== $indent + ? $container->getWhitespace($indent) + : $container->getIndent(); $items = []; - $this->getContainer()->ksort(); - foreach ($this as $item) { + $container->ksort(); + foreach ($container as $item) { $items[] = $this->itemToString($item); } - return $indent . implode($this->escape($this->getContainer()->getSeparator()) . $indent, $items); + return $indent . implode($this->escape($container->getSeparator()) . $indent, $items); } /** diff --git a/src/Helper/HeadMeta.php b/src/Helper/HeadMeta.php index a0982ab89..551cbdea7 100644 --- a/src/Helper/HeadMeta.php +++ b/src/Helper/HeadMeta.php @@ -8,7 +8,6 @@ use Laminas\View\Exception; use Laminas\View\Helper\Placeholder\Container\AbstractContainer; use Laminas\View\Helper\Placeholder\Container\AbstractStandalone; -use stdClass; use function array_shift; use function array_unshift; @@ -195,19 +194,20 @@ public function __call($method, $args) */ public function toString($indent = null) { - $indent = null !== $indent - ? $this->getWhitespace($indent) - : $this->getIndent(); + $container = $this->getContainer(); + $indent = null !== $indent + ? $container->getWhitespace($indent) + : $container->getIndent(); $items = []; - $this->getContainer()->ksort(); + $container->ksort(); $doctype = $this->view->plugin('doctype'); assert($doctype instanceof Doctype); $isHtml5 = $doctype->isHtml5(); try { - foreach ($this as $item) { + foreach ($container as $item) { $content = $this->itemToString($item); if ($isHtml5 && $item->type === 'charset') { @@ -222,7 +222,7 @@ public function toString($indent = null) return ''; } - return $indent . implode($this->escape($this->getSeparator()) . $indent, $items); + return $indent . implode($this->escape($container->getSeparator()) . $indent, $items); } /** @@ -361,7 +361,6 @@ protected function normalizeType($type) * * @param mixed $item * @return bool - * @psalm-param-out ObjectShape $item */ protected function isValid($item) { @@ -461,7 +460,7 @@ public function offsetUnset($index) /** * Prepend * - * @param object $value + * @param object $value * @throws Exception\InvalidArgumentException * @return AbstractContainer */ @@ -510,11 +509,12 @@ public function set($value) */ public function setCharset($charset) { - $item = new stdClass(); - $item->type = 'charset'; - $item->charset = $charset; - $item->content = null; - $item->modifiers = []; + $item = (object) [ + 'type' => 'charset', + 'charset' => $charset, + 'content' => null, + 'modifiers' => [], + ]; if (! $this->isValid($item)) { throw new Exception\InvalidArgumentException( diff --git a/src/Helper/HeadScript.php b/src/Helper/HeadScript.php index b2123c3ac..085f01481 100644 --- a/src/Helper/HeadScript.php +++ b/src/Helper/HeadScript.php @@ -272,9 +272,10 @@ public function __call($method, $args) */ public function toString($indent = null) { - $indent = null !== $indent - ? $this->getContainer()->getWhitespace($indent) - : $this->getContainer()->getIndent(); + $container = $this->getContainer(); + $indent = null !== $indent + ? $container->getWhitespace($indent) + : $container->getIndent(); if ($this->view instanceof PhpRenderer) { $doctype = $this->view->plugin('doctype'); @@ -289,8 +290,8 @@ public function toString($indent = null) $escapeEnd = $useCdata ? '//]]>' : '//-->'; $items = []; - $this->getContainer()->ksort(); - foreach ($this as $item) { + $container->ksort(); + foreach ($container as $item) { if (! $this->isValid($item)) { continue; } @@ -298,7 +299,7 @@ public function toString($indent = null) $items[] = $this->itemToString($item, $indent, $escapeStart, $escapeEnd); } - return implode($this->getSeparator(), $items); + return implode($container->getSeparator(), $items); } /** @@ -399,7 +400,7 @@ protected function isDuplicate($file) * * @internal This method will become private in version 3.0 * - * @param mixed $value Is the given script valid? + * @param mixed $value Is the given script valid? * @return bool */ protected function isValid($value) diff --git a/src/Helper/HeadStyle.php b/src/Helper/HeadStyle.php index adc6f91ac..9bc3df0a0 100644 --- a/src/Helper/HeadStyle.php +++ b/src/Helper/HeadStyle.php @@ -191,20 +191,21 @@ public function __call($method, $args) */ public function toString($indent = null) { - $indent = null !== $indent - ? $this->getContainer()->getWhitespace($indent) - : $this->getContainer()->getIndent(); + $container = $this->getContainer(); + $indent = null !== $indent + ? $container->getWhitespace($indent) + : $container->getIndent(); $items = []; - $this->getContainer()->ksort(); - foreach ($this as $item) { + $container->ksort(); + foreach ($container as $item) { if (! $this->isValid($item)) { continue; } $items[] = $this->itemToString($item, $indent); } - $return = implode($this->getContainer()->getSeparator(), $items); + $return = implode($container->getSeparator(), $items); return $indent . preg_replace("/(\r\n?|\n)/", '$1' . $indent, $return); } @@ -282,7 +283,6 @@ public function createData($content, array $attributes) * @internal This method is internal and will be made private in version 3.0 * * @return bool - * @psalm-assert-if-true ObjectShape $value */ protected function isValid(mixed $value) { diff --git a/src/Helper/HeadTitle.php b/src/Helper/HeadTitle.php index 61e8eff32..2547ddc12 100644 --- a/src/Helper/HeadTitle.php +++ b/src/Helper/HeadTitle.php @@ -69,9 +69,10 @@ public function __invoke($title = null, $setType = null) */ public function toString($indent = null) { - $indent = null !== $indent - ? $this->getContainer()->getWhitespace($indent) - : $this->getContainer()->getIndent(); + $container = $this->getContainer(); + $indent = null !== $indent + ? $container->getWhitespace($indent) + : $container->getIndent(); $output = $this->renderTitle(); @@ -88,21 +89,22 @@ public function renderTitle() $items = []; $itemCallback = $this->getTitleItemCallback(); - foreach ($this as $item) { + $container = $this->getContainer(); + foreach ($container as $item) { $items[] = $itemCallback($item); } - $separator = $this->getContainer()->getSeparator(); + $separator = $container->getSeparator(); $output = ''; - $prefix = $this->getContainer()->getPrefix(); + $prefix = $container->getPrefix(); if ($prefix) { $output .= $prefix; } $output .= implode($separator, $items); - $postfix = $this->getContainer()->getPostfix(); + $postfix = $container->getPostfix(); if ($postfix) { $output .= $postfix; } From 4a2ba1a21dfe130b55124e855c636723fc62be86 Mon Sep 17 00:00:00 2001 From: George Steel Date: Wed, 19 Jul 2023 21:04:15 +0100 Subject: [PATCH 26/32] Reduce psalm issues in tests Signed-off-by: George Steel --- psalm-baseline.xml | 45 ------------ test/Helper/HeadMetaTest.php | 123 +++++++++++++++++---------------- test/Helper/HeadScriptTest.php | 29 +++----- 3 files changed, 72 insertions(+), 125 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 324c4565b..0afc9c950 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -2150,44 +2150,8 @@ - - - - - - - $modifiers - $value - $values - $values - $values - $values - - - $item - $item - $modifiers - $value - $values - $values - - - - - - - content]]> - content]]> - name]]> - name]]> - type]]> - type]]> - - getArrayCopy - getArrayCopy - getValue offsetSetHttpEquiv offsetSetHttpEquiv offsetSetName @@ -2195,15 +2159,6 @@ offsetSetName - - - - - - - - - HtmlFlash diff --git a/test/Helper/HeadMetaTest.php b/test/Helper/HeadMetaTest.php index 2646b883d..b47cb7527 100644 --- a/test/Helper/HeadMetaTest.php +++ b/test/Helper/HeadMetaTest.php @@ -4,30 +4,30 @@ namespace LaminasTest\View\Helper; +use Laminas\Escaper\Escaper; use Laminas\View\Exception; use Laminas\View\Exception\ExceptionInterface as ViewException; use Laminas\View\Helper; use Laminas\View\Helper\Doctype; -use Laminas\View\Helper\EscapeHtmlAttr; use Laminas\View\Helper\HeadMeta; use Laminas\View\Renderer\PhpRenderer as View; use PHPUnit\Framework\TestCase; use function array_shift; -use function count; +use function restore_error_handler; use function set_error_handler; use function sprintf; use function str_replace; use function substr_count; use function ucwords; +use const E_USER_WARNING; use const PHP_EOL; class HeadMetaTest extends TestCase { private HeadMeta $helper; - private EscapeHtmlAttr $attributeEscaper; - private ?string $error = null; + private Escaper $escaper; private View $view; /** @@ -42,12 +42,7 @@ protected function setUp(): void $doctype->__invoke('XHTML1_STRICT'); $this->helper = new HeadMeta(); $this->helper->setView($this->view); - $this->attributeEscaper = new EscapeHtmlAttr(); - } - - public function handleErrors(int $errno, string $errstr): void - { - $this->error = $errstr; + $this->escaper = new Escaper(); } public function testHeadMetaReturnsObjectInstance(): void @@ -203,8 +198,8 @@ public function testOverloadingThrowsExceptionWithInvalidMethodType(): void public function testCanBuildMetaTagsWithAttributes(): void { $this->helper->setName('keywords', 'foo bar', ['lang' => 'us_en', 'scheme' => 'foo', 'bogus' => 'unused']); - $value = $this->helper->getValue(); - + $value = $this->helper->getContainer()->getValue(); + self::assertIsObject($value); $this->assertObjectHasProperty('modifiers', $value); $modifiers = $value->modifiers; $this->assertArrayHasKey('lang', $modifiers); @@ -229,31 +224,45 @@ public function testToStringReturnsValidHtml(): void $metas = substr_count($string, 'http-equiv="'); $this->assertEquals(1, $metas); - $attributeEscaper = $this->attributeEscaper; - $this->assertStringContainsString('http-equiv="screen" content="projection"', $string); - $this->assertStringContainsString('name="keywords" content="' . $attributeEscaper('foo bar') . '"', $string); + $this->assertStringContainsString( + 'name="keywords" content="' . $this->escaper->escapeHtmlAttr('foo bar') . '"', + $string, + ); $this->assertStringContainsString('lang="us_en"', $string); $this->assertStringContainsString('scheme="foo"', $string); $this->assertStringNotContainsString('bogus', $string); $this->assertStringNotContainsString('unused', $string); - $this->assertStringContainsString('name="title" content="' . $attributeEscaper('boo bah') . '"', $string); + $this->assertStringContainsString( + 'name="title" content="' . $this->escaper->escapeHtmlAttr('boo bah') . '"', + $string, + ); } public function testToStringWhenInvalidKeyProvidedShouldConvertThrownException(): void { $this->helper->__invoke('some-content', 'tag value', 'not allowed key'); - set_error_handler([$this, 'handleErrors']); - $string = @$this->helper->toString(); - $this->assertEquals('', $string); - $this->assertIsString($this->error); + $error = null; + set_error_handler(function (int $code, string $message) use (&$error): bool { + self::assertSame(E_USER_WARNING, $code); + $error = $message; + + return true; + }, E_USER_WARNING); + $string = $this->helper->toString(); + self::assertEquals('', $string); + self::assertEquals( + 'Invalid type "not allowed key" provided for meta', + $error, + ); + restore_error_handler(); } public function testHeadMetaHelperCreatesItemEntry(): void { $this->helper->__invoke('foo', 'keywords'); - $values = $this->helper->getArrayCopy(); - $this->assertEquals(1, count($values)); + $values = $this->helper->getContainer()->getArrayCopy(); + $this->assertCount(1, $values); $item = array_shift($values); $this->assertEquals('foo', $item->content); $this->assertEquals('name', $item->type); @@ -263,8 +272,8 @@ public function testHeadMetaHelperCreatesItemEntry(): void public function testOverloadingOffsetInsertsAtOffset(): void { $this->helper->offsetSetName(100, 'keywords', 'foo'); - $values = $this->helper->getArrayCopy(); - $this->assertEquals(1, count($values)); + $values = $this->helper->getContainer()->getArrayCopy(); + $this->assertCount(1, $values); $this->assertArrayHasKey(100, $values); $item = $values[100]; $this->assertEquals('foo', $item->content); @@ -290,36 +299,32 @@ public function testStringRepresentationReflectsDoctype(): void $test = $this->helper->toString(); - $attributeEscaper = $this->attributeEscaper; - $this->assertStringNotContainsString('/>', $test); - $this->assertStringContainsString($attributeEscaper('some content'), $test); + $this->assertStringContainsString($this->escaper->escapeHtmlAttr('some content'), $test); $this->assertStringContainsString('foo', $test); } public function testSetNameDoesntClobber(): void { - $view = new View(); - $view->plugin(HeadMeta::class)->setName('keywords', 'foo'); - $view->plugin(HeadMeta::class)->appendHttpEquiv('pragma', 'bar'); - $view->plugin(HeadMeta::class)->appendHttpEquiv('Cache-control', 'baz'); - $view->plugin(HeadMeta::class)->setName('keywords', 'bat'); + $this->helper->setName('keywords', 'foo'); + $this->helper->appendHttpEquiv('pragma', 'bar'); + $this->helper->appendHttpEquiv('Cache-control', 'baz'); + $this->helper->setName('keywords', 'bat'); $this->assertEquals( '' . PHP_EOL . '' . PHP_EOL . '', - $view->plugin(HeadMeta::class)->toString() + $this->helper->toString() ); } public function testSetNameDoesntClobberPart2(): void { - $view = new View(); - $view->plugin(HeadMeta::class)->setName('keywords', 'foo'); - $view->plugin(HeadMeta::class)->setName('description', 'foo'); - $view->plugin(HeadMeta::class)->appendHttpEquiv('pragma', 'baz'); - $view->plugin(HeadMeta::class)->appendHttpEquiv('Cache-control', 'baz'); - $view->plugin(HeadMeta::class)->setName('keywords', 'bar'); + $this->helper->setName('keywords', 'foo'); + $this->helper->setName('description', 'foo'); + $this->helper->appendHttpEquiv('pragma', 'baz'); + $this->helper->appendHttpEquiv('Cache-control', 'baz'); + $this->helper->setName('keywords', 'bar'); $expected = sprintf( '%1$s' @@ -329,14 +334,13 @@ public function testSetNameDoesntClobberPart2(): void PHP_EOL ); - $this->assertEquals($expected, $view->plugin(HeadMeta::class)->toString()); + $this->assertEquals($expected, $this->helper->toString()); } public function testPlacesMetaTagsInProperOrder(): void { - $view = new View(); - $view->plugin(HeadMeta::class)->setName('keywords', 'foo'); - $view->plugin(HeadMeta::class)->__invoke( + $this->helper->setName('keywords', 'foo'); + $this->helper->__invoke( 'some content', 'bar', 'name', @@ -344,15 +348,13 @@ public function testPlacesMetaTagsInProperOrder(): void Helper\Placeholder\Container\AbstractContainer::PREPEND ); - $attributeEscaper = $this->attributeEscaper; - $expected = sprintf( '%s' . '', - $attributeEscaper('some content'), + $this->escaper->escapeHtmlAttr('some content'), PHP_EOL ); - $this->assertEquals($expected, $view->plugin(HeadMeta::class)->toString()); + $this->assertEquals($expected, $this->helper->toString()); } public function testContainerMaintainsCorrectOrderOfItems(): void @@ -381,7 +383,7 @@ public function testCharsetValidateFail(): void $view->plugin(Doctype::class)->__invoke('HTML4_STRICT'); $this->expectException(Exception\ExceptionInterface::class); - $view->plugin(HeadMeta::class)->setCharset('utf-8'); + $this->helper->setCharset('utf-8'); } public function testCharset(): void @@ -389,17 +391,17 @@ public function testCharset(): void $view = new View(); $view->plugin(Doctype::class)->__invoke('HTML5'); - $view->plugin(HeadMeta::class)->setCharset('utf-8'); + $this->helper->setCharset('utf-8'); $this->assertEquals( '', - $view->plugin(HeadMeta::class)->toString() + $this->helper->toString() ); $view->plugin(Doctype::class)->__invoke('XHTML5'); $this->assertEquals( '', - $view->plugin(HeadMeta::class)->toString() + $this->helper->toString() ); } @@ -408,18 +410,18 @@ public function testCharsetPosition(): void $view = new View(); $view->plugin(Doctype::class)->__invoke('HTML5'); - $view->plugin(HeadMeta::class) + $this->helper ->setProperty('description', 'foobar') ->setCharset('utf-8'); $this->assertEquals( '' . PHP_EOL . '', - $view->plugin(HeadMeta::class)->toString() + $this->helper->toString() ); } - public function testCarsetWithXhtmlDoctypeGotException(): void + public function testCharsetWithXhtmlDoctypeGotException(): void { $this->expectException(Exception\InvalidArgumentException::class); $this->expectExceptionMessage('XHTML* doctype has no attribute charset; please use appendHttpEquiv()'); @@ -427,7 +429,7 @@ public function testCarsetWithXhtmlDoctypeGotException(): void $view = new View(); $view->plugin(Doctype::class)->__invoke('XHTML1_RDFA'); - $view->plugin(HeadMeta::class) + $this->helper ->setCharset('utf-8'); } @@ -436,9 +438,7 @@ public function testPropertyIsSupportedWithRdfaDoctype(): void $this->view->doctype('XHTML1_RDFA'); $this->helper->__invoke('foo', 'og:title', 'property'); - $attributeEscaper = $this->attributeEscaper; - - $expected = sprintf('', $attributeEscaper('og:title')); + $expected = sprintf('', $this->escaper->escapeHtmlAttr('og:title')); $this->assertEquals($expected, $this->helper->toString()); } @@ -484,9 +484,10 @@ public function testItempropIsSupportedWithHtml5Doctype(): void $this->view->doctype('HTML5'); $this->helper->__invoke('HeadMeta with Microdata', 'description', 'itemprop'); - $attributeEscaper = $this->attributeEscaper; - - $expected = sprintf('', $attributeEscaper('HeadMeta with Microdata')); + $expected = sprintf( + '', + $this->escaper->escapeHtmlAttr('HeadMeta with Microdata'), + ); $this->assertEquals($expected, $this->helper->toString()); } diff --git a/test/Helper/HeadScriptTest.php b/test/Helper/HeadScriptTest.php index 217f62823..40af08bb8 100644 --- a/test/Helper/HeadScriptTest.php +++ b/test/Helper/HeadScriptTest.php @@ -6,9 +6,9 @@ use DOMDocument; use Generator; +use Laminas\Escaper\Escaper; use Laminas\View; use Laminas\View\Helper\Doctype; -use Laminas\View\Helper\EscapeHtmlAttr; use Laminas\View\Helper\HeadScript; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; @@ -25,20 +25,13 @@ class HeadScriptTest extends TestCase { - /** @var HeadScript */ - public $helper; + private HeadScript $helper; + private Escaper $escaper; - /** @var EscapeHtmlAttr */ - public $attributeEscaper; - - /** - * Sets up the fixture, for example, open a network connection. - * This method is called before a test is executed. - */ protected function setUp(): void { - $this->helper = new HeadScript(); - $this->attributeEscaper = new EscapeHtmlAttr(); + $this->helper = new HeadScript(); + $this->escaper = new Escaper(); } public function testHeadScriptReturnsObjectInstance(): void @@ -417,19 +410,17 @@ public function testContainerMaintainsCorrectOrderOfItems(): void $test = $this->helper->toString(); - $attributeEscaper = $this->attributeEscaper; - $expected = sprintf( '%1$s' . '%1$s' . '%1$s' . '', PHP_EOL, - $attributeEscaper('text/javascript'), - $attributeEscaper('test1.js'), - $attributeEscaper('test4.js'), - $attributeEscaper('test3.js'), - $attributeEscaper('test2.js') + $this->escaper->escapeHtmlAttr('text/javascript'), + $this->escaper->escapeHtmlAttr('test1.js'), + $this->escaper->escapeHtmlAttr('test4.js'), + $this->escaper->escapeHtmlAttr('test3.js'), + $this->escaper->escapeHtmlAttr('test2.js') ); $this->assertEquals($expected, $test); From b3ff19683b1d47e21b354124d9fae85ffc796f66 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 20 Jul 2023 00:36:24 +0000 Subject: [PATCH 27/32] Lock file maintenance Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- composer.lock | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index ba44360be..1400d9dab 100644 --- a/composer.lock +++ b/composer.lock @@ -4139,16 +4139,16 @@ }, { "name": "sebastian/global-state", - "version": "6.0.0", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "aab257c712de87b90194febd52e4d184551c2d44" + "reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/aab257c712de87b90194febd52e4d184551c2d44", - "reference": "aab257c712de87b90194febd52e4d184551c2d44", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/7ea9ead78f6d380d2a667864c132c2f7b83055e4", + "reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4", "shasum": "" }, "require": { @@ -4188,7 +4188,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.0" + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.1" }, "funding": [ { @@ -4196,7 +4197,7 @@ "type": "github" } ], - "time": "2023-02-03T07:07:38+00:00" + "time": "2023-07-19T07:19:23+00:00" }, { "name": "sebastian/lines-of-code", @@ -4602,16 +4603,16 @@ }, { "name": "spatie/array-to-xml", - "version": "3.1.6", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/spatie/array-to-xml.git", - "reference": "e210b98957987c755372465be105d32113f339a4" + "reference": "f9ab39c808500c347d5a8b6b13310bd5221e39e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/e210b98957987c755372465be105d32113f339a4", - "reference": "e210b98957987c755372465be105d32113f339a4", + "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/f9ab39c808500c347d5a8b6b13310bd5221e39e7", + "reference": "f9ab39c808500c347d5a8b6b13310bd5221e39e7", "shasum": "" }, "require": { @@ -4649,7 +4650,7 @@ "xml" ], "support": { - "source": "https://github.com/spatie/array-to-xml/tree/3.1.6" + "source": "https://github.com/spatie/array-to-xml/tree/3.2.0" }, "funding": [ { @@ -4661,7 +4662,7 @@ "type": "github" } ], - "time": "2023-05-11T14:04:07+00:00" + "time": "2023-07-19T18:30:26+00:00" }, { "name": "squizlabs/php_codesniffer", From 4364ebd5748b51f4a6e56254fb8cf97e271e215a Mon Sep 17 00:00:00 2001 From: George Steel Date: Thu, 20 Jul 2023 09:40:22 +0100 Subject: [PATCH 28/32] Revert BC breaking parameter type changes and mark helpers `@final` where possible Signed-off-by: George Steel --- psalm-baseline.xml | 25 +++++++------------------ src/Helper/HeadLink.php | 4 +++- src/Helper/HeadMeta.php | 4 +++- src/Helper/HeadScript.php | 8 ++++---- src/Helper/HeadStyle.php | 3 ++- src/Helper/HeadTitle.php | 1 + src/Helper/InlineScript.php | 2 ++ 7 files changed, 22 insertions(+), 25 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 0afc9c950..0acb49a4f 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -225,6 +225,9 @@ + + $item + offsetSet @@ -237,7 +240,6 @@ $href $index $item - $item autoEscape ? $this->escapeAttribute($attributes[$itemKey]) : $attributes[$itemKey]]]> autoEscape ? $this->escapeAttribute($value) : $value]]> $value @@ -258,7 +260,6 @@ $href $index $item - $item $media $title $type @@ -277,6 +278,7 @@ + $item $value $value @@ -349,10 +351,6 @@ $content $index $index - attributes['conditional']]]> - type]]> - type]]> - $key autoEscape ? $this->escapeAttribute($value) : $value]]> $value @@ -364,8 +362,6 @@ $content $index - $key - $type $value @@ -374,16 +370,6 @@ isHtml5 - - attributes['conditional']]]> - source]]> - $type - - - attributes]]> - source]]> - type]]> - parent::__call($method, $args) parent::__call($method, $args) @@ -411,6 +397,9 @@ offsetSet + + ObjectShape + $content $index diff --git a/src/Helper/HeadLink.php b/src/Helper/HeadLink.php index 3baea603e..8f34f209a 100644 --- a/src/Helper/HeadLink.php +++ b/src/Helper/HeadLink.php @@ -7,6 +7,7 @@ use Laminas\View\Exception; use Laminas\View\Helper\Placeholder\Container\AbstractContainer; use Laminas\View\Helper\Placeholder\Container\AbstractStandalone; +use stdClass; use function array_intersect; use function array_keys; @@ -36,6 +37,7 @@ * @method HeadLink offsetSetAlternate($index, $href, $type, $title, $extras = []) * @method HeadLink prependAlternate($href, $type, $title, $extras = []) * @method HeadLink setAlternate($href, $type, $title, $extras = []) + * @final */ class HeadLink extends AbstractStandalone { @@ -300,7 +302,7 @@ public function set($value) * * @return string */ - public function itemToString(object $item) + public function itemToString(stdClass $item) { $attributes = (array) $item; $link = ' + * @final */ class HeadMeta extends AbstractStandalone { @@ -254,7 +256,7 @@ public function createData($type, $typeValue, $content, array $modifiers) * @throws Exception\InvalidArgumentException * @return string */ - public function itemToString(object $item) + public function itemToString(stdClass $item) { if (! in_array($item->type, $this->typeKeys)) { throw new Exception\InvalidArgumentException(sprintf( diff --git a/src/Helper/HeadScript.php b/src/Helper/HeadScript.php index 085f01481..78f5c5e19 100644 --- a/src/Helper/HeadScript.php +++ b/src/Helper/HeadScript.php @@ -422,10 +422,10 @@ protected function isValid($value) * * @internal This method will become private in version 3.0 * - * @param mixed $item Item to convert - * @param string $indent String to add before the item - * @param string $escapeStart Starting sequence - * @param string $escapeEnd Ending sequence + * @param ObjectShape $item Item to convert + * @param string $indent String to add before the item + * @param string $escapeStart Starting sequence + * @param string $escapeEnd Ending sequence * @return string */ public function itemToString($item, $indent, $escapeStart, $escapeEnd) diff --git a/src/Helper/HeadStyle.php b/src/Helper/HeadStyle.php index 9bc3df0a0..f8ebe24e5 100644 --- a/src/Helper/HeadStyle.php +++ b/src/Helper/HeadStyle.php @@ -44,6 +44,7 @@ * @method HeadStyle prependStyle(string $content, array $attributes = []) * @method HeadStyle setStyle(string $content, array $attributes = []) * @method HeadStyle setIndent(int|string $indent) + * @final */ class HeadStyle extends AbstractStandalone { @@ -369,7 +370,7 @@ private function styleTagAttributesString(object $item): string * @param string $indent Indentation to use * @return string */ - public function itemToString(object $item, $indent) + public function itemToString(stdClass $item, $indent) { if (! isset($item->content) || ! is_string($item->content) || $item->content === '') { return ''; diff --git a/src/Helper/HeadTitle.php b/src/Helper/HeadTitle.php index 2547ddc12..7718760bb 100644 --- a/src/Helper/HeadTitle.php +++ b/src/Helper/HeadTitle.php @@ -21,6 +21,7 @@ * @method HeadTitle set(string $string) * @method HeadTitle prepend(string $string) * @method HeadTitle append(string $string) + * @final */ class HeadTitle extends AbstractStandalone { diff --git a/src/Helper/InlineScript.php b/src/Helper/InlineScript.php index b8299e50c..465bc4e3b 100644 --- a/src/Helper/InlineScript.php +++ b/src/Helper/InlineScript.php @@ -7,6 +7,8 @@ /** * Helper for setting and retrieving script elements for inclusion in HTML body * section + * + * @final */ class InlineScript extends HeadScript { From 63b2e56f1760942e3681bbab7273bf4fa2933499 Mon Sep 17 00:00:00 2001 From: George Steel Date: Thu, 20 Jul 2023 10:17:14 +0100 Subject: [PATCH 29/32] Exception code does not need a cast to int Signed-off-by: George Steel --- src/Model/JsonModel.php | 2 +- src/Renderer/JsonRenderer.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Model/JsonModel.php b/src/Model/JsonModel.php index 2d4c9b761..365a8e770 100644 --- a/src/Model/JsonModel.php +++ b/src/Model/JsonModel.php @@ -76,7 +76,7 @@ private function jsonEncode($data, int $options): string try { return json_encode($data, $options | JSON_THROW_ON_ERROR); } catch (JsonException $e) { - throw new DomainException('Failed to encode Json', (int) $e->getCode(), $e); + throw new DomainException('Failed to encode Json', $e->getCode(), $e); } } } diff --git a/src/Renderer/JsonRenderer.php b/src/Renderer/JsonRenderer.php index c296cd2bc..a55bd4767 100644 --- a/src/Renderer/JsonRenderer.php +++ b/src/Renderer/JsonRenderer.php @@ -248,7 +248,7 @@ private function jsonEncode($data): string try { return json_encode($data, JSON_THROW_ON_ERROR); } catch (JsonException $e) { - throw new Exception\DomainException('Json encoding failed', (int) $e->getCode(), $e); + throw new Exception\DomainException('Json encoding failed', $e->getCode(), $e); } } } From e422f3a1c61bbf0306d27d755ef1c59682aab4f3 Mon Sep 17 00:00:00 2001 From: George Steel Date: Thu, 20 Jul 2023 10:17:43 +0100 Subject: [PATCH 30/32] `MockObject::withConsecutive()` is not available in PHPUnit 10 Signed-off-by: George Steel --- test/Helper/Service/IdentityFactoryTest.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/test/Helper/Service/IdentityFactoryTest.php b/test/Helper/Service/IdentityFactoryTest.php index e8685ccb0..27c782ea0 100644 --- a/test/Helper/Service/IdentityFactoryTest.php +++ b/test/Helper/Service/IdentityFactoryTest.php @@ -27,10 +27,15 @@ public function testFactoryReturnsEmptyIdentityIfNoAuthenticationServicePresent( { $this->services->expects(self::exactly(2)) ->method('has') - ->withConsecutive( - [AuthenticationService::class], - [AuthenticationServiceInterface::class] - )->willReturn(false); + ->with(self::callback(static function (string $serviceName): bool { + self::assertTrue( + $serviceName === AuthenticationService::class + || + $serviceName === AuthenticationServiceInterface::class + ); + + return true; + }))->willReturn(false); $factory = new IdentityFactory(); From 2a97feaf432daf885e6b90ec1679cf972087ad2f Mon Sep 17 00:00:00 2001 From: George Steel Date: Thu, 20 Jul 2023 10:18:05 +0100 Subject: [PATCH 31/32] Refresh lock and baseline post merge-up Signed-off-by: George Steel --- composer.lock | 152 +----------------------- psalm-baseline.xml | 285 --------------------------------------------- 2 files changed, 1 insertion(+), 436 deletions(-) diff --git a/composer.lock b/composer.lock index 1400d9dab..639e66436 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d8c4880e9375fc4df0bb44fdb9436bf2", + "content-hash": "6f4f1dcd9aabd89a90c6f0ad6d25cc20", "packages": [ { "name": "laminas/laminas-escaper", @@ -1972,75 +1972,6 @@ ], "time": "2022-12-02T15:45:50+00:00" }, - { - "name": "laminas/laminas-mvc-plugin-flashmessenger", - "version": "1.9.0", - "source": { - "type": "git", - "url": "https://github.com/laminas/laminas-mvc-plugin-flashmessenger.git", - "reference": "dc73bb6b56a0d74f9fdc0d24ec55a5f8c87c4cfa" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-mvc-plugin-flashmessenger/zipball/dc73bb6b56a0d74f9fdc0d24ec55a5f8c87c4cfa", - "reference": "dc73bb6b56a0d74f9fdc0d24ec55a5f8c87c4cfa", - "shasum": "" - }, - "require": { - "laminas/laminas-mvc": "^3.3", - "laminas/laminas-session": "^2.12.0", - "laminas/laminas-stdlib": "^3.6.4", - "laminas/laminas-view": "^2.13.1", - "php": "~8.0.0 || ~8.1.0 || ~8.2.0" - }, - "conflict": { - "laminas/laminas-mvc": "<3.0.0", - "zendframework/zend-mvc-plugin-flashmessenger": "*" - }, - "require-dev": { - "laminas/laminas-coding-standard": "~2.4.0", - "laminas/laminas-i18n": "^2.19.0", - "phpunit/phpunit": "^9.5.25", - "psalm/plugin-phpunit": "^0.17.0", - "vimeo/psalm": "^4.29.0" - }, - "type": "library", - "extra": { - "laminas": { - "component": "Laminas\\Mvc\\Plugin\\FlashMessenger" - } - }, - "autoload": { - "psr-4": { - "Laminas\\Mvc\\Plugin\\FlashMessenger\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Plugin for creating and exposing flash messages via laminas-mvc controllers", - "homepage": "https://laminas.dev", - "keywords": [ - "laminas", - "mvc" - ], - "support": { - "chat": "https://laminas.dev/chat", - "docs": "https://docs.laminas.dev/laminas-mvc-plugin-flashmessenger/", - "forum": "https://discourse.laminas.dev", - "issues": "https://github.com/laminas/laminas-mvc-plugin-flashmessenger/issues", - "rss": "https://github.com/laminas/laminas-mvc-plugin-flashmessenger/releases.atom", - "source": "https://github.com/laminas/laminas-mvc-plugin-flashmessenger" - }, - "funding": [ - { - "url": "https://funding.communitybridge.org/projects/laminas-project", - "type": "community_bridge" - } - ], - "time": "2022-10-22T12:47:30+00:00" - }, { "name": "laminas/laminas-navigation", "version": "2.18.1", @@ -2336,87 +2267,6 @@ ], "time": "2022-12-29T14:47:23+00:00" }, - { - "name": "laminas/laminas-session", - "version": "2.16.0", - "source": { - "type": "git", - "url": "https://github.com/laminas/laminas-session.git", - "reference": "9c845a0361625d5775cad6f043716196201ad41f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-session/zipball/9c845a0361625d5775cad6f043716196201ad41f", - "reference": "9c845a0361625d5775cad6f043716196201ad41f", - "shasum": "" - }, - "require": { - "laminas/laminas-eventmanager": "^3.5", - "laminas/laminas-servicemanager": "^3.15.1", - "laminas/laminas-stdlib": "^3.10.1", - "php": "~8.0.0 || ~8.1.0 || ~8.2.0" - }, - "conflict": { - "zendframework/zend-session": "*" - }, - "require-dev": { - "laminas/laminas-cache": "^3.8", - "laminas/laminas-cache-storage-adapter-memory": "^2.2", - "laminas/laminas-coding-standard": "~2.4.0", - "laminas/laminas-db": "^2.15", - "laminas/laminas-http": "^2.17.1", - "laminas/laminas-validator": "^2.28", - "mongodb/mongodb": "~1.13.0", - "phpunit/phpunit": "^9.5.26", - "psalm/plugin-phpunit": "^0.18.0", - "vimeo/psalm": "^5.0" - }, - "suggest": { - "laminas/laminas-cache": "Laminas\\Cache component", - "laminas/laminas-db": "Laminas\\Db component", - "laminas/laminas-http": "Laminas\\Http component", - "laminas/laminas-servicemanager": "Laminas\\ServiceManager component", - "laminas/laminas-validator": "Laminas\\Validator component", - "mongodb/mongodb": "If you want to use the MongoDB session save handler" - }, - "type": "library", - "extra": { - "laminas": { - "component": "Laminas\\Session", - "config-provider": "Laminas\\Session\\ConfigProvider" - } - }, - "autoload": { - "psr-4": { - "Laminas\\Session\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Object-oriented interface to PHP sessions and storage", - "homepage": "https://laminas.dev", - "keywords": [ - "laminas", - "session" - ], - "support": { - "chat": "https://laminas.dev/chat", - "docs": "https://docs.laminas.dev/laminas-session/", - "forum": "https://discourse.laminas.dev", - "issues": "https://github.com/laminas/laminas-session/issues", - "rss": "https://github.com/laminas/laminas-session/releases.atom", - "source": "https://github.com/laminas/laminas-session" - }, - "funding": [ - { - "url": "https://funding.communitybridge.org/projects/laminas-project", - "type": "community_bridge" - } - ], - "time": "2022-12-04T11:15:36+00:00" - }, { "name": "laminas/laminas-uri", "version": "2.10.0", diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 0acb49a4f..751335303 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -146,46 +146,6 @@ $value[$k] - - - pluginFlashMessenger]]> - - - $item - - - $escapeHtmlHelper - $pluginFlashMessenger - - - $item - $messagesToPrint - - - $classes - $classes - - - $messagesToPrint[] - $messagesToPrint[] - - - $classes - $classes - $messagesToPrint[] - $messagesToPrint[] - escapeHtmlHelper]]> - - - (bool) $autoEscape - (string) $messageCloseString - (string) $messageOpenFormat - (string) $messageSeparatorString - - - escapeHtmlHelper]]> - - $flag === null @@ -419,26 +379,6 @@ is_string($content) - - - $htmlObject - - - $htmlObject($data, self::TYPE, $attribs, $params, $content) - - - string - - - $htmlObject($data, self::TYPE, $attribs, $params, $content) - - - plugin - - - plugin - - is_array($content) @@ -471,26 +411,6 @@ plugin - - - $htmlObject - - - $htmlObject($data, self::TYPE, $attribs, $params, $content) - - - string - - - $htmlObject($data, self::TYPE, $attribs, $params, $content) - - - plugin - - - plugin - - $value @@ -508,17 +428,6 @@ (bool) $useNamespaces - - - $response - - - null - - - response instanceof Response]]> - - plugin @@ -1092,7 +1001,6 @@ (string) $key (string) $key (string) $key - (string) $name containerClass($value)]]> @@ -1152,9 +1060,6 @@ - - null === static::$instance - containerClass($value)]]> @@ -1177,9 +1082,6 @@ (string) $key (string) $key - - new static() - @@ -1259,11 +1161,6 @@ - - - $cName - - @@ -1276,50 +1173,7 @@ $config - - - FlashMessenger - FlashMessenger - new FlashMessenger() - - - FlashMessengerFactory - - - - - - $flashMessenger - - - - - - - - - - $config - $configHelper - $controllerPluginManager - $flashMessenger - - - get - - - $container - - - $requestedName - - - - $this - $this - $this - (bool) $enabled @@ -1406,17 +1260,6 @@ clearVariables - - - int - - - options['errorLevel']]]> - - - $captureTo - - type]]> @@ -1500,29 +1343,6 @@ is_object($variables) - - - $values - - - $child - - - $child - $setting - $value - - - $setting - getFilterChain()->filter($values['result'])]]> - - - $model - - - $values - - @@ -1538,9 +1358,6 @@ - - void - $jsonpCallback @@ -1799,34 +1616,6 @@ plugin - - - $data - $stat - - - $mode - $offset - $opened_path - $options - $whence - - - pos]]> - pos]]> - pos]]> - - - $offset - $offset - $offset - - - break; - break; - break; - - Variables @@ -1982,75 +1771,6 @@ $test - - - $plugin - $plugin - mvcPluginClass]]> - - - FlashMessenger - [ - 'config' => $config, - ], - 'factories' => [ - 'ControllerPluginManager' => fn(ContainerInterface $services) => new PluginManager($services, [ - 'invokables' => [ - 'flashmessenger' => $this->mvcPluginClass, - ], - ]), - 'ViewHelperManager' => static fn(ContainerInterface $services) - => new HelperPluginManager($services), - ], - ])]]> - new FlashMessenger() - new FlashMessenger() - new FlashMessenger() - new FlashMessenger() - new FlashMessenger() - new FlashMessenger() - - - $displayInfo - $displayInfo - $displayInfo - $displayInfo - $helper - $helper - $helper - $helper - $helperPluginManager - $helperPluginManager - $helperPluginManager - $helperPluginManager - - - get - get - get - get - render - render - renderCurrent - renderCurrent - - - hasCurrentErrorMessages - hasCurrentInfoMessages - hasCurrentMessages - hasCurrentSuccessMessages - hasErrorMessages - hasInfoMessages - hasMessages - hasSuccessMessages - hasWarningMessages - render - render - renderCurrent - renderCurrent - - $value @@ -2148,11 +1868,6 @@ offsetSetName
- - - HtmlFlash - - $escape($value) From 4ede0c584e72ba45df6bb459b6e1d91d37228ddd Mon Sep 17 00:00:00 2001 From: George Steel Date: Thu, 20 Jul 2023 10:20:39 +0100 Subject: [PATCH 32/32] Remove trailing spaces Signed-off-by: George Steel --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 6d735e277..3803c8e51 100644 --- a/README.md +++ b/README.md @@ -3,19 +3,19 @@ [![Build Status](https://github.com/laminas/laminas-view/workflows/Continuous%20Integration/badge.svg)](https://github.com/laminas/laminas-view/actions?query=workflow%3A"Continuous+Integration") > ## πŸ‡·πŸ‡Ί Русским Π³Ρ€Π°ΠΆΠ΄Π°Π½Π°ΠΌ -> +> > ΠœΡ‹, участники Laminas, Ρ€ΠΎΠ΄ΠΈΠ»ΠΈΡΡŒ ΠΈ ΠΆΠΈΠ²Π΅ΠΌ Π² Ρ€Π°Π·Π½Ρ‹Ρ… странах. Π£ ΠΌΠ½ΠΎΠ³ΠΈΡ… ΠΈΠ· нас Π΅ΡΡ‚ΡŒ Π΄Ρ€ΡƒΠ·ΡŒΡ, родствСнники ΠΈ ΠΊΠΎΠ»Π»Π΅Π³ΠΈ ΠΊΠ°ΠΊ Π² России, Ρ‚Π°ΠΊ ΠΈ Π² Π£ΠΊΡ€Π°ΠΈΠ½Π΅. НСкоторыС ΠΈΠ· нас Ρ€ΠΎΠ΄ΠΈΠ»ΠΈΡΡŒ Π² России. НСкоторыС ΠΈΠ· нас ΠΆΠΈΠ²ΡƒΡ‚ Π² России. Π£ Π½Π΅ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Ρ… Π±Π°Π±ΡƒΡˆΠΊΠΈ ΠΈ Π΄Π΅Π΄ΡƒΡˆΠΊΠΈ ΡΡ€Π°ΠΆΠ°Π»ΠΈΡΡŒ с Ρ„Π°ΡˆΠΈΡΡ‚Π°ΠΌΠΈ Π²ΠΎ Π’Ρ‚ΠΎΡ€ΠΎΠΉ ΠΌΠΈΡ€ΠΎΠ²ΠΎΠΉ Π²ΠΎΠΉΠ½Π΅. Π—Π΄Π΅ΡΡŒ Π½ΠΈΠΊΡ‚ΠΎ Π½Π΅ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΈΠ²Π°Π΅Ρ‚ Ρ„Π°ΡˆΠΈΠ·ΠΌ. -> +> > Π£ ΠΎΠ΄Π½ΠΎΠ³ΠΎ ΠΈΠ· нас Π΅ΡΡ‚ΡŒ украинская родствСнница, которая спаслась ΠΈΠ· Π΄ΠΎΠΌΠ° вмСстС с сыном. ПоСзд задСрТался ΠΈΠ·-Π·Π° Π±ΠΎΠΌΠ±Π΅ΠΆΠΊΠΈ Π½Π° Π΄ΠΎΡ€ΠΎΠ³Π΅ Π²ΠΏΠ΅Ρ€Π΅Π΄ΠΈ. Π£ нас Π΅ΡΡ‚ΡŒ Π΄Ρ€ΡƒΠ·ΡŒΡ, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Π΅ прячутся Π² Π±ΠΎΠΌΠ±ΠΎΡƒΠ±Π΅ΠΆΠΈΡ‰Π°Ρ…. ΠœΡ‹ с Ρ‚Ρ€Π΅Π²ΠΎΠ³ΠΎΠΉ ΠΆΠ΄Π΅ΠΌ вСсточки ΠΎΡ‚ Π½ΠΈΡ… послС Π²ΠΎΠ·Π΄ΡƒΡˆΠ½Ρ‹Ρ… Π½Π°Π»Π΅Ρ‚ΠΎΠ², ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Π΅ бСспорядочно наносят ΡƒΠ΄Π°Ρ€Ρ‹ ΠΈ ΠΏΠΎΠΏΠ°Π΄Π°ΡŽΡ‚ ΠΏΠΎ Π±ΠΎΠ»ΡŒΠ½ΠΈΡ†Π°ΠΌ, школам, дСтским садам ΠΈ Π΄ΠΎΠΌΠ°ΠΌ. ΠœΡ‹ Π½Π΅ Π±Π΅Ρ€Π΅ΠΌ это ΠΈΠ· ΠΊΠ°ΠΊΠΈΡ…-Π»ΠΈΠ±ΠΎ БМИ. ΠœΡ‹ наблюдаСм это Π½Π°ΠΏΡ€ΡΠΌΡƒΡŽ. -> +> > Π’Ρ‹ довСряСтС Π½Π°ΠΌ достаточно, Ρ‡Ρ‚ΠΎΠ± ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚ΡŒ наши ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΡ‹, ΠΈ ΠΌΡ‹ просим вас Π΄ΠΎΠ²Π΅Ρ€ΠΈΡ‚ΡŒΡΡ Π½Π°ΠΌ вновь. ΠœΡ‹ нуТдаСмся Π² ΠΏΠΎΠΌΠΎΡ‰ΠΈ. Π’Ρ‹Ρ…ΠΎΠ΄ΠΈΡ‚Π΅ ΠΈ протСстуйтС ΠΏΡ€ΠΎΡ‚ΠΈΠ² этой бСсполСзной Π²ΠΎΠΉΠ½Ρ‹. ΠžΡΡ‚Π°Π½ΠΎΠ²ΠΈΡ‚Π΅ ΠΊΡ€ΠΎΠ²ΠΎΠΏΡ€ΠΎΠ»ΠΈΡ‚ΠΈΠ΅. Π‘ΠΊΠ°ΠΆΠΈΡ‚Π΅ "НСт Π²ΠΎΠΉΠ½Π΅!" -> +> > ## πŸ‡ΊπŸ‡Έ To Citizens of Russia -> +> > We at Laminas come from all over the world. Many of us have friends, family and colleagues in both Russia and Ukraine. Some of us were born in Russia. Some of us currently live in Russia. Some have grandparents who fought Nazis in World War II. Nobody here supports fascism. -> +> > One team member has a Ukrainian relative who fled her home with her son. The train was delayed due to bombing on the road ahead. We have friends who are hiding in bomb shelters. We anxiously follow up on them after the air raids, which indiscriminately fire at hospitals, schools, kindergartens and houses. We're not taking this from any media. These are our actual experiences. -> +> > You trust us enough to use our software. We ask that you trust us to say the truth on this. We need your help. Go out and protest this unnecessary war. Stop the bloodshed. Say "stop the war!" laminas-view provides the β€œView” layer of the Laminas MVC system. It is a