Review main Merged

73254[TASK] Avoid a 'Result of || is always true' phpstan error

Stefan Bürk CR +2 V +2 Easy +2 −14 updated 02/05/22, 11:32

Commit message

'ElementInformationController::getPropertiesForTable()'
checks two properties in an if condition with interface
checks. phpstan complains that the result of this 'or'
condition is always true because of a not proper set
docblock type hint of class property '$folderObject'.

This patch removes the docblock and use correct nullable
property typehint with direct null initialization to avoid
php fatal "read access before initialization" error. This
also removes one entry from phpstan baseline file.

Other baseline entries with same message are handled with
other patches - the solutions differ in each case.

> Build/Scripts/runTests.sh -s phpstanGenerateBaseline

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Oliver Klee +1
    • Susi Moog +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Susi Moog +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 1926

Show 1 earlier messages
  1. Stefan Bürk uploaded patch set 1 01/31/22, 23:19

  1. core-ci voted on patch set 1 V -1 01/31/22, 23:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22838

  2. Oliver Klee voted on patch set 1 CR +1 01/31/22, 23:31

  3. core-ci commented on patch set 1 01/31/22, 23:42 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22838

  4. Stefan Bürk uploaded patch set 2 02/01/22, 00:21

  5. core-ci voted on patch set 2 V +1 02/01/22, 00:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22844

  6. Christian Kuhn updated the commit message in patch set 3 02/01/22, 01:11

  7. Christian Kuhn voted on patch set 3 V +1 CR +1 02/01/22, 01:14

  8. core-ci voted on patch set 3 V +1 02/01/22, 01:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22849

  9. Benjamin Franzke commented on patch set 3 CR -1 02/01/22, 07:12

    ElementInformationController.php:106

    Why do add a proper type declaration to folderObject, but not to fileObject? Do we have type problems somehwere? (maybe because of File vs FileInterface and so on?)

    ElementInformationController.php:357

    can't we assign folderObject and fileObject to null by default? and avoid all of this null coalescing here?
  10. Stefan Bürk commented on patch set 3 02/01/22, 09:17

    will take care later.

    ElementInformationController.php:106 Reply

    I wanted to address the phptan issue only. But you are right, I will change this this also ... was a 50/50 do or not do thing. (Shakespear yeah).

    ElementInformationController.php:357 Reply

    Sure, we can. Had that at first shot, but remembered where adding = null to a property has been minues one in some patches in the past, used that. But would be the correct and cleaner way, I would say. So ack, will revert the ?? and use direct null assignment on the property.
  11. Stefan Bürk uploaded patch set 4 02/01/22, 09:29

  12. Stefan Bürk commented on patch set 4 02/01/22, 09:30

    ElementInformationController.php:106 Reply

    Done

    ElementInformationController.php:357 Reply

    Done
  13. Oliver Klee voted on patch set 4 CR +1 02/01/22, 09:32

  14. core-ci voted on patch set 4 V +1 02/01/22, 09:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22866

  15. Benjamin Franzke voted on patch set 4 CR +1 02/01/22, 09:48

  16. Christian Kuhn uploaded patch set 5 02/05/22, 08:55

  17. Christian Kuhn updated the commit message in patch set 6 02/05/22, 08:55

  18. Christian Kuhn updated the commit message in patch set 7 02/05/22, 08:56

  19. Christian Kuhn voted on patch set 7 V +1 CR +1 02/05/22, 08:56

  20. core-ci voted on patch set 5 V +1 02/05/22, 09:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23038

  21. core-ci voted on patch set 7 V +1 02/05/22, 09:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23040

  22. Oliver Klee voted on patch set 7 CR +1 02/05/22, 11:06

  23. Susi Moog voted on patch set 7 V +1 CR +1 02/05/22, 11:31

  24. Christian Kuhn voted on patch set 7 V +2 CR +2 02/05/22, 11:32

  25. Christian Kuhn merged patch set 8 02/05/22, 11:32