Review main Merged

92900[TASK] Remove last remaining obvious phpstan issues

Benni Mack CR +2 V +2 Hard +244 −756 updated 02/27/26, 15:38

Commit message

With this change "only" 116 errors in the baseline
file are left, which are still valid and not that
easy to resolve.

The left changes also allow us to discuss whether
we want to treat phpdoc type annotations as certain.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oliver Klee +1
    • Garvin Hicking +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oliver Klee +1
    • Garvin Hicking +1
    • core-ci +1 CI

Issues 1

Files 63

Show 43 more files

Review log 2534

Show 69 earlier messages
  1. Benni Mack uploaded patch set 1 02/19/26, 14:33

  2. core-ci voted on patch set 1 V -1 02/19/26, 14:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96254

  3. Oliver Klee commented on patch set 1 02/19/26, 18:04

    StreamTest.php:107

    I propose we annotate why we're ignoring the PHPStan error. For example like this: ```suggestion /** @phpstan-ignore-next-line We're explicitly testing for a contract violation here. */ ```
  4. Garvin Hicking uploaded patch set 2 V -1 02/20/26, 14:23

  5. Garvin Hicking commented on patch set 2 02/20/26, 14:23

    MvcPropertyMappingConfigurationService.php:79

    This removal here needs an adaptation in: `dataProviderForGenerateTrustedPropertiesTokenWithUnallowedValues` of `typo3/sysext/extbase/Tests/Unit/Mvc/Controller/MvcPropertyMappingConfigurationServiceTest.php`
  6. core-ci voted on patch set 2 V -1 02/20/26, 14:35 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96360

  7. Benni Mack uploaded patch set 3 V -1 02/25/26, 13:39

  8. core-ci voted on patch set 3 V -1 02/25/26, 13:50 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96823

  9. Benni Mack uploaded patch set 4 V -1 02/25/26, 15:46

  1. core-ci voted on patch set 4 V -1 02/25/26, 16:00 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96837

  2. Benni Mack rebased onto patch set 5 V -1 02/25/26, 21:45

  3. core-ci voted on patch set 5 V -1 02/25/26, 21:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96858

  4. Benni Mack uploaded patch set 6 V -1 02/26/26, 13:29

  5. core-ci voted on patch set 6 V -1 02/26/26, 13:42 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96919

  6. Benni Mack uploaded patch set 7 V -1 02/26/26, 14:23

  7. core-ci voted on patch set 7 V +1 02/26/26, 14:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96928

  8. Garvin Hicking commented on patch set 7 02/26/26, 17:07

    Nice work! I went through all of them and only a few comments.

    PageRouter.php:103

    How did this not cause breakage before -.-

    SelectItemCollection.php:92

    This one hurts a bit, and it would be fair to convert this into a proper type error but needs a BC 😞

    GeneralUtility.php:3111

    This will break usage of makeInstanceService on extensions like mksearch and rn_base, same topic as in https://review.typo3.org/c/Packages/TYPO3.CMS/+/92963 we tried to solve.

    MvcPropertyMappingConfigurationService.php:79 Reply

    Done

    LazyLoadingProxy.php:82

    That parentObject is an DomainObjectInterface isn't really guaranteed in userland due to only being a typehint?! I think the phpdoc inference could cause real-world issues and might return null. I think we're too late in v14 cycle to do this for a vital method. We should do actual type declaration for this in v15 and have it fall under BC?

    Typo3DbQueryParser.php:488

    Why do (int) cast here, if we do a "> 0" comparison above that feels superflous? And is there really never a case where the PROPERTY_LOCALIZED_UID might be passed as a string or null? The AbstractDomainObject only uses "mixed" as native return type...? This one makes me feel afraid a bit :D
  9. Benni Mack uploaded patch set 8 V +1 02/27/26, 12:48

  10. Benni Mack commented on patch set 8 02/27/26, 12:48

    This change is ready for review.

    PageRouter.php:103 Reply

    PageArguments is a subtype / implementation of RouteResultInterface

    MvcPropertyMappingConfigurationService.php:79 Reply

    Done

    LazyLoadingProxy.php:82 Reply

    I don't think so, because otherwise "$this->parentObject->_getProperty()" below is also called. I think we could even fully-type this property.
  11. Benni Mack commented on patch set 8 02/27/26, 12:49

    SelectItemCollection.php:92 Reply

    Done

    StreamTest.php:107 Reply

    Done
  12. Benni Mack commented on patch set 8 02/27/26, 12:49

    GeneralUtility.php:3111 Reply

    Done
  13. core-ci voted on patch set 8 V +1 02/27/26, 12:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96971

  14. Oliver Klee voted on patch set 8 V +1 02/27/26, 12:59

  15. Oliver Klee commented on patch set 8 02/27/26, 13:14

    Neat! I've commented some smaller things.

    EnvVariableProcessor.php:33

    According to https://www.php.net/manual/en/function.getenv.php, `getenv` returns `string|array|false`. So we could use this: `@return string|array|false`

    SimpleParser.php:35

    We can drop this type annotation now.

    LazyLoadingProxy.php:82

    Should we convert the `$this->dataMapper` check to an `instanceof` check?
  16. Benni Mack commented on patch set 8 02/27/26, 14:42

    EnvVariableProcessor.php:33 Reply

    why? we check for "false" and the rest is handled via PHPstan directly?
  17. Benni Mack commented on patch set 8 02/27/26, 14:44

    LazyLoadingProxy.php:82 Reply

    we have a PHPStan rule to avoid "instanceof" checks when such a case exists.
  18. Oliver Klee commented on patch set 8 02/27/26, 15:10

    EnvVariableProcessor.php:33 Reply

    Currently, we don't have any direct return type information (neither via native type declaration nor via PHPDoc type annotation). Are you suggesting to not have any of those for this method? (I honestly am not sure that I understand your question correctly.)

    LazyLoadingProxy.php:82 Reply

    Or `!== null` - my main point was avoiding using `class|null` as a boolean.
  19. Garvin Hicking uploaded patch set 9 V +1 02/27/26, 15:24

  20. Garvin Hicking commented on patch set 8 CR +1 V +1 02/27/26, 15:25

    EnvVariableProcessor.php:33 Reply

    Since we always pass `$value` as a non-nullable string, we can never return an array, actually.

    SimpleParser.php:35 Reply

    Done

    LazyLoadingProxy.php:82 Reply

    Oh yeah. I see focussed so hard on the if structure that I did not see the lower call to `_getProperty`. So this should really be good - but I'd opt not for strongly typing this just to not accidentally break it.

    LazyLoadingProxy.php:82 Reply

    Done

    Typo3DbQueryParser.php:488 Reply

    I'm resolving this; it's more a "gut" feeling but nothing I can back up here now. We'll fix it in post. ;)
  21. Garvin Hicking voted on patch set 9 CR +1 V +1 02/27/26, 15:25

  22. Oliver Klee voted on patch set 9 CR +1 V +1 02/27/26, 15:27

  23. core-ci voted on patch set 9 V +1 02/27/26, 15:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96976

  24. Benni Mack commented on patch set 9 CR +2 V +2 02/27/26, 15:38

    thank you 🙏
  25. Benni Mack merged patch set 10 02/27/26, 15:38