Review main Merged

65672[TASK] Fix phpstan checkFunctionArgumentTypes errors in ext:core Localization

Sascha Egerer CR +2 V +2 Easy +14 −5 updated 09/18/20, 12:41

Commit message

This patch fixes incompatible type usage in function arguments
and is preparatory work for introducing native type hints and
strict mode in all core files.

Review

  • Code review CR +2 Done
    • Daniel Goerz +2
    • Oli Bartsch +1
    • Oliver Klee +1
    • Sascha Egerer +1
  • Verified V +2 Done
    • Daniel Goerz +2
    • Oli Bartsch +1
    • Sascha Egerer +1
    • TYPO3com +1 CI

Issues 1

Files 3

Review log 2227

Show 2 earlier messages
  1. Sascha Egerer uploaded patch set 1 09/09/20, 17:16

  2. Sascha Egerer wrote 09/09/20, 17:26

    Topic set to phpstan
  1. Sascha Egerer updated the commit message in patch set 2 09/09/20, 17:26

  2. TYPO3com voted on patch set 1 V +1 09/09/20, 18:33 Completed build in 51m 00s on Wed, 9 Sep, 06:33 PM Test Summary: 73173 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5437

  3. Daniel Goerz updated the commit message in patch set 3 09/10/20, 08:50

  4. Oliver Klee voted on patch set 3 CR +1 09/10/20, 08:50

  5. TYPO3com voted on patch set 3 V +1 09/10/20, 18:15 Completed build in 1h 02m 53s on Thu, 10 Sep, 06:15 PM Test Summary: 73173 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5508

  6. Jörg Bösche voted on patch set 3 CR +1 09/11/20, 06:35

  7. Daniel Goerz uploaded patch set 4 09/18/20, 08:19

  8. Daniel Goerz voted on patch set 4 V +1 CR +1 09/18/20, 08:19

  9. Sascha Egerer commented on patch set 4 CR -1 09/18/20, 08:23

    LocalizationFactory.php:126

    Why should we call mergeRecursiveWithOverrule with an empty array?

    AbstractXmlParser.php:75

    If the result is not a string it is false which means we can exit early

    AbstractXmlParser.php:97

    This is an API change. Any reason why this is done?
  10. TYPO3com voted on patch set 4 V +1 09/18/20, 08:31 Completed build in 11m 35s on Fri, 18 Sep, 08:31 AM Test Summary: 73281 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5707

  11. Daniel Goerz commented on patch set 4 09/18/20, 08:40

    LocalizationFactory.php:126 Reply Unresolved

    Yes, we can skip this if $parsedData is not an array

    AbstractXmlParser.php:75 Reply Unresolved

    I guess throwing the InvalidXmlFileException would be correct then

    AbstractXmlParser.php:97 Reply

    To avoid casting the return value to strings. How is this API?
  12. Daniel Goerz uploaded patch set 5 09/18/20, 08:40

  13. Daniel Goerz uploaded patch set 6 09/18/20, 08:41

  14. Sascha Egerer commented on patch set 6 09/18/20, 08:45

    AbstractXmlParser.php:97 Reply

    Method did return null before but does now return an empty string instead. See line 136. I mean the method is not public so I'm fine with changing this but we should be careful with those changes.
  15. Daniel Goerz commented on patch set 6 09/18/20, 08:52

    AbstractXmlParser.php:97 Reply

    Yes, thats the point of the change. All places that called this method casted the return value to a string so returning null makes no sense. IMO these are desirable changes as they make the method promise to return one type so we can omit the casting. In theory you are right that the error case changed from null to empty string but that case was not evaluated anywhere and the method is not public API, so lets streamline it.
  16. TYPO3com voted on patch set 5 V -1 09/18/20, 08:52 Completed build in 11m 58s on Fri, 18 Sep, 08:52 AM Test Summary: 73281 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5708

  17. TYPO3com voted on patch set 6 V +1 09/18/20, 08:57 Completed build in 15m 17s on Fri, 18 Sep, 08:57 AM Test Summary: 73281 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5709

  18. Daniel Goerz voted on patch set 6 V +1 CR +1 09/18/20, 08:58

  19. Oliver Klee voted on patch set 6 CR +1 09/18/20, 09:50

  20. Oli Bartsch voted on patch set 6 V +1 CR +1 09/18/20, 10:50

  21. Sascha Egerer voted on patch set 6 V +1 CR +1 09/18/20, 10:55

  22. Alexander Schnitzler commented on patch set 6 09/18/20, 11:56

    AbstractXmlParser.php:97 Reply

    Reading the method description even returning an empty string is bad because we expect the absolute path to a file. If we are about to change behaviour then let's throw an exception here and let the callers act accordingly or let the exception bubble up the stack.
  23. Daniel Goerz commented on patch set 6 09/18/20, 12:30

    AbstractXmlParser.php:97 Reply Unresolved

    I agree that throwing an exception would be the best way to handle the error case. That brings us back to the question of how much do we want to change in these patches, because if we add an exception we also need to catch it and introduce proper error handling where this method is called. This gets out of hand very fast.
  24. Daniel Goerz voted on patch set 6 V +2 CR +2 09/18/20, 12:41

  25. Daniel Goerz merged patch set 7 09/18/20, 12:41