Review main Merged

75263[TASK] Address type issues in FileSearchQuery

crell CR +2 V +2 Easy +4 −15 updated 07/30/22, 18:19

Commit message

The $result property's doc type is causing issues
for PHPStan. Switching it to a typed property and
state resolves them.

Other types have been filled in as well as they're
private so safe.

Used command:

> ./Build/Scripts/runTests.sh -s phpstanGenerateBaseline

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Oliver Klee +1
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 1822

  1. crell uploaded patch set 1 07/22/22, 18:11

  2. core-ci voted on patch set 1 V +1 07/22/22, 18:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29432

  3. Guido Schmechel voted on patch set 1 CR +1 07/23/22, 13:22

  4. Nikita Hovratov voted on patch set 1 V +1 CR +1 07/23/22, 15:07

  5. Stefan Bürk updated the commit message in patch set 2 07/25/22, 20:31

  6. Stefan Bürk commented on patch set 2 07/25/22, 20:35

    I would say, this is main only and should be handled as breaking. This class is not internal, even if not explictly entitled ad Public API. However, some may extending from this class for custom addtions, which would be breaking for the typed properties than (eventually). Would you agree on that ?
  7. core-ci voted on patch set 2 V +1 07/25/22, 20:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29514

  8. Oliver Klee commented on patch set 2 07/25/22, 21:33

    FileSearchQuery.php:181

    I would really prefer to initialize all properties in the constructor or via default values. In the case of $this->result, this would mean to make the property nullable, and keep the null checks instead of converting them to isset checks.
  9. crell uploaded patch set 3 07/25/22, 22:21

  10. crell commented on patch set 2 07/25/22, 22:21

    Reply

    The properties in this class are all private, so extending classes couldn't access them anyway. Even redefining the property in a child class only affects the child class, and in that case PHP does allow for the child class to add a type. We can mark it breaking if you want, but I don't see any way that it could break.

    FileSearchQuery.php:181 Reply

    Done
  11. core-ci voted on patch set 3 V -1 07/25/22, 23:12 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29525

  12. Oliver Klee commented on patch set 3 CR -1 07/26/22, 09:30

    FileSearchQuery.php:206

    This needs to be "!== null" or (preferably, as it's more explicit) "instanceof Result"
  13. crell uploaded patch set 4 07/26/22, 14:52

  14. crell commented on patch set 3 07/26/22, 14:54

    FileSearchQuery.php:206 Reply

    Done
  15. core-ci voted on patch set 4 V +1 07/26/22, 15:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29547

  16. Oliver Klee voted on patch set 4 CR +1 07/26/22, 15:11

  17. Benni Mack commented on patch set 4 07/27/22, 07:54

    Reply

    as the properties are private, I don't think that's a problem in terms of Extendability. Don't know if I would backport this though.
  18. crell commented on patch set 4 07/27/22, 14:32

    Reply

    I have no strong preference. I also don't see a real benefit to backporting, but also no real harm in this case. I'm good with whatever.
  19. Simon Schaufelberger commented on patch set 4 V +1 CR +1 07/29/22, 01:08

    +1 for backporting to keep code in sync
  20. crell commented on patch set 4 07/29/22, 15:55

    Reply

    Done
  21. Stefan Bürk voted on patch set 4 V +2 CR +2 07/30/22, 18:12

  22. Stefan Bürk merged patch set 5 07/30/22, 18:19