From df2f64511c9a218b8e1aced38e95df1260ac3f73 Mon Sep 17 00:00:00 2001 From: Oliver Klee <typo3-coding@oliverklee.de> Date: Fri, 15 Apr 2022 18:17:45 +0200 Subject: [PATCH] [TASK] Raise PHPStan to version 1.5.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The new version finds some new possible bugs and removes some incorrect ones. Also update phpstan/phpstan-phpunit. Used commands: > composer req --dev phpstan/phpstan:^1.5.6 > composer req --dev phpstan/phpstan-phpunit:^1.1.0 > Build/Scripts/runTests.sh -s phpstanGenerateBaseline Resolves: #97397 Releases: main, 11.5 Change-Id: I052ba01b33582f3f18f49c0ee2375f63d1048f4b Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74325 Tested-by: core-ci <typo3@b13.com> Tested-by: Stefan Bürk <stefan@buerk.tech> Tested-by: Benni Mack <benni@typo3.org> Reviewed-by: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Benni Mack <benni@typo3.org> --- Build/phpstan/phpstan-baseline.neon | 67 +++++++++-------------------- composer.json | 4 +- composer.lock | 40 +++++++---------- 3 files changed, 39 insertions(+), 72 deletions(-) diff --git a/Build/phpstan/phpstan-baseline.neon b/Build/phpstan/phpstan-baseline.neon index 5fb2f4810392..cd83aabaeebe 100644 --- a/Build/phpstan/phpstan-baseline.neon +++ b/Build/phpstan/phpstan-baseline.neon @@ -116,45 +116,10 @@ parameters: path: ../../typo3/sysext/backend/Classes/Form/Element/ImageManipulationElement.php - - message: "#^If condition is always true\\.$#" - count: 3 - path: ../../typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php - - - - message: "#^Offset 'header' on array\\{header\\: array\\{icon\\: string, title\\: mixed\\}, items\\: array\\<int, array\\{id\\: string, name\\: non\\-empty\\-string, value\\: mixed, checked\\: bool, icon\\: string, title\\: mixed, help\\: string\\}\\>\\} on left side of \\?\\? always exists and is not nullable\\.$#" - count: 1 - path: ../../typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php - - - - message: "#^If condition is always true\\.$#" - count: 2 - path: ../../typo3/sysext/backend/Classes/Form/Element/SelectMultipleSideBySideElement.php - - - - message: "#^Offset 'header' on array\\{header\\: array\\{title\\: mixed, disabled\\?\\: false\\}, items\\: non\\-empty\\-array\\<int, array\\{label\\: string, attributes\\: non\\-empty\\-array\\<literal\\-string&non\\-empty\\-string, mixed\\>\\}\\>\\} in isset\\(\\) always exists and is not nullable\\.$#" + message: "#^Strict comparison using \\=\\=\\= between non\\-empty\\-array\\<'disabled'\\|'title'\\|int, mixed\\> and array\\{\\} will always evaluate to false\\.$#" count: 1 path: ../../typo3/sysext/backend/Classes/Form/Element/SelectMultipleSideBySideElement.php - - - message: "#^Offset 'items' on array\\{header\\: array\\{title\\: mixed, disabled\\?\\: false\\}, items\\: array\\<int, array\\{label\\: string, attributes\\: non\\-empty\\-array\\<literal\\-string&non\\-empty\\-string, mixed\\>\\}\\>\\} on left side of \\?\\? always exists and is not nullable\\.$#" - count: 1 - path: ../../typo3/sysext/backend/Classes/Form/Element/SelectMultipleSideBySideElement.php - - - - message: "#^Offset 'header' on array\\{header\\: array\\{title\\: mixed\\}, items\\: non\\-empty\\-array\\<int, array\\{title\\: string, value\\: mixed, icon\\: string, selected\\: bool\\}\\>\\} on left side of \\?\\? always exists and is not nullable\\.$#" - count: 1 - path: ../../typo3/sysext/backend/Classes/Form/Element/SelectSingleElement.php - - - - message: "#^Offset 'title' on array\\{title\\: string, value\\: mixed, icon\\: string, selected\\: bool\\} on left side of \\?\\? always exists and is not nullable\\.$#" - count: 1 - path: ../../typo3/sysext/backend/Classes/Form/Element/SelectSingleElement.php - - - - message: "#^Ternary operator condition is always true\\.$#" - count: 2 - path: ../../typo3/sysext/backend/Classes/Form/Element/SelectSingleElement.php - - message: "#^Right side of && is always true\\.$#" count: 1 @@ -1745,11 +1710,6 @@ parameters: count: 1 path: ../../typo3/sysext/core/Classes/Utility/GeneralUtility.php - - - message: "#^Offset 'values' does not exist on array\\{\\}\\|array\\{attrs\\?\\: mixed, ch\\?\\: array\\<int\\|string, array\\<int, array\\<literal\\-string&non\\-empty\\-string, mixed\\>\\>\\>, values\\?\\: array\\<int, mixed\\>\\}\\.$#" - count: 1 - path: ../../typo3/sysext/core/Classes/Utility/GeneralUtility.php - - message: "#^Parameter \\#1 \\$separator of function explode expects non\\-empty\\-string, string given\\.$#" count: 3 @@ -1910,11 +1870,6 @@ parameters: count: 1 path: ../../typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedPatternMapperTest.php - - - message: "#^Property TYPO3\\\\CMS\\\\Core\\\\Tests\\\\Functional\\\\Service\\\\Archive\\\\ZipServiceTest\\:\\:\\$vfs is never read, only written\\.$#" - count: 1 - path: ../../typo3/sysext/core/Tests/Functional/Service/Archive/ZipServiceTest.php - - message: "#^Property TYPO3\\\\CMS\\\\Core\\\\Authentication\\\\AbstractUserAuthentication\\:\\:\\$checkPid_value \\(int\\|string\\) does not accept null\\.$#" count: 1 @@ -4175,6 +4130,11 @@ parameters: count: 1 path: ../../typo3/sysext/frontend/Classes/Typolink/PageLinkBuilder.php + - + message: "#^Offset 'extTarget' on array\\<'parameter', mixed\\> in isset\\(\\) does not exist\\.$#" + count: 1 + path: ../../typo3/sysext/frontend/Classes/Typolink/PageLinkBuilder.php + - message: "#^Parameter \\#2 \\$conf of method TYPO3\\\\CMS\\\\Frontend\\\\ContentObject\\\\ContentObjectRenderer\\:\\:parseFunc\\(\\) expects non\\-empty\\-array\\<string, mixed\\>\\|null, array given\\.$#" count: 5 @@ -4790,6 +4750,21 @@ parameters: count: 1 path: ../../typo3/sysext/lowlevel/Classes/Integrity/DatabaseIntegrityCheck.php + - + message: "#^Method TYPO3\\\\CMS\\\\Recordlist\\\\LinkHandler\\\\FileLinkHandler\\:\\:getUrlParameters\\(\\) should return array\\<string\\> but returns array\\<string, mixed\\>\\.$#" + count: 1 + path: ../../typo3/sysext/recordlist/Classes/LinkHandler/FileLinkHandler.php + + - + message: "#^Method TYPO3\\\\CMS\\\\Recordlist\\\\LinkHandler\\\\PageLinkHandler\\:\\:getUrlParameters\\(\\) should return array\\<string\\> but returns array\\<string, array\\|int\\|string\\>\\.$#" + count: 1 + path: ../../typo3/sysext/recordlist/Classes/LinkHandler/PageLinkHandler.php + + - + message: "#^Method TYPO3\\\\CMS\\\\Recordlist\\\\LinkHandler\\\\RecordLinkHandler\\:\\:getUrlParameters\\(\\) should return array\\<string\\> but returns array\\<string, array\\|int\\|string\\>\\.$#" + count: 1 + path: ../../typo3/sysext/recordlist/Classes/LinkHandler/RecordLinkHandler.php + - message: "#^Cannot assign offset 'currentValue' to string\\.$#" count: 1 diff --git a/composer.json b/composer.json index b44f929b0606..c779224e1194 100644 --- a/composer.json +++ b/composer.json @@ -112,8 +112,8 @@ "php-webdriver/webdriver": "^1.12.0", "phpspec/prophecy": "^1.14.0", "phpspec/prophecy-phpunit": "^2.0", - "phpstan/phpstan": "^1.4.9", - "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan": "^1.5.6", + "phpstan/phpstan-phpunit": "^1.1.0", "phpunit/phpunit": "^9.5.10", "typo3/cms-styleguide": "~12.0@dev", "typo3/testing-framework": "dev-main" diff --git a/composer.lock b/composer.lock index 4cd1fc9f5f97..4fd1bd56352b 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": "532408f6bb1d88c78244591a1c7f5aa7", + "content-hash": "0698600925c64878676f55b7ed6c5b9f", "packages": [ { "name": "bacon/bacon-qr-code", @@ -6364,20 +6364,20 @@ }, { "name": "phpstan/phpstan", - "version": "1.4.9", + "version": "1.5.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "1a45f44d319cf000a8c960af6b7435741e944771" + "reference": "799dd8c2d2c9c704bb55d2078078cb970cf0f6d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1a45f44d319cf000a8c960af6b7435741e944771", - "reference": "1a45f44d319cf000a8c960af6b7435741e944771", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/799dd8c2d2c9c704bb55d2078078cb970cf0f6d1", + "reference": "799dd8c2d2c9c704bb55d2078078cb970cf0f6d1", "shasum": "" }, "require": { - "php": "^7.1|^8.0" + "php": "^7.2|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -6387,11 +6387,6 @@ "phpstan.phar" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, "autoload": { "files": [ "bootstrap.php" @@ -6404,7 +6399,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.4.9" + "source": "https://github.com/phpstan/phpstan/tree/1.5.6" }, "funding": [ { @@ -6424,25 +6419,25 @@ "type": "tidelift" } ], - "time": "2022-03-10T08:52:08+00:00" + "time": "2022-04-15T11:13:37+00:00" }, { "name": "phpstan/phpstan-phpunit", - "version": "1.0.0", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "9eb88c9f689003a8a2a5ae9e010338ee94dc39b3" + "reference": "09133ce914f1388a8bb8c7f8573aaa3723cff52a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/9eb88c9f689003a8a2a5ae9e010338ee94dc39b3", - "reference": "9eb88c9f689003a8a2a5ae9e010338ee94dc39b3", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/09133ce914f1388a8bb8c7f8573aaa3723cff52a", + "reference": "09133ce914f1388a8bb8c7f8573aaa3723cff52a", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0", - "phpstan/phpstan": "^1.0" + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.5.0" }, "conflict": { "phpunit/phpunit": "<7.0" @@ -6455,9 +6450,6 @@ }, "type": "phpstan-extension", "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - }, "phpstan": { "includes": [ "extension.neon", @@ -6477,9 +6469,9 @@ "description": "PHPUnit extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.0.0" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.1.0" }, - "time": "2021-10-14T08:03:54+00:00" + "time": "2022-03-28T09:20:49+00:00" }, { "name": "phpunit/php-code-coverage", -- GitLab