Review main Merged

93472[TASK] Update phpstan to 2.1.45

Anja Leichsenring CR +2 V +2 Easy +14 −8 updated 03/31/26, 05:40

Commit message

The new version causes new errors detected, what warrants the update
of the minimum version and fixing of messages.

Used commands:

	Build/Scripts/runTests.sh -s composer /
		-- require --dev phpstan/phpstan:^2.1.45
	Build/Scripts/runTests.sh -s phpstanGenerateBaseline

Review

  • Code review CR +2 Done
    • Anja Leichsenring +2
    • Garvin Hicking +1
    • Stefan Bürk +1
    • Elias Häußler +1
  • Verified V +2 Done
    • Anja Leichsenring +2
    • Garvin Hicking +1
    • Stefan Bürk +1
    • Elias Häußler +1
    • core-ci +1 CI

Issues 1

Files 5

Review log 1213

  1. Anja Leichsenring uploaded patch set 1 03/31/26, 03:50

  2. core-ci voted on patch set 1 V +1 03/31/26, 04:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99197

  3. Elias Häußler commented on patch set 1 03/31/26, 05:18

    phpstan-baseline.neon:364

    I'd rather remove the affected `is_object` check (https://github.com/TYPO3/typo3/blob/eb60cb4d1f4a6fabae91b016e69fcf3ec18867bf/typo3/sysext/form/Classes/ViewHelpers/RenderFormValueViewHelper.php#L124), because – from my understanding – object storages may ONLY contain objects (which is reflected by the `attach` and `detach` methods). WDYT?
  4. Garvin Hicking commented on patch set 1 CR +1 V +1 03/31/26, 05:18

    phpstan-baseline.neon:367

    Yeah I'm also not confident enough to change this at this time

    TimeTracker.php:269

    (only floats allowed, valid)

    ExtbasePluginEnhancer.php:112

    (valid, AbstractEnhancer sets $aspects = [] with array notation)
  5. Garvin Hicking commented on patch set 1 03/31/26, 05:20

    phpstan-baseline.neon:364 Reply

    Thinking more about this, it only got introduced with https://review.typo3.org/c/Packages/TYPO3.CMS/+/92018 in 14.2 - so we could change this, I change my mind....?
  6. Anja Leichsenring commented on patch set 1 03/31/26, 05:25

    phpstan-baseline.neon:364 Reply

    the $value argument put into the function states itself as all kind of types, so while I agree there _should_ be nothing but objects in an objectStorage, and phpstan agrees with all of us, I am reluctant to remove the check right now. I would prefer to have more thorough look after the release.
  7. Elias Häußler commented on patch set 1 03/31/26, 05:28

    phpstan-baseline.neon:364 Reply

    Acknowledged
  8. Elias Häußler voted on patch set 1 CR +1 V +1 03/31/26, 05:29

  9. Stefan Bürk commented on patch set 1 CR +1 V +1 03/31/26, 05:37

    phpstan-baseline.neon:364 Reply

    I disagree here with phpstan. It seems that it takes the `@template TEntity of object` on class level higher than the \ArrayAccess methods implementations having mixed for the item to set/get and similar with method docblocks of * offsetGet `TEntity|int|string` * offsetUnset `TEntity|int|string` * offsetExists `TEntity|int|string` * offsetGet `TEntity|string|null` ObjectStorage needs some love and hardening with custom checks and exception instead of ending up in generic TypeErrors. That PHPStan is now thinking that this is possible and save is a side effect that we disabled `treatPhpDocTypesAsCertain` with 93027: [TASK] phpstan: do not treatPhpDocTypesAsCertain | https://review.typo3.org/c/Packages/TYPO3.CMS/+/93027 I would currently not take ObjectStorage that objectsafe like PHPSTan. That means I'm here against removing the is_object() call from the ViewHelper and going with adding the baseline entry for now special for the backports.
  10. Stefan Bürk commented on patch set 1 03/31/26, 05:37

    phpstan-baseline.neon:364 Reply

    Done
  11. Anja Leichsenring voted on patch set 1 CR +2 V +2 03/31/26, 05:39

  12. Anja Leichsenring merged patch set 2 03/31/26, 05:39

  13. Stefan Bürk voted on patch set 1 CR +2 V +2 03/31/26, 05:40