Review main Merged

63810[TASK] Set phpstan parameter checkPhpDocMissingReturn to true

Alexander Schnitzler CR +2 V +2 Normal +61 −15 updated 03/27/20, 15:36

Commit message

Review

  • Code review CR +2 Done
    • Daniel Goerz +2
    • Oliver Klee +1
    • Frank Nägler +1
  • Verified V +2 Done
    • Daniel Goerz +2
    • Frank Nägler +1
    • TYPO3com +1 CI

Issues 1

Files 19

Review log 2839

Show 814 earlier messages
  1. Alexander Schnitzler uploaded patch set 1 03/20/20, 11:22

  2. Alexander Schnitzler wrote 03/20/20, 11:23

    Topic set to phpstan
  3. TYPO3com voted on patch set 1 V -1 03/20/20, 12:01 Completed build in 32m 39s on Fri, 20 Mar, 12:01 PM Test Summary: 24 of 72604 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1493

  4. Alexander Schnitzler uploaded patch set 2 03/20/20, 12:59

  5. TYPO3com voted on patch set 2 V -1 03/20/20, 13:23 Completed build in 19m 28s on Fri, 20 Mar, 01:23 PM Test Summary: 3 of 71671 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1500

  6. TYPO3com commented on patch set 2 03/20/20, 13:38 Completed build in 53m 55s on Fri, 20 Mar, 01:38 PM Test Summary: 3 of 71671 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1500

  7. TYPO3com commented on patch set 2 03/20/20, 13:44 Completed build in 1h 34m 47s on Fri, 20 Mar, 01:44 PM Test Summary: 3 of 71671 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1500

  8. TYPO3com commented on patch set 2 03/20/20, 14:12 Completed build in 14m 00s on Fri, 20 Mar, 02:12 PM Test Summary: 3 of 71671 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1504

  9. Alexander Schnitzler uploaded patch set 3 03/20/20, 14:14

  10. TYPO3com voted on patch set 3 V +1 03/20/20, 14:25 Completed build in 11m 08s on Fri, 20 Mar, 02:25 PM Test Summary: 72120 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1505

  11. Alexander Schnitzler commented on patch set 3 03/20/20, 18:28

    This change is ready for review.
  12. Alexander Schnitzler commented on patch set 3 03/20/20, 18:29

    Unresolved

    Yes, I know, the issue number is missing. Will be added later. For now I'd like to get actual feedback on the code changes.
  13. Oliver Klee commented on patch set 3 03/20/20, 18:54

    SoftReferenceIndex.php:104

    Why this change?

    SoftReferenceParserHook.php:42

    Why this change?

    CrawlerHook.php:586 Unresolved

    Why this change?

    ReportController.php:180

    To me, the @return annotation seems to be incorrect instead, and it should be void.
  14. Alexander Schnitzler commented on patch set 3 03/21/20, 10:17

    SoftReferenceIndex.php:104 Reply

    This change has been made to make it possible to use a proper return type hint in the future (: ?array) and to be able to have a better check on the receiving side than just if (empty($array['elements'])).

    SoftReferenceParserHook.php:42 Reply Unresolved

    Same reason like for the parent method.

    ReportController.php:180 Reply

    Ack
  1. Alexander Schnitzler uploaded patch set 4 03/21/20, 10:18

  2. Alexander Schnitzler uploaded patch set 5 03/21/20, 10:20

  3. Oliver Klee commented on patch set 5 03/21/20, 10:49

    SoftReferenceIndex.php:104 Reply

    I'd prefer to have the proper annotations and return values first here (without a change in the actual or expected behavior), and move changes of type to separate change sets. This will allow us to separate "cleanup and strictness" from (potentially breaking) type changes. Would that be okay with you?
  4. TYPO3com voted on patch set 4 V +1 03/21/20, 10:50 Completed build in 25m 02s on Sat, 21 Mar, 10:50 AM Test Summary: 72225 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1535

  5. TYPO3com voted on patch set 5 V +1 03/21/20, 10:52 Completed build in 27m 57s on Sat, 21 Mar, 10:52 AM Test Summary: 72225 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1536

  6. Alexander Schnitzler commented on patch set 5 03/21/20, 13:10

    SoftReferenceIndex.php:104 Reply Unresolved

    I am fine with that and I expected feedback like yours. I will adjust the patch and we will adjust the actual types in 11.0.
  7. Alexander Schnitzler uploaded patch set 6 03/21/20, 13:25

  8. Alexander Schnitzler commented on patch set 6 03/21/20, 13:26

    SoftReferenceIndex.php:165

    What do you think about this now? If being totally strict, we should either annotate void and leave the code as is or return null, right?
  9. TYPO3com voted on patch set 6 V -1 03/21/20, 13:36 Completed build in 10m 57s on Sat, 21 Mar, 01:36 PM Test Summary: 12 of 72715 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1540

  10. Oliver Klee commented on patch set 6 03/21/20, 13:45

    SoftReferenceIndex.php:165 Reply Unresolved

    Yes, this then should be array|null (and then keep the added return null).
  11. Oliver Klee commented on patch set 6 03/21/20, 13:48

    Generally, for methods that (at least sometimes) return something, I'd prefer @return someType|null over @return someType|void so there always is a return value: Usually, when a method is called, the caller does not differentiate between "there is a return value" and "there is no return value". And technically (to PHP, not to PhpStan or a human reader), returning null and void is the same thing.
  12. Alexander Schnitzler commented on patch set 6 03/21/20, 14:03

    > Patch Set 6: > > Generally, for methods that (at least sometimes) return something, I'd prefer @return someType|null over @return someType|void so there always is a return value: Usually, when a method is called, the caller does not differentiate between "there is a return value" and "there is no return value". And technically (to PHP, not to PhpStan or a human reader), returning null and void is the same thing. Alright, we are on the same side then. I'll leave the patch is now.
  13. Alexander Schnitzler uploaded patch set 7 03/21/20, 16:53

  14. TYPO3com voted on patch set 7 V +1 03/21/20, 17:04 Completed build in 10m 50s on Sat, 21 Mar, 05:04 PM Test Summary: 72231 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1548

  15. Oliver Klee commented on patch set 7 03/21/20, 17:25

    SoftReferenceIndex.php:104

    I think this can stay as is. Or am I missing something?

    GeneralUtility.php:3225

    I'd prefer null here instead of void so always something gets returned.

    SoftReferenceParserHook.php:42

    I'd prefer this to stay unchanged.
  16. Alexander Schnitzler commented on patch set 7 03/22/20, 07:44

    SoftReferenceIndex.php:104 Reply

    That's what I asked you about in private. We have tests for this method, checking for null as return type.

    GeneralUtility.php:3225 Reply

    Hmm, in a controller action some patch sets before you had the opposite argument. I personally prefer void over null though.

    SoftReferenceParserHook.php:42 Reply

    Soo comment in parent class please.
  17. Oliver Klee commented on patch set 7 03/22/20, 12:27

    SoftReferenceIndex.php:104 Reply Unresolved

    Oh, so (with the old behavior) we have three possible return types: - array - bool (false) (which currently is not covered by tests AFAICS) - void (or null) I fail to see how with the old code null can be returned. Do you have an idea?

    GeneralUtility.php:3225 Reply

    I can see where I contradicted myself. ;-) I'll try to make this more explicit: 1. By convention, Extbase controller actions either return a response, a string, or void. We should keep this and not change the void to null. 2. In general, I think that a mixture of "only sometime return a value, and sometimes return void" is a bad thing. So we should change the void to null in cases where something is returned. 3. The Extbase convention mentioned above has a higher priority than my code cleanliness efforts listed in 2. Does this make sense, and would it okay with you to use this as a rule of thumb for this changeset?

    SoftReferenceParserHook.php:42 Reply Unresolved

    I'm confused: AFAICS, findRef in both SoftReferenceParserHook as well as SoftReferenceIndex return array|bool. What am I missing here? What part of the comment in the parent class are you referring to?
  18. Alexander Schnitzler commented on patch set 7 03/22/20, 12:46

    GeneralUtility.php:3225 Reply

    I am ok with this rule until I force people to return a ResponseInterface in actions. ;)
  19. Alexander Schnitzler uploaded patch set 8 03/22/20, 13:27

  20. TYPO3com voted on patch set 8 V +1 03/22/20, 13:43 Completed build in 13m 56s on Sun, 22 Mar, 01:43 PM Test Summary: 72231 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1578

  21. Oliver Klee commented on patch set 8 CR +1 03/22/20, 13:47

    Neat!
  22. Alexander Schnitzler commented on patch set 8 03/26/20, 12:23

    ping
  23. Frank Nägler voted on patch set 8 V +1 CR +1 03/27/20, 11:30

  24. Daniel Goerz voted on patch set 8 V +2 CR +2 03/27/20, 15:36

  25. Daniel Goerz merged patch set 9 03/27/20, 15:36