89252[TASK] Update phpstan to 2.1.14
Commit message
Review
-
Code review CR +2 Done
- Benni Mack +2
- Benjamin Franzke +1
-
Verified V +2 Done
- Benni Mack +2
- Benjamin Franzke +1
- core-ci +1 CI
Issues 1
Files 4
Review log 2025
-
Anja Leichsenring uploaded patch set 1 04/28/25, 05:24
-
Andreas Kienast commented on patch set 1 04/28/25, 05:29
-
core-ci voted on patch set 1 V +1 04/28/25, 05:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78259
-
Anja Leichsenring commented on patch set 1 04/28/25, 05:46
created a report at phpstan for the GU::makeInstance being null report: https://github.com/phpstan/phpstan/issues/12940 -
Garvin Hicking commented on patch set 1 04/28/25, 06:08
EvaluateDisplayConditions.php:323we should add 'true' as third param for strictness -
Anja Leichsenring commented on patch set 1 04/28/25, 06:10
EvaluateDisplayConditions.php:323Replynot done in the occurence above, I think we should stay consistent here. -
Mathias Brodala commented on patch set 1 04/28/25, 07:48
EvaluateDisplayConditions.php:323Reply... and repeat existing faulty code? ;-) I agree that type safety should be enforced for new code. (here) And added to existing code in a separate change. (not here) -
Benjamin Franzke commented on patch set 1 04/28/25, 09:13
EvaluateDisplayConditions.php:323ReplyWe need to look back at the phpstan error, which is (copied from nightly failure): ``` ------ --------------------------------------------------------------------- Line backend/Classes/Form/FormDataProvider/EvaluateDisplayConditions.php ------ --------------------------------------------------------------------- 324 Strict comparison using === between '!=' and '!=' will always evaluate to true. 🪪 identical.alwaysTrue ``` It reported that `!=` will always be `!=`, because phpstan performed dead-code elimination based on the previous in_array checks and noticed: the value can actually only be one of the four and therefore reports the last of these four checks as alwaysTrue. This effectively means this entire `elseif` condition is unneeded and *could* actually just be an `else` without a condition because all allowed values are checked in line 271, and all other values are alread "eliminated"/handled in earlier conditions. So I'd say: Raise the phpstan baseline for the sake of simplicity or move the exception from line 273 into an else branch to avoid duplicated value checks. I'd probably do the latter for main only. -
Benjamin Franzke commented on patch set 1 04/28/25, 09:16
EvaluateDisplayConditions.php:323Replybtw, regarding the change to `in_array`: transforming the previous strict condition into a non-strict condition, just to make phpstan "happy" (making it beleive it could also be some other value that loosely matches) is not a good option. -
Anja Leichsenring uploaded patch set 2
V +104/28/25, 13:26 -
Anja Leichsenring commented on patch set 2 04/28/25, 13:32
EvaluateDisplayConditions.php:323ReplyI introduced the strict comparison now. Moving the exception would lead to additional calculation, because in front of all the `ifs` it already answers any invalid inputs. Putting it into the else branch would mean testing for all the branches before, which is unneccesary. Simplifying the last elseif to a pure else would work, but this is something for main only I guess. -
core-ci voted on patch set 2 V +1 04/28/25, 13:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78279
-
Benjamin Franzke uploaded patch set 3
V +104/29/25, 09:02 -
Benjamin Franzke commented on patch set 3 04/29/25, 09:02
phpstan-baseline.neon:3220ReplyYes, @aleichsenring@ab-softlab.de already reported that upstream: https://github.com/phpstan/phpstan/issues/12940 There were even more reports in the meantime which basically report the same: https://github.com/phpstan/phpstan/issues/12946 https://github.com/phpstan/phpstan/issues/12947 I think we should wait a day or two to see if an upstream bugfix release is shipped that fixes this issue.EvaluateDisplayConditions.php:323ReplyYes, that's what I described as well, but the fix still worked around the phpstan finding, by combining strict and non-strict in-array checks. I've reworked this to move the exception into an else branch for main-only. Let's raise the baseline for the backports. -
core-ci voted on patch set 3 V -1 04/29/25, 09:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78336
-
Benjamin Franzke commented on patch set 3 04/29/25, 09:13
phpstan-baseline.neon:3220ReplyBtw, this is the change that likely introduced this problem. The author already reacted and noticed that the release is broken: https://github.com/phpstan/phpstan-src/pull/3945#issuecomment-2835657783 He is working on a fix in https://github.com/phpstan/phpstan-src/pull/3965 -
Benjamin Franzke uploaded patch set 4
V -104/29/25, 09:21 -
core-ci voted on patch set 4 V +1 04/29/25, 09:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78337
-
Christian Kuhn voted on patch set 4 CR +1 V +1 04/30/25, 11:32
-
Oliver Klee voted on patch set 4 V +1 04/30/25, 12:05
-
Benjamin Franzke uploaded patch set 5
CR +1V +105/03/25, 04:24 -
Benjamin Franzke commented on patch set 5 05/03/25, 04:24
phpstan-baseline.neon:3220ReplyThe regression has been fixed via mentioned PR upstream. We're good to merge (2.1.14) now. Thanks for waiting everyone. -
core-ci voted on patch set 5 V +1 05/03/25, 04:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78456
-
Benni Mack voted on patch set 5 CR +2 V +2 05/03/25, 06:25
-
Benni Mack merged patch set 6 05/03/25, 06:25
phpstan-baseline.neon:3220