Review main Merged

85013[TASK] Avoid implicitly nullable class method parameter in `EXT:dashboard`

Stefan Bürk CR +2 V +2 Easy +6 −6 updated 06/30/24, 15:31

Commit message

With PHP 8.4 marking method parameter implicitly nullable
is deprecated and will emit a `E_DEPRECATED` warning. One
recommended way to resolve this, is making it explicitly
nullable using the `?` nullable operator or adding a null
type to an union type definition. [1]

This prepares the way towards PHP 8.4 compatibility.

[1] https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated

Review

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

Issues 1

Files 1

Review log 1822

  1. Stefan Bürk uploaded patch set 1 06/29/24, 20:39

  2. core-ci voted on patch set 1 V +1 06/29/24, 20:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60634

  3. Oliver Klee voted on patch set 1 CR +1 V +1 06/29/24, 20:59

  4. Mogens Fiebrandt commented on patch set 1 CR -1 06/30/24, 09:29

    ServiceProvider.php:152

    I think the nullable operator also should be added here
  5. Stefan Bürk commented on patch set 1 06/30/24, 10:28

    ServiceProvider.php:152 Reply

    @mogens.fiebrandt@googlemail.com what do you mean ? This change makes the nullable argument explicitly nullable instead of implicitly nullable keeping the null as default. The code in the method already uses `??` null coalsce fallback to retrieve a instance if not provided. Nothing more to do. ``` $dashboardPresetRegistry = $dashboardPresetRegistry ?? self::new($container, DashboardPresetRegistry::class); ``` This change is absolutly narrowed down to make implicitly nullable arguments explicitly nullable due to upcoming PHP8.4 deprecation which would fail our tests as we consider PHP deprecation breaking. Even if your comment would have been legit, it would be a) out of scope of these patches and would require a pre-patch and b) would have been failing already, which is not the case (here). So I do not see a legit reason for the `-1` with your statement here. But if I oversee something, let me know it !
  6. Stefan Bürk commented on patch set 1 06/30/24, 11:11

    ServiceProvider.php:152 Reply

    I jumped to the wrong code, so the above statement is not legit and meant for another method. The $path argument is not used within the configuraeWidgetGroups method - so it may be scheduable for removal. Howevere, for this change there is nothing to do beside adding the `operator for $path. The first two arguments are not nullable, neither implicitly nor explicitly so nothing to do. So still, I'd say nothing further to do here except remothing the third optional argument in a dedicated patch (and main only than) if ensured not beeing breaking. No need to add any guard here, and your -1 could be removed. Do you agree ?
  7. Oliver Klee commented on patch set 1 06/30/24, 11:19

    ServiceProvider.php:152 Reply

    Wild guess: Possibly @mogens.fiebrandt@googlemail.com was referring to the PHPDoc type annotation to also be changed from `string` to `string|null` (or to be removed).
  8. Stefan Bürk commented on patch set 1 06/30/24, 12:08

    ServiceProvider.php:152 Reply

    Just got that from another review. Will update the docblock. Anyway, thanks for stepping in @typo3-coding@oliverklee.de
  9. Stefan Bürk uploaded patch set 2 CR +1 V +1 06/30/24, 12:28

  10. Stefan Bürk commented on patch set 2 06/30/24, 12:29

    ServiceProvider.php:152 Reply

    Added `|null` to phpdocblock. Done.
  11. core-ci voted on patch set 2 V +1 06/30/24, 12:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60674

  12. Oliver Klee commented on patch set 2 V +1 06/30/24, 12:45

    ServiceProvider.php:171

    This then also should be `string|null`.
  13. Christian Kuhn commented on patch set 3 V +1 06/30/24, 13:04

    Published edit on patch set 2.
  14. Christian Kuhn commented on patch set 4 06/30/24, 13:05

    Published edit on patch set 3.
  15. Christian Kuhn commented on patch set 4 06/30/24, 13:05

    ServiceProvider.php:171 Reply

    Done
  16. Christian Kuhn voted on patch set 4 CR +1 V +1 06/30/24, 13:06

  17. core-ci voted on patch set 3 V +1 06/30/24, 13:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60682

  18. core-ci voted on patch set 4 V +1 06/30/24, 13:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60683

  19. Oliver Klee voted on patch set 4 CR +1 V +1 06/30/24, 15:16

  20. Mogens Fiebrandt voted on patch set 4 CR +1 V +1 06/30/24, 15:28

  21. Stefan Bürk voted on patch set 4 CR +2 V +2 06/30/24, 15:31

  22. Stefan Bürk merged patch set 5 06/30/24, 15:31