Review main Merged

63569[TASK] Fix php doc comments reported by phpstan level 2

Alexander Schnitzler CR +2 V +2 Normal +124 −118 updated 03/08/20, 19:37

Commit message

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oliver Klee +1
    • Andreas Kienast +1
  • Verified V +2 Done
    • Benni Mack +2
    • Andreas Kienast +1
    • TYPO3com +1 CI

Issues 1

Files 79

Show 59 more files

Review log 2126

Show 1 earlier messages
  1. Alexander Schnitzler uploaded patch set 1 03/06/20, 19:57

  1. Alexander Schnitzler wrote 03/06/20, 19:57

    Topic set to phpstan
  2. TYPO3com voted on patch set 1 V -1 03/06/20, 20:08 Completed build in 10m 56s on Fri, 6 Mar, 08:08 PM Test Summary: 71565 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1053

  3. TYPO3com voted on patch set 1 V +1 03/06/20, 20:16 Completed build in 30m 27s on Fri, 6 Mar, 08:16 PM Test Summary: 72072 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1053

  4. Benni Mack commented on patch set 1 03/06/20, 20:45

    AuthenticationService.php:355

    the additional space before "@param" - is that correct?

    CropVariant.php:185

    same here.

    CropVariant.php:209

    same here.

    CropVariantCollection.php:157

    same here.

    MailMessage.php:243

    same here.

    GeneralUtility.php:3416

    same here.

    GeneralUtility.php:3477

    same here.

    Container.php:133

    same here.

    Container.php:181

    same here.

    ObjectManager.php:106

    same here.

    InstallUtility.php:156

    same here.
  5. Alexander Schnitzler commented on patch set 1 CR -1 03/06/20, 22:41

    AuthenticationService.php:355 Reply

    Ah, shit. regex gone wrong.
  6. Alexander Schnitzler uploaded patch set 2 03/07/20, 07:37

  7. Alexander Schnitzler commented on patch set 2 03/07/20, 07:38

    AuthenticationService.php:355 Reply

    Ack

    CropVariant.php:185 Reply

    Ack

    CropVariant.php:209 Reply

    Ack

    CropVariantCollection.php:157 Reply

    Ack

    MailMessage.php:243 Reply

    Ack

    GeneralUtility.php:3416 Reply

    Ack

    GeneralUtility.php:3477 Reply

    Ack

    Container.php:133 Reply

    Ack

    Container.php:181 Reply

    Ack

    ObjectManager.php:106 Reply

    Ack

    InstallUtility.php:156 Reply

    Ack
  8. TYPO3com voted on patch set 2 V -1 03/07/20, 07:50 Completed build in 12m 35s on Sat, 7 Mar, 07:50 AM Test Summary: 72093 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1068

  9. Alexander Schnitzler rebased onto patch set 3 03/07/20, 07:58

  10. Alexander Schnitzler uploaded patch set 4 03/07/20, 07:59

  11. TYPO3com voted on patch set 3 V -1 03/07/20, 08:09 Completed build in 10m 43s on Sat, 7 Mar, 08:09 AM Test Summary: 72093 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1069

  12. TYPO3com voted on patch set 4 V +1 03/07/20, 08:12 Completed build in 13m 07s on Sat, 7 Mar, 08:12 AM Test Summary: 72093 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1070

  13. Claus Due commented on patch set 4 03/07/20, 08:58

    WorkspacePreview.php:360

    Maybe we should instead consider deleting these redundant phpdocs? * All arguments and return types are strict * The method name is clear * The method description adds nothing to the method name and return types As a rule of thumb, I think our new pragma is to only add phpdoc if there are additional specifics to note about a function. For example, if it is capable of returning different or nullable values, it sometimes helps to explain which input arguments or context parameters would cause one or the other return types (such as: "if $arg1 and $arg2 are both null then null is returned" - which adds information that the argument- and return types alone cannot convey). Less phpdoc to maintain, fewer "functionless" lines of code - and same green result when running phpstan or other analysis tools.
  14. Alexander Schnitzler commented on patch set 4 03/07/20, 16:10

    WorkspacePreview.php:360 Reply

    Im fine with that.
  15. Andreas Kienast commented on patch set 4 03/08/20, 06:38

    AuthenticationService.php:355

    To my understanding this represents an array as follows: [ [0, 4711], [1, $this], [2, 'and so on'] ] Shouldn't this be "array<mixed>" only?
  16. Claus Due commented on patch set 4 03/08/20, 10:12

    Quick question: have we moved away from notations like `mixed[]` in favor of `array<mixed>`? I'm personally a huge fan of the former (which also allows multidim arrays to be annotated) and strongly dislike the latter (which afaik doesn't). @Andy no, that's not the case. If `array<int,mixed>` represents a multidim array then `array<mixed>` would also represent a multidim array. I have no clue how the `<>` syntax can be used to identify a multidim array but in the `[]` notation you would have `mixed[][]`.
  17. Alexander Schnitzler commented on patch set 4 03/08/20, 10:20

    AuthenticationService.php:355 Reply

    I agree on the definition. That's why I understand as well. Regarding the question: phpstan thinks otherwise because array<mixed> only defines that you have a list of mixed values with an undefined key type, hence being some kind of dictionary. array<int,mixed> states, that we actually deal with integer keys which the splat operator provides. See https://3v4l.org/UcKo2
  18. Alexander Schnitzler commented on patch set 4 03/08/20, 10:21

    WorkspacePreview.php:360 Reply

    Hi Claus, I talked to Benni and we agreed on removing useless php doc blocks rather automatically with a rector. It's easier to do it in one go and be able to do it repetitively.
  19. Claus Due commented on patch set 4 03/08/20, 10:26

    AuthenticationService.php:355 Reply

    What does phpstan say about "mixed[]"? I'm not sure that indicating the type of key conveys meaningful information that the "splat" operator does not already provide (since you can't splat a non-numeric array). Depending on subclass compatibility requirements we might also want to add a type hint for "...$params" in addition to the splat.

    WorkspacePreview.php:360 Reply

    Sounds like a plan! Can you ping me when that rector rule is made? I'm very interested :) I'd use it myself on my own code but I'm honestly not aware how rector would determine that the phpdoc is redundant if it has a single line of text above the @param/@return (to rector, wouldn't that look like a non-redundant comment then?)
  20. Alexander Schnitzler commented on patch set 4 03/08/20, 11:02

    AuthenticationService.php:355 Reply Unresolved

    With array|mixed[], phpstan says: > PHPDoc tag @param for parameter $params with type array is not subtype of native type array<int, mixed> And with just mixed[] it says the same. I don't know if that can be considered a bug or a missing missing on the phpstan end but my opinion is, that adding the int to indicate the key type does not harm at all. tbh, my goal is not to be 100% sure about everything now. As long as I don't disagree with phpstan I want to push its integration forward to ave cleaner incoming patches. I am all in for more cleanup in the future but every phpstan check we have in active in bamboo right now is a good one imo.
  21. Alexander Schnitzler commented on patch set 4 03/08/20, 11:06

    WorkspacePreview.php:360 Reply Unresolved

    > Sounds like a plan! Can you ping me when that rector rule is made? I'm very interested :) Of course. > I'd use it myself on my own code but I'm honestly not aware how rector would determine that the phpdoc is redundant if it has a single line of text above the @param/@return (to rector, wouldn't that look like a non-redundant comment then?) the good thing is, that if we write a custom rector, we can determine that ourselves. Like: Remove all @param we have a type hint for and that don't have a parameter description. That's quite specific and therefore I think we need to write that rector ourselves.
  22. Oliver Klee commented on patch set 4 CR +1 03/08/20, 13:24

    <3
  23. Andreas Kienast voted on patch set 4 V +1 CR +1 03/08/20, 14:21

  24. Benni Mack voted on patch set 4 V +2 CR +2 03/08/20, 19:37

  25. Benni Mack merged patch set 5 03/08/20, 19:37