Review main Merged

73323[TASK] Streamline LinkBrowser controller

Nikita Hovratov CR +2 V +2 Hard +214 −381 updated 02/07/22, 22:00

Commit message

- Use native typehints instead of doctype
- Add return types
- Use strict types
- Use DI: abstract class uses inject* methods,
  inheriting classes use constructor DI
- Improve array annotations for phpstan level 6
  (not yet detected)
- Remove method comments with no added value
- Use str_starts_with
- Move abstract and public methods to the top

Some minor refactorings along the way:
Get "richtextConfiguration" directly from parameters
array in BrowseLinksController.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Stefan Bürk +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 1

Files 4

Review log 2027

Show 12 earlier messages
  1. Nikita Hovratov uploaded patch set 1 02/06/22, 20:41

  2. core-ci voted on patch set 1 V -1 02/06/22, 20:54 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23112

  1. Nikita Hovratov uploaded patch set 2 02/06/22, 21:21

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

  3. Stefan Bürk commented on patch set 2 02/06/22, 23:43

    BrowseLinksController.php:280

    What's the benefit of this notation ? Can we either omit it or leave the return string[] docblock (which would eleminate the manual picking of the parent to get what is stated yere). Or is this a must-do which I cannot see ?
  4. Nikita Hovratov commented on patch set 2 02/07/22, 08:24

    BrowseLinksController.php:280 Reply

    Primarily this is there to avoid duplicate comments/annotations, which phpstan also can understand. I'm not sure, if this works without it. Honestly, not 100% sure if this is the way to go so I bow to superiour opinions :)
  5. Stefan Bürk commented on patch set 2 02/07/22, 08:56

    BrowseLinksController.php:280 Reply

    Yeah, I'm not 100% sure either. Do not know if core-team/core-merge already discussed this and has a decision on that. Personally I would tend to either remove it or keep it and avoid @inheritDoc (as this is a wildy differently used and implemented old phpDocumenter flag). @inheritDoc is nearly useless for humans (at this place), and as far as I know (not sure) is that phpstan already takes the parent into account (which could be tested). Maybe we should wait here for someone who has a deeper knowlage/decision about this. However, thanks for your answer.
  6. Christian Kuhn commented on patch set 2 02/07/22, 09:23

    BrowseLinksController.php:280 Reply

    IIRC, Alex Schnitzler argued in a similar way a while ago: @inheritdoc is pretty much useless for humans, and analyzers should look at parent automatically. I tend to agree to that and would say we should simply remove the annotation here, and maybe even have a cleanup patch for those couple of places in the core where we use it. we could then even forbid the annotation in our annotation check script.
  7. Nikita Hovratov uploaded patch set 3 02/07/22, 10:11

  8. Nikita Hovratov commented on patch set 3 02/07/22, 10:14

    Removed now the inheritDoc annotations and copied them over from the abstract class. Also reordered now the methods: 1. abstract, 2. public, 3. protected.

    BrowseLinksController.php:280 Reply

    Done
  9. core-ci voted on patch set 3 V +1 02/07/22, 10:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23129

  10. Oliver Klee commented on patch set 3 02/07/22, 10:44

    BrowseLinksController.php:41

    Please let's keep this comment even if we drop the PHPDoc type annotation. It explains things that are not conveyed by the name only.
  11. Nikita Hovratov uploaded patch set 4 02/07/22, 11:04

  12. Nikita Hovratov commented on patch set 4 02/07/22, 11:04

    BrowseLinksController.php:41 Reply

    Done
  13. core-ci voted on patch set 4 V +1 02/07/22, 11:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23131

  14. Oliver Klee wrote 02/07/22, 13:18

    Removed cc Oliver Klee.
  15. Christian Kuhn commented on patch set 4 02/07/22, 13:53

    Services.yaml:20

    let's please avoid this for now and stick to the casual getLanguageService() methods for now: the globals-lang stuff needs a major overhaul anyways and i would prefer to not clutter this single solution in there right now. is that ok with you?
  16. Nikita Hovratov uploaded patch set 5 02/07/22, 15:20

  17. Nikita Hovratov commented on patch set 5 02/07/22, 15:23

    It's ok! Changed it back to how it was originally.

    Services.yaml:20 Reply

    Done
  18. core-ci voted on patch set 5 V +1 02/07/22, 15:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23149

  19. Christian Kuhn uploaded patch set 6 02/07/22, 21:32

  20. Christian Kuhn uploaded patch set 7 02/07/22, 21:36

  21. core-ci voted on patch set 6 V +1 02/07/22, 21:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23170

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

  23. Stefan Bürk voted on patch set 7 V +1 CR +1 02/07/22, 21:57

  24. Christian Kuhn voted on patch set 7 V +2 CR +2 02/07/22, 22:00

  25. Christian Kuhn merged patch set 8 02/07/22, 22:00