Review main Merged

81632[BUGFIX] Update `phpstan/phpstan` to 1.10.40

Andreas Kienast CR +2 V +2 Easy +13 −18 updated 10/31/23, 09:02

Commit message

This commit updates `phpstan/phpstan` to the latest version and fixes
one quirk in our code in order to make our nightly test runs happy
again.

Executed command:

    composer require --dev phpstan/phpstan:^1.10.40 -W

Review

  • Code review CR +2 Done
    • Andreas Kienast +2
    • Benjamin Franzke +1
    • Oliver Hader +1
  • Verified V +2 Done
    • Andreas Kienast +2
    • Benjamin Franzke +1
    • Oliver Hader +1
    • core-ci +1 CI

Issues 1

Files 3

Review log 1620

  1. Andreas Kienast uploaded patch set 1 10/31/23, 07:08

  2. core-ci voted on patch set 1 V +1 10/31/23, 07:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48380

  3. Andreas Kienast updated the commit message in patch set 2 V +1 10/31/23, 07:23

  4. Benjamin Franzke voted on patch set 2 V +1 CR +1 10/31/23, 07:29

  5. core-ci voted on patch set 2 V +1 10/31/23, 07:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48381

  6. Oliver Hader commented on patch set 2 CR -1 10/31/23, 07:34

    I'd like to check something here...
  7. Oliver Hader commented on patch set 2 10/31/23, 07:42

    What would happen, if you'd introduce a new `NavigationDirection::OTHER` and use that for the mentioned protected method?
  8. Andreas Kienast commented on patch set 2 CR -1 10/31/23, 07:48

    Reply

    I would've expected that phpstan goes poof, which is apparently not the case. Great success. Not.
  9. Andreas Kienast uploaded patch set 3 CR +1 V +1 10/31/23, 07:54

  10. Oliver Hader commented on patch set 3 10/31/23, 07:57

    Reply

    I just want to repeat myself in general: "Don't blindly trust any static code analysis tool" 😊 A potential solution here (and for other cases) would be introduce a `default` case. Anyway, I think this one is a bug in PhpStan since it is giving advise without having evidence - and this is "great" for introducing new bugs without actually realizing it...
  11. Andreas Kienast commented on patch set 3 CR -2 10/31/23, 08:01

    Reply

    I think this isn't really a bug. IconFactory->getIcon() doesn't declare the type of it's `$identifier` parameter, technically allowing `null`. In that case, the IconFactory will fall back to the default "broken" icon. Let's have a talk about this how to continue.
  12. core-ci voted on patch set 3 V +1 10/31/23, 08:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48384

  13. Benjamin Franzke uploaded patch set 4 V +1 10/31/23, 08:24

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR is:MIN")
  14. Benjamin Franzke commented on patch set 4 V +1 CR +1 10/31/23, 08:24

    Reply

    Thanks for bringing that up, I was really sure phpstan would perform an exhaustiveness check for all enum-cases when used in `switch`, but it turns out it does only do that for `match`, see https://github.com/phpstan/phpstan/issues/7521#issuecomment-1164581820 Let's switch to `match`, then a new enum value will result in: ``` 553 Match expression does not handle remaining value: TYPO3\CMS\Filelist\Type\NavigationDirection::FOO ```
  15. Andreas Kienast voted on patch set 4 CR 0 10/31/23, 08:29

  16. core-ci voted on patch set 4 V +1 10/31/23, 08:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48386

  17. Andreas Kienast commented on patch set 4 CR -1 10/31/23, 08:32

    Let's wait for Olly's vote.
  18. Oliver Hader commented on patch set 4 V +1 CR +1 10/31/23, 08:57

    FileList.php:555 Unresolved

    in case `default => null` would be added here, PhpStan would still not find it → which is a bug in PhpStan (and not a problem for us right now)
  19. Andreas Kienast voted on patch set 4 V +2 CR +2 10/31/23, 09:02

  20. Andreas Kienast merged patch set 5 10/31/23, 09:02