From 460ad954e6c816c9942b22064e7398ba926c49c0 Mon Sep 17 00:00:00 2001 From: George Steel Date: Tue, 5 Sep 2023 12:04:24 +0100 Subject: [PATCH] General type inference improvements - Adds template parameters to ParameterObjectInterface and AbstractOptions - Fixes a range of psalm issues, mostly in tests - Updates the baseline - Bumps dev dependencies and refreshes the lock file Signed-off-by: George Steel --- composer.json | 4 +- composer.lock | 247 +++++++++--------- psalm-baseline.xml | 130 +-------- src/AbstractOptions.php | 20 +- src/ParameterObjectInterface.php | 15 +- test/ArrayObjectTest.php | 2 +- test/FastPriorityQueueTest.php | 19 +- test/GlobTest.php | 3 +- test/OptionsTest.php | 9 +- test/ParametersTest.php | 17 +- test/PriorityListTest.php | 32 +-- test/PriorityQueueTest.php | 8 +- test/SplQueueTest.php | 4 +- test/SplStackTest.php | 4 +- test/StringUtilsTest.php | 6 +- .../CommonStringWrapperTestCase.php | 10 +- test/StringWrapper/IconvTest.php | 14 +- test/StringWrapper/IntlTest.php | 13 +- test/StringWrapper/MbStringTest.php | 13 +- test/StringWrapper/NativeTest.php | 11 +- test/TestAsset/TestOptions.php | 29 +- test/TestAsset/TestOptionsDerived.php | 21 +- test/TestAsset/TestOptionsNoStrict.php | 8 +- test/TestAsset/TestOptionsWithoutGetter.php | 5 +- 24 files changed, 262 insertions(+), 382 deletions(-) diff --git a/composer.json b/composer.json index e5a700ed..7a249e29 100644 --- a/composer.json +++ b/composer.json @@ -32,9 +32,9 @@ "require-dev": { "laminas/laminas-coding-standard": "^2.5", "phpbench/phpbench": "^1.2.14", - "phpunit/phpunit": "^10.2.6", + "phpunit/phpunit": "^10.3.3", "psalm/plugin-phpunit": "^0.18.4", - "vimeo/psalm": "^5.13.1" + "vimeo/psalm": "^5.15.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index ef974b5a..0263507c 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": "75c1832fce2931fbc831d671a2fb529b", + "content-hash": "a832d1ae7e64a7580e8eaddf1524af17", "packages": [], "packages-dev": [ { @@ -319,16 +319,16 @@ }, { "name": "composer/semver", - "version": "3.3.2", + "version": "3.4.0", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9" + "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/3953f23262f2bff1919fc82183ad9acb13ff62c9", - "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9", + "url": "https://api.github.com/repos/composer/semver/zipball/35e8d0af4486141bc745f23a29cc2091eb624a32", + "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32", "shasum": "" }, "require": { @@ -378,9 +378,9 @@ "versioning" ], "support": { - "irc": "irc://irc.freenode.org/composer", + "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.3.2" + "source": "https://github.com/composer/semver/tree/3.4.0" }, "funding": [ { @@ -396,7 +396,7 @@ "type": "tidelift" } ], - "time": "2022-04-01T19:23:25+00:00" + "time": "2023-08-31T09:50:34+00:00" }, { "name": "composer/xdebug-handler", @@ -1059,16 +1059,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.16.0", + "version": "v4.17.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "19526a33fb561ef417e822e85f08a00db4059c17" + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/19526a33fb561ef417e822e85f08a00db4059c17", - "reference": "19526a33fb561ef417e822e85f08a00db4059c17", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", "shasum": "" }, "require": { @@ -1109,9 +1109,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.16.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" }, - "time": "2023-06-25T14:52:30+00:00" + "time": "2023-08-13T19:53:39+00:00" }, { "name": "phar-io/manifest", @@ -1627,16 +1627,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "10.1.3", + "version": "10.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "be1fe461fdc917de2a29a452ccf2657d325b443d" + "reference": "cd59bb34756a16ca8253ce9b2909039c227fff71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/be1fe461fdc917de2a29a452ccf2657d325b443d", - "reference": "be1fe461fdc917de2a29a452ccf2657d325b443d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/cd59bb34756a16ca8253ce9b2909039c227fff71", + "reference": "cd59bb34756a16ca8253ce9b2909039c227fff71", "shasum": "" }, "require": { @@ -1693,7 +1693,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.3" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.4" }, "funding": [ { @@ -1701,20 +1701,20 @@ "type": "github" } ], - "time": "2023-07-26T13:45:28+00:00" + "time": "2023-08-31T14:04:38+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "4.0.2", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "5647d65443818959172645e7ed999217360654b6" + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/5647d65443818959172645e7ed999217360654b6", - "reference": "5647d65443818959172645e7ed999217360654b6", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a95037b6d9e608ba092da1b23931e537cadc3c3c", + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c", "shasum": "" }, "require": { @@ -1754,7 +1754,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.0.2" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.1.0" }, "funding": [ { @@ -1762,7 +1762,7 @@ "type": "github" } ], - "time": "2023-05-07T09:13:23+00:00" + "time": "2023-08-31T06:24:48+00:00" }, { "name": "phpunit/php-invoker", @@ -1829,16 +1829,16 @@ }, { "name": "phpunit/php-text-template", - "version": "3.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "9f3d3709577a527025f55bcf0f7ab8052c8bb37d" + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/9f3d3709577a527025f55bcf0f7ab8052c8bb37d", - "reference": "9f3d3709577a527025f55bcf0f7ab8052c8bb37d", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0c7b06ff49e3d5072f057eb1fa59258bf287a748", + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748", "shasum": "" }, "require": { @@ -1876,7 +1876,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.0" + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.1" }, "funding": [ { @@ -1884,7 +1885,7 @@ "type": "github" } ], - "time": "2023-02-03T06:56:46+00:00" + "time": "2023-08-31T14:07:24+00:00" }, { "name": "phpunit/php-timer", @@ -1947,16 +1948,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.2.6", + "version": "10.3.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1c17815c129f133f3019cc18e8d0c8622e6d9bcd" + "reference": "241ed4dd0db1c096984e62d414c4e1ac8d5dbff4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1c17815c129f133f3019cc18e8d0c8622e6d9bcd", - "reference": "1c17815c129f133f3019cc18e8d0c8622e6d9bcd", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/241ed4dd0db1c096984e62d414c4e1ac8d5dbff4", + "reference": "241ed4dd0db1c096984e62d414c4e1ac8d5dbff4", "shasum": "" }, "require": { @@ -1981,7 +1982,7 @@ "sebastian/diff": "^5.0", "sebastian/environment": "^6.0", "sebastian/exporter": "^5.0", - "sebastian/global-state": "^6.0", + "sebastian/global-state": "^6.0.1", "sebastian/object-enumerator": "^5.0", "sebastian/recursion-context": "^5.0", "sebastian/type": "^4.0", @@ -1996,7 +1997,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "10.2-dev" + "dev-main": "10.3-dev" } }, "autoload": { @@ -2028,7 +2029,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.6" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.3.3" }, "funding": [ { @@ -2044,7 +2045,7 @@ "type": "tidelift" } ], - "time": "2023-07-17T12:08:28+00:00" + "time": "2023-09-05T04:34:51+00:00" }, { "name": "psalm/plugin-phpunit", @@ -2427,16 +2428,16 @@ }, { "name": "sebastian/comparator", - "version": "5.0.0", + "version": "5.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "72f01e6586e0caf6af81297897bd112eb7e9627c" + "reference": "2db5010a484d53ebf536087a70b4a5423c102372" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/72f01e6586e0caf6af81297897bd112eb7e9627c", - "reference": "72f01e6586e0caf6af81297897bd112eb7e9627c", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2db5010a484d53ebf536087a70b4a5423c102372", + "reference": "2db5010a484d53ebf536087a70b4a5423c102372", "shasum": "" }, "require": { @@ -2447,7 +2448,7 @@ "sebastian/exporter": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^10.3" }, "type": "library", "extra": { @@ -2491,7 +2492,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.0" + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.1" }, "funding": [ { @@ -2499,20 +2501,20 @@ "type": "github" } ], - "time": "2023-02-03T07:07:16+00:00" + "time": "2023-08-14T13:18:12+00:00" }, { "name": "sebastian/complexity", - "version": "3.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "e67d240970c9dc7ea7b2123a6d520e334dd61dc6" + "reference": "c70b73893e10757af9c6a48929fa6a333b56a97a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/e67d240970c9dc7ea7b2123a6d520e334dd61dc6", - "reference": "e67d240970c9dc7ea7b2123a6d520e334dd61dc6", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/c70b73893e10757af9c6a48929fa6a333b56a97a", + "reference": "c70b73893e10757af9c6a48929fa6a333b56a97a", "shasum": "" }, "require": { @@ -2548,7 +2550,8 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/3.0.0" + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/3.0.1" }, "funding": [ { @@ -2556,7 +2559,7 @@ "type": "github" } ], - "time": "2023-02-03T06:59:47+00:00" + "time": "2023-08-31T09:55:53+00:00" }, { "name": "sebastian/diff", @@ -2830,16 +2833,16 @@ }, { "name": "sebastian/lines-of-code", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "17c4d940ecafb3d15d2cf916f4108f664e28b130" + "reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/17c4d940ecafb3d15d2cf916f4108f664e28b130", - "reference": "17c4d940ecafb3d15d2cf916f4108f664e28b130", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/649e40d279e243d985aa8fb6e74dd5bb28dc185d", + "reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d", "shasum": "" }, "require": { @@ -2875,7 +2878,8 @@ "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/2.0.0" + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.1" }, "funding": [ { @@ -2883,7 +2887,7 @@ "type": "github" } ], - "time": "2023-02-03T07:08:02+00:00" + "time": "2023-08-31T09:25:50+00:00" }, { "name": "sebastian/object-enumerator", @@ -3416,16 +3420,16 @@ }, { "name": "symfony/console", - "version": "v6.3.0", + "version": "v6.3.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7" + "reference": "eca495f2ee845130855ddf1cf18460c38966c8b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7", - "reference": "8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7", + "url": "https://api.github.com/repos/symfony/console/zipball/eca495f2ee845130855ddf1cf18460c38966c8b6", + "reference": "eca495f2ee845130855ddf1cf18460c38966c8b6", "shasum": "" }, "require": { @@ -3486,7 +3490,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.3.0" + "source": "https://github.com/symfony/console/tree/v6.3.4" }, "funding": [ { @@ -3502,7 +3506,7 @@ "type": "tidelift" } ], - "time": "2023-05-29T12:49:39+00:00" + "time": "2023-08-16T10:10:12+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3636,16 +3640,16 @@ }, { "name": "symfony/finder", - "version": "v6.3.0", + "version": "v6.3.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "d9b01ba073c44cef617c7907ce2419f8d00d75e2" + "reference": "9915db259f67d21eefee768c1abcf1cc61b1fc9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/d9b01ba073c44cef617c7907ce2419f8d00d75e2", - "reference": "d9b01ba073c44cef617c7907ce2419f8d00d75e2", + "url": "https://api.github.com/repos/symfony/finder/zipball/9915db259f67d21eefee768c1abcf1cc61b1fc9e", + "reference": "9915db259f67d21eefee768c1abcf1cc61b1fc9e", "shasum": "" }, "require": { @@ -3680,7 +3684,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v6.3.0" + "source": "https://github.com/symfony/finder/tree/v6.3.3" }, "funding": [ { @@ -3696,7 +3700,7 @@ "type": "tidelift" } ], - "time": "2023-04-02T01:25:41+00:00" + "time": "2023-07-31T08:31:44+00:00" }, { "name": "symfony/options-resolver", @@ -3767,16 +3771,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", "shasum": "" }, "require": { @@ -3791,7 +3795,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3829,7 +3833,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" }, "funding": [ { @@ -3845,20 +3849,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "511a08c03c1960e08a883f4cffcacd219b758354" + "reference": "875e90aeea2777b6f135677f618529449334a612" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", - "reference": "511a08c03c1960e08a883f4cffcacd219b758354", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/875e90aeea2777b6f135677f618529449334a612", + "reference": "875e90aeea2777b6f135677f618529449334a612", "shasum": "" }, "require": { @@ -3870,7 +3874,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3910,7 +3914,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.28.0" }, "funding": [ { @@ -3926,20 +3930,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", "shasum": "" }, "require": { @@ -3951,7 +3955,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3994,7 +3998,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" }, "funding": [ { @@ -4010,20 +4014,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" + "reference": "42292d99c55abe617799667f454222c54c60e229" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", + "reference": "42292d99c55abe617799667f454222c54c60e229", "shasum": "" }, "require": { @@ -4038,7 +4042,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4077,7 +4081,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" }, "funding": [ { @@ -4093,20 +4097,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-07-28T09:04:16+00:00" }, { "name": "symfony/process", - "version": "v6.3.0", + "version": "v6.3.4", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "8741e3ed7fe2e91ec099e02446fb86667a0f1628" + "reference": "0b5c29118f2e980d455d2e34a5659f4579847c54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/8741e3ed7fe2e91ec099e02446fb86667a0f1628", - "reference": "8741e3ed7fe2e91ec099e02446fb86667a0f1628", + "url": "https://api.github.com/repos/symfony/process/zipball/0b5c29118f2e980d455d2e34a5659f4579847c54", + "reference": "0b5c29118f2e980d455d2e34a5659f4579847c54", "shasum": "" }, "require": { @@ -4138,7 +4142,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.3.0" + "source": "https://github.com/symfony/process/tree/v6.3.4" }, "funding": [ { @@ -4154,7 +4158,7 @@ "type": "tidelift" } ], - "time": "2023-05-19T08:06:44+00:00" + "time": "2023-08-07T10:39:22+00:00" }, { "name": "symfony/service-contracts", @@ -4240,16 +4244,16 @@ }, { "name": "symfony/string", - "version": "v6.3.0", + "version": "v6.3.2", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "f2e190ee75ff0f5eced645ec0be5c66fac81f51f" + "reference": "53d1a83225002635bca3482fcbf963001313fb68" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/f2e190ee75ff0f5eced645ec0be5c66fac81f51f", - "reference": "f2e190ee75ff0f5eced645ec0be5c66fac81f51f", + "url": "https://api.github.com/repos/symfony/string/zipball/53d1a83225002635bca3482fcbf963001313fb68", + "reference": "53d1a83225002635bca3482fcbf963001313fb68", "shasum": "" }, "require": { @@ -4306,7 +4310,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.3.0" + "source": "https://github.com/symfony/string/tree/v6.3.2" }, "funding": [ { @@ -4322,7 +4326,7 @@ "type": "tidelift" } ], - "time": "2023-03-21T21:06:29+00:00" + "time": "2023-07-05T08:41:27+00:00" }, { "name": "theseer/tokenizer", @@ -4376,16 +4380,16 @@ }, { "name": "vimeo/psalm", - "version": "5.13.1", + "version": "5.15.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "086b94371304750d1c673315321a55d15fc59015" + "reference": "5c774aca4746caf3d239d9c8cadb9f882ca29352" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/086b94371304750d1c673315321a55d15fc59015", - "reference": "086b94371304750d1c673315321a55d15fc59015", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/5c774aca4746caf3d239d9c8cadb9f882ca29352", + "reference": "5c774aca4746caf3d239d9c8cadb9f882ca29352", "shasum": "" }, "require": { @@ -4406,13 +4410,16 @@ "felixfbecker/language-server-protocol": "^1.5.2", "fidry/cpu-core-counter": "^0.4.1 || ^0.5.1", "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", - "nikic/php-parser": "^4.14", - "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0", + "nikic/php-parser": "^4.16", + "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0", "sebastian/diff": "^4.0 || ^5.0", "spatie/array-to-xml": "^2.17.0 || ^3.0", "symfony/console": "^4.1.6 || ^5.0 || ^6.0", "symfony/filesystem": "^5.4 || ^6.0" }, + "conflict": { + "nikic/php-parser": "4.17.0" + }, "provide": { "psalm/psalm": "self.version" }, @@ -4476,9 +4483,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.13.1" + "source": "https://github.com/vimeo/psalm/tree/5.15.0" }, - "time": "2023-06-27T16:39:49+00:00" + "time": "2023-08-20T23:07:30+00:00" }, { "name": "webimpress/coding-standard", @@ -4655,5 +4662,5 @@ "platform-overrides": { "php": "8.1.99" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 3de78ab6..26e4b69d 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,25 +1,21 @@ - + - $key - $key - $letter + $value - $array[$normalizedKey] - $key - $key - $letter - $value $value - - $this - + + TValue + + + {$getter}()]]> + @@ -308,14 +304,8 @@ $a - $a - $b $b - - $a - $b - $unserialized @@ -374,37 +364,15 @@ - - - - - $e - $e - - - $unserialized - $unserialized - $datum - $expected[] $item - $item - $item - $item - $item - $test[] $test[] $test[] $test[] $test[] $test[] $test[] - $test[] - $test[] - $unserialized - $value - $value $value $value $value @@ -413,33 +381,13 @@ - $expectedFileName $result[$i] - - $expectedFileName - assertIsArray - - - addToAssertionCount - - - - 1])]]> - - - - - - - - - bar]]> baz]]> @@ -449,66 +397,4 @@ foof]]> - - - null - null - null - null - null - - - assertEmpty - - - - - $unserialized - $unserialized - $unserialized - - - $item - $test[] - $unserialized - - - - - $unserialized - $unserialized - - - $unserialized - - - - - $unserialized - $unserialized - - - $unserialized - - - - - $str - - - - - - - - - - - - - - - - - diff --git a/src/AbstractOptions.php b/src/AbstractOptions.php index d02221ab..5db2ea95 100644 --- a/src/AbstractOptions.php +++ b/src/AbstractOptions.php @@ -7,6 +7,7 @@ use Traversable; use function array_shift; +use function get_object_vars; use function is_array; use function is_callable; use function method_exists; @@ -16,6 +17,10 @@ use function strtolower; use function ucwords; +/** + * @template TValue + * @implements ParameterObjectInterface + */ abstract class AbstractOptions implements ParameterObjectInterface { // phpcs:disable PSR2.Classes.PropertyDeclaration.Underscore,WebimpressCodingStandard.NamingConventions.ValidVariableName.NotCamelCapsProperty @@ -33,7 +38,7 @@ abstract class AbstractOptions implements ParameterObjectInterface /** * Constructor * - * @param array|Traversable|null $options + * @param iterable|AbstractOptions|null $options */ public function __construct($options = null) { @@ -45,7 +50,7 @@ public function __construct($options = null) /** * Set one or more configuration properties * - * @param array|Traversable|AbstractOptions $options + * @param iterable|AbstractOptions $options * @throws Exception\InvalidArgumentException * @return AbstractOptions Provides fluent interface */ @@ -77,19 +82,20 @@ public function setFromArray($options) /** * Cast to array * - * @return array + * @return array */ public function toArray() { $array = []; - /** @param string[] $letters */ $transform = static function (array $letters): string { + /** @var list $letters */ $letter = array_shift($letters); return '_' . strtolower($letter); }; - foreach ($this as $key => $value) { + /** @psalm-var TValue $value */ + foreach (get_object_vars($this) as $key => $value) { if ($key === '__strictMode__') { continue; } @@ -106,7 +112,7 @@ public function toArray() * @see ParameterObject::__set() * * @param string $key - * @param mixed $value + * @param TValue|null $value * @throws Exception\BadMethodCallException * @return void */ @@ -137,7 +143,7 @@ public function __set($key, $value) * * @param string $key * @throws Exception\BadMethodCallException - * @return mixed + * @return TValue */ public function __get($key) { diff --git a/src/ParameterObjectInterface.php b/src/ParameterObjectInterface.php index b091c107..39e5ffce 100644 --- a/src/ParameterObjectInterface.php +++ b/src/ParameterObjectInterface.php @@ -4,28 +4,33 @@ namespace Laminas\Stdlib; +/** + * @template TKey of string + * @template TValue + */ interface ParameterObjectInterface { /** - * @param string $key + * @param TKey $key + * @param TValue|null $value * @return void */ public function __set($key, mixed $value); /** - * @param string $key - * @return mixed + * @param TKey $key + * @return TValue */ public function __get($key); /** - * @param string $key + * @param TKey $key * @return bool */ public function __isset($key); /** - * @param string $key + * @param TKey $key * @return void */ public function __unset($key); diff --git a/test/ArrayObjectTest.php b/test/ArrayObjectTest.php index b8fd19c1..880288cd 100644 --- a/test/ArrayObjectTest.php +++ b/test/ArrayObjectTest.php @@ -369,7 +369,7 @@ public function testUasort(): void public function testUksort(): void { - $function = static function ($a, $b): int { + $function = static function (string $a, string $b): int { $a = preg_replace('@^(a|an|the) @', '', $a); $b = preg_replace('@^(a|an|the) @', '', $b); self::assertNotNull($a); diff --git a/test/FastPriorityQueueTest.php b/test/FastPriorityQueueTest.php index af5aa00a..5f918de0 100644 --- a/test/FastPriorityQueueTest.php +++ b/test/FastPriorityQueueTest.php @@ -21,14 +21,15 @@ #[Group('Laminas_Stdlib')] class FastPriorityQueueTest extends TestCase { - /** @var FastPriorityQueue */ - protected $queue; + /** @var FastPriorityQueue */ + private FastPriorityQueue $queue; /** @var string[] */ - protected $expected; + private array $expected; protected function setUp(): void { + /** @psalm-var FastPriorityQueue $this->queue */ $this->queue = new FastPriorityQueue(); $this->insertDataQueue($this->queue); $this->expected = [ @@ -107,7 +108,8 @@ public function testSerializationAndDeserializationShouldMaintainState(): void { $s = serialize($this->queue); $unserialized = unserialize($s); - $count = count($this->queue); + self::assertInstanceOf(FastPriorityQueue::class, $unserialized); + $count = count($this->queue); self::assertSame( $count, count($unserialized), @@ -168,6 +170,7 @@ public function testSetInvalidExtractFlag(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('The extract flag specified is not valid'); + /** @psalm-suppress InvalidArgument */ $this->queue->setExtractFlags('foo'); } @@ -191,7 +194,7 @@ public function testContains(): void public function testHasPriority(): void { - foreach ($this->getDataPriorityQueue() as $value => $priority) { + foreach ($this->getDataPriorityQueue() as $priority) { self::assertTrue($this->queue->hasPriority($priority)); } self::assertFalse($this->queue->hasPriority(10000)); @@ -211,7 +214,7 @@ public function testCanRemoveItemFromQueue(): void self::assertEquals($expected, $test); } - public function testRemoveOnlyTheFirstOccurenceFromQueue(): void + public function testRemoveOnlyTheFirstOccurrenceFromQueue(): void { $data = $this->getDataPriorityQueue(); $this->queue->insert('test2', $data['test2']); @@ -246,7 +249,7 @@ public function testRewindShouldNotRaiseErrorWhenQueueIsEmpty(): void public function testRemoveShouldFindItemEvenIfMultipleItemsAreInQueue(): void { - $prototype = static function ($e): void { + $prototype = static function (): void { }; $queue = new FastPriorityQueue(); @@ -268,7 +271,7 @@ public function testRemoveShouldFindItemEvenIfMultipleItemsAreInQueue(): void public function testIterativelyRemovingItemsShouldRemoveAllItems(): void { - $prototype = static function ($e): void { + $prototype = static function (): void { }; $queue = new FastPriorityQueue(); diff --git a/test/GlobTest.php b/test/GlobTest.php index b5932b0b..32895b8b 100644 --- a/test/GlobTest.php +++ b/test/GlobTest.php @@ -60,6 +60,7 @@ public function testThrowExceptionOnError(): void Glob::glob($path); } + /** @param list $expectedSequence */ #[DataProvider('patternsProvider')] public function testPatterns(string $pattern, array $expectedSequence): void { @@ -75,7 +76,7 @@ public function testPatterns(string $pattern, array $expectedSequence): void /** * @psalm-return array * }> */ public static function patternsProvider(): array diff --git a/test/OptionsTest.php b/test/OptionsTest.php index 10f520df..0bcce63b 100644 --- a/test/OptionsTest.php +++ b/test/OptionsTest.php @@ -63,9 +63,9 @@ public function testUnsetting(): void { $options = new TestOptions(['test_field' => 1]); - self::assertEquals(true, isset($options->test_field)); + self::assertTrue(isset($options->test_field)); unset($options->testField); - self::assertEquals(false, isset($options->test_field)); + self::assertFalse(isset($options->test_field)); } public function testUnsetThrowsInvalidArgumentException(): void @@ -99,6 +99,7 @@ public function testSetFromArrayThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); $options = new TestOptions(); + /** @psalm-suppress InvalidArgument */ $options->setFromArray('asd'); } @@ -179,9 +180,7 @@ public function testIssetDoesNotThrowExceptionWhenMatchingGetterDoesNotExist(): { $options = new TestOptionsWithoutGetter(); - isset($options->foo); - - $this->addToAssertionCount(1); + self::assertFalse(isset($options->foo)); } #[Group('7287')] diff --git a/test/ParametersTest.php b/test/ParametersTest.php index ebd3f6bd..91923f2a 100644 --- a/test/ParametersTest.php +++ b/test/ParametersTest.php @@ -4,9 +4,14 @@ namespace LaminasTest\Stdlib; +use ArrayAccess; +use ArrayObject; +use Countable; use Laminas\Stdlib\Parameters; use Laminas\Stdlib\ParametersInterface; use PHPUnit\Framework\TestCase; +use Serializable; +use Traversable; class ParametersTest extends TestCase { @@ -14,11 +19,11 @@ public function testParametersConstructionAndClassStructure(): void { $parameters = new Parameters(); self::assertInstanceOf(ParametersInterface::class, $parameters); - self::assertInstanceOf('ArrayObject', $parameters); - self::assertInstanceOf('ArrayAccess', $parameters); - self::assertInstanceOf('Countable', $parameters); - self::assertInstanceOf('Serializable', $parameters); - self::assertInstanceOf('Traversable', $parameters); + self::assertInstanceOf(ArrayObject::class, $parameters); + self::assertInstanceOf(ArrayAccess::class, $parameters); + self::assertInstanceOf(Countable::class, $parameters); + self::assertInstanceOf(Serializable::class, $parameters); + self::assertInstanceOf(Traversable::class, $parameters); } public function testParametersPersistNameAndValues(): void @@ -45,7 +50,7 @@ public function testParametersPersistNameAndValues(): void self::assertEquals('barf', $parameters->foof); } - public function testParametersOffsetgetReturnsNullIfNonexistentKeyIsProvided(): void + public function testParametersOffsetGetReturnsNullIfNonexistentKeyIsProvided(): void { $parameters = new Parameters(); self::assertNull($parameters->foo); diff --git a/test/PriorityListTest.php b/test/PriorityListTest.php index 4484c369..1a15a9c9 100644 --- a/test/PriorityListTest.php +++ b/test/PriorityListTest.php @@ -10,12 +10,11 @@ use stdClass; use function array_keys; -use function count; use function iterator_to_array; class PriorityListTest extends TestCase { - /** @var PriorityList */ + /** @var PriorityList */ protected $list; protected function setUp(): void @@ -27,7 +26,7 @@ public function testInsert(): void { $this->list->insert('foo', new stdClass(), 0); - self::assertEquals(1, count($this->list)); + self::assertCount(1, $this->list); $values = $this->list->toArray(); self::assertArrayHasKey('foo', $values); @@ -38,17 +37,17 @@ public function testInsertDuplicates(): void $this->list->insert('foo', new stdClass()); $this->list->insert('bar', new stdClass()); - self::assertEquals(2, count($this->list)); + self::assertCount(2, $this->list); $this->list->insert('foo', new stdClass()); $this->list->insert('foo', new stdClass()); $this->list->insert('bar', new stdClass()); - self::assertEquals(2, count($this->list)); + self::assertCount(2, $this->list); $this->list->remove('foo'); - self::assertEquals(1, count($this->list)); + self::assertCount(1, $this->list); } public function testRemove(): void @@ -56,18 +55,18 @@ public function testRemove(): void $this->list->insert('foo', new stdClass(), 0); $this->list->insert('bar', new stdClass(), 0); - self::assertEquals(2, count($this->list)); + self::assertCount(2, $this->list); $this->list->remove('foo'); - self::assertEquals(1, count($this->list)); + self::assertCount(1, $this->list); } public function testRemovingNonExistentRouteDoesNotYieldError(): void { $this->list->remove('foo'); - self::assertEmpty($this->list); + self::assertEmpty($this->list->toArray()); } public function testClear(): void @@ -75,11 +74,11 @@ public function testClear(): void $this->list->insert('foo', new stdClass(), 0); $this->list->insert('bar', new stdClass(), 0); - self::assertEquals(2, count($this->list)); + self::assertCount(2, $this->list); $this->list->clear(); - self::assertEquals(0, count($this->list)); + self::assertCount(0, $this->list); self::assertSame(false, $this->list->current()); } @@ -156,7 +155,7 @@ public function testFIFOOnly(): void public function testPriorityWithNegativesAndNull(): void { - $this->list->insert('foo', new stdClass(), null); + $this->list->insert('foo', new stdClass()); $this->list->insert('bar', new stdClass(), 1); $this->list->insert('baz', new stdClass(), -1); @@ -167,7 +166,7 @@ public function testPriorityWithNegativesAndNull(): void public function testCurrent(): void { - $this->list->insert('foo', 'foo_value', null); + $this->list->insert('foo', 'foo_value'); $this->list->insert('bar', 'bar_value', 1); $this->list->insert('baz', 'baz_value', -1); @@ -187,7 +186,7 @@ public function testIterator(): void public function testToArray(): void { - $this->list->insert('foo', 'foo_value', null); + $this->list->insert('foo', 'foo_value'); $this->list->insert('bar', 'bar_value', 1); $this->list->insert('baz', 'baz_value', -1); @@ -210,12 +209,13 @@ public function testToArray(): void ); } + /** @psalm-suppress MixedAssignment */ #[Group('6768')] #[Group('6773')] public function testBooleanValuesAreValid(): void { - $this->list->insert('null', null, null); - $this->list->insert('false', false, null); + $this->list->insert('null', null); + $this->list->insert('false', false); $this->list->insert('string', 'test', 1); $this->list->insert('true', true, -1); diff --git a/test/PriorityQueueTest.php b/test/PriorityQueueTest.php index 2ea04bcf..bae343f9 100644 --- a/test/PriorityQueueTest.php +++ b/test/PriorityQueueTest.php @@ -19,11 +19,12 @@ #[Group('Laminas_Stdlib')] class PriorityQueueTest extends TestCase { - /** @var PriorityQueue */ - protected $queue; + /** @var PriorityQueue */ + private PriorityQueue $queue; protected function setUp(): void { + /** @psalm-var PriorityQueue $this->queue */ $this->queue = new PriorityQueue(); $this->queue->insert('foo', 3); $this->queue->insert('bar', 4); @@ -35,7 +36,8 @@ public function testSerializationAndDeserializationShouldMaintainState(): void { $s = serialize($this->queue); $unserialized = unserialize($s); - $count = count($this->queue); + self::assertInstanceOf(PriorityQueue::class, $unserialized); + $count = count($this->queue); self::assertSame( $count, count($unserialized), diff --git a/test/SplQueueTest.php b/test/SplQueueTest.php index 02cc1970..1e1d0f9c 100644 --- a/test/SplQueueTest.php +++ b/test/SplQueueTest.php @@ -31,8 +31,8 @@ public function testSerializationAndDeserializationShouldMaintainState(): void { $s = serialize($this->queue); $unserialized = unserialize($s); - $count = count($this->queue); - self::assertSame($count, count($unserialized)); + self::assertInstanceOf(SplQueue::class, $unserialized); + self::assertSame(count($this->queue), count($unserialized)); $expected = iterator_to_array($this->queue); $test = iterator_to_array($unserialized); diff --git a/test/SplStackTest.php b/test/SplStackTest.php index c44f3923..9ac0b1f8 100644 --- a/test/SplStackTest.php +++ b/test/SplStackTest.php @@ -33,8 +33,8 @@ public function testSerializationAndDeserializationShouldMaintainState(): void { $s = serialize($this->stack); $unserialized = unserialize($s); - $count = count($this->stack); - self::assertSame($count, count($unserialized)); + self::assertInstanceOf(SplStack::class, $unserialized); + self::assertSame(count($this->stack), count($unserialized)); $expected = iterator_to_array($this->stack); $test = iterator_to_array($unserialized); diff --git a/test/StringUtilsTest.php b/test/StringUtilsTest.php index 3ccad892..f832a73c 100644 --- a/test/StringUtilsTest.php +++ b/test/StringUtilsTest.php @@ -154,12 +154,10 @@ public static function getUtf8StringValidity(): array ]; } - /** - * @param bool $valid - */ #[DataProvider('getUtf8StringValidity')] - public function testIsValidUtf8(mixed $str, $valid): void + public function testIsValidUtf8(mixed $str, bool $valid): void { + /** @psalm-suppress MixedArgument */ self::assertSame($valid, StringUtils::isValidUtf8($str)); } diff --git a/test/StringWrapper/CommonStringWrapperTestCase.php b/test/StringWrapper/CommonStringWrapperTestCase.php index 9e4104b2..acb171cd 100644 --- a/test/StringWrapper/CommonStringWrapperTestCase.php +++ b/test/StringWrapper/CommonStringWrapperTestCase.php @@ -17,12 +17,10 @@ // phpcs:ignore WebimpressCodingStandard.NamingConventions.AbstractClass.Prefix abstract class CommonStringWrapperTestCase extends TestCase { - /** - * @param null|string $encoding - * @param null|string $convertEncoding - * @return false|StringWrapperInterface - */ - abstract protected function getWrapper($encoding = null, $convertEncoding = null); + abstract protected function getWrapper( + string|null $encoding = null, + string|null $convertEncoding = null, + ): StringWrapperInterface|false; /** * @psalm-return arrayfail('Missing expected Laminas\Stdlib\Exception\ExtensionNotLoadedException'); } catch (Exception\ExtensionNotLoadedException) { $this->markTestSkipped('Missing ext/iconv'); @@ -45,13 +44,10 @@ protected function setUp(): void parent::setUp(); } - /** - * @param null|string $encoding - * @param null|string $convertEncoding - * @return false|StringWrapperInterface - */ - protected function getWrapper($encoding = null, $convertEncoding = null) - { + protected function getWrapper( + string|null $encoding = null, + string|null $convertEncoding = null, + ): Iconv|false { if ($encoding === null) { $supportedEncodings = Iconv::getSupportedEncodings(); $encoding = array_shift($supportedEncodings); diff --git a/test/StringWrapper/IntlTest.php b/test/StringWrapper/IntlTest.php index f6dbc291..94fef23d 100644 --- a/test/StringWrapper/IntlTest.php +++ b/test/StringWrapper/IntlTest.php @@ -16,7 +16,7 @@ protected function setUp(): void { if (! extension_loaded('intl')) { try { - new Intl('utf-8'); + new Intl(); $this->fail('Missing expected Laminas\Stdlib\Exception\ExtensionNotLoadedException'); } catch (Exception\ExtensionNotLoadedException) { $this->markTestSkipped('Missing ext/intl'); @@ -26,13 +26,10 @@ protected function setUp(): void parent::setUp(); } - /** - * @param null|string $encoding - * @param null|string $convertEncoding - * @return Intl|false - */ - protected function getWrapper($encoding = null, $convertEncoding = null) - { + protected function getWrapper( + string|null $encoding = null, + string|null $convertEncoding = null, + ): Intl|false { if ($encoding === null) { $supportedEncodings = Intl::getSupportedEncodings(); $encoding = array_shift($supportedEncodings); diff --git a/test/StringWrapper/MbStringTest.php b/test/StringWrapper/MbStringTest.php index 6d0ee2f0..e0535168 100644 --- a/test/StringWrapper/MbStringTest.php +++ b/test/StringWrapper/MbStringTest.php @@ -16,7 +16,7 @@ protected function setUp(): void { if (! extension_loaded('mbstring')) { try { - new MbString('utf-8'); + new MbString(); $this->fail('Missing expected Laminas\Stdlib\Exception\ExtensionNotLoadedException'); } catch (Exception\ExtensionNotLoadedException) { $this->markTestSkipped('Missing ext/mbstring'); @@ -26,13 +26,10 @@ protected function setUp(): void parent::setUp(); } - /** - * @param null|string $encoding - * @param null|string $convertEncoding - * @return MbString|false - */ - protected function getWrapper($encoding = null, $convertEncoding = null) - { + protected function getWrapper( + string|null $encoding = null, + string|null $convertEncoding = null, + ): MbString|false { if ($encoding === null) { $supportedEncodings = MbString::getSupportedEncodings(); $encoding = array_shift($supportedEncodings); diff --git a/test/StringWrapper/NativeTest.php b/test/StringWrapper/NativeTest.php index b554a1c8..1c718f67 100644 --- a/test/StringWrapper/NativeTest.php +++ b/test/StringWrapper/NativeTest.php @@ -10,13 +10,10 @@ class NativeTest extends CommonStringWrapperTestCase { - /** - * @param null|string $encoding - * @param null|string $convertEncoding - * @return Native|false - */ - protected function getWrapper($encoding = null, $convertEncoding = null) - { + protected function getWrapper( + string|null $encoding = null, + string|null $convertEncoding = null, + ): Native|false { if ($encoding === null) { $supportedEncodings = Native::getSupportedEncodings(); $encoding = array_shift($supportedEncodings); diff --git a/test/TestAsset/TestOptions.php b/test/TestAsset/TestOptions.php index 660a64d7..7ffa0284 100644 --- a/test/TestAsset/TestOptions.php +++ b/test/TestAsset/TestOptions.php @@ -8,28 +8,25 @@ /** * Dummy TestOptions used to test Stdlib\Options + * + * @extends AbstractOptions */ class TestOptions extends AbstractOptions { - /** @var mixed */ - protected $testField; + protected mixed $testField; - /** @var mixed */ - private $parentPrivate; + private mixed $parentPrivate; - /** @var mixed */ - protected $parentProtected; + protected mixed $parentProtected; - /** @var mixed */ - protected $parentPublic; + protected mixed $parentPublic; public function setTestField(mixed $value): void { $this->testField = $value; } - /** @return mixed */ - public function getTestField() + public function getTestField(): mixed { return $this->testField; } @@ -44,10 +41,8 @@ private function setParentPrivate(mixed $parentPrivate): void /** * Needed to test accessibility of getters / setters within deriving classes - * - * @return mixed */ - private function getParentPrivate() + private function getParentPrivate(): mixed { return $this->parentPrivate; } @@ -62,10 +57,8 @@ protected function setParentProtected(mixed $parentProtected): void /** * Needed to test accessibility of getters / setters within deriving classes - * - * @return mixed */ - protected function getParentProtected() + protected function getParentProtected(): mixed { return $this->parentProtected; } @@ -80,10 +73,8 @@ public function setParentPublic(mixed $parentPublic): void /** * Needed to test accessibility of getters / setters within deriving classes - * - * @return mixed */ - public function getParentPublic() + public function getParentPublic(): mixed { return $this->parentPublic; } diff --git a/test/TestAsset/TestOptionsDerived.php b/test/TestAsset/TestOptionsDerived.php index 54215d22..a8620ca2 100644 --- a/test/TestAsset/TestOptionsDerived.php +++ b/test/TestAsset/TestOptionsDerived.php @@ -9,14 +9,11 @@ */ class TestOptionsDerived extends TestOptions { - /** @var mixed */ - private $derivedPrivate; + private mixed $derivedPrivate; - /** @var mixed */ - protected $derivedProtected; + protected mixed $derivedProtected; - /** @var mixed */ - protected $derivedPublic; + protected mixed $derivedPublic; /** * Needed to test accessibility of getters / setters within deriving classes @@ -28,10 +25,8 @@ private function setDerivedPrivate(mixed $derivedPrivate): void /** * Needed to test accessibility of getters / setters within deriving classes - * - * @return mixed */ - private function getDerivedPrivate() + private function getDerivedPrivate(): mixed { return $this->derivedPrivate; } @@ -46,10 +41,8 @@ protected function setDerivedProtected(mixed $derivedProtected): void /** * Needed to test accessibility of getters / setters within deriving classes - * - * @return mixed */ - protected function getDerivedProtected() + protected function getDerivedProtected(): mixed { return $this->derivedProtected; } @@ -64,10 +57,8 @@ public function setDerivedPublic(mixed $derivedPublic): void /** * Needed to test accessibility of getters / setters within deriving classes - * - * @return mixed */ - public function getDerivedPublic() + public function getDerivedPublic(): mixed { return $this->derivedPublic; } diff --git a/test/TestAsset/TestOptionsNoStrict.php b/test/TestAsset/TestOptionsNoStrict.php index 039d1095..3e29705d 100644 --- a/test/TestAsset/TestOptionsNoStrict.php +++ b/test/TestAsset/TestOptionsNoStrict.php @@ -8,6 +8,8 @@ /** * Dummy TestOptions used to test Stdlib\Options + * + * @extends AbstractOptions */ class TestOptionsNoStrict extends AbstractOptions { @@ -18,16 +20,14 @@ class TestOptionsNoStrict extends AbstractOptions // phpcs:enable - /** @var mixed */ - protected $testField; + protected mixed $testField; public function setTestField(mixed $value): void { $this->testField = $value; } - /** @return mixed */ - public function getTestField() + public function getTestField(): mixed { return $this->testField; } diff --git a/test/TestAsset/TestOptionsWithoutGetter.php b/test/TestAsset/TestOptionsWithoutGetter.php index e0cfd5aa..08824e90 100644 --- a/test/TestAsset/TestOptionsWithoutGetter.php +++ b/test/TestAsset/TestOptionsWithoutGetter.php @@ -8,11 +8,12 @@ /** * Dummy TestOptions used to test Stdlib\Options + * + * @extends AbstractOptions */ class TestOptionsWithoutGetter extends AbstractOptions { - /** @var mixed */ - protected $foo; + protected mixed $foo; public function setFoo(mixed $value): void {