Review main Merged

80770[TASK] Add PHPStan type hints in PackageManager

Oliver Hader CR +2 V +2 Normal +52 −44 updated 08/31/23, 13:37

Commit message

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Oliver Klee +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Oliver Klee +1
    • core-ci +1 CI

Issues 1

Files 3

Review log 810

  1. Oliver Hader uploaded patch set 1 08/31/23, 10:23

  2. Andreas Kienast commented on patch set 1 08/31/23, 10:27

    PackageManager.php:624

  3. core-ci voted on patch set 1 V -1 08/31/23, 10:33 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46080

  4. Oliver Klee commented on patch set 1 08/31/23, 10:44

    PackageManager.php:47

    Those two probably can be `non-empty-string`.

    PackageManager.php:49

    Also `non-empty-string`?

    PackageManager.php:64

    Can any of these be `non-empty-string`?

    PackageManager.php:450

    At least PHPStan will reduce these two to `string` (as the other two types are subtypes of `string`). So having this would only make sense for the benefit of the reader, but not for the benefit of PHPStan. Ditto for all other places where we have `string|Package*`.

    ImportMapFactory.php:37

    Is this change (the added `array_values`) intended to be part of this change (which is about introducing more specific type annotations)? It rather looks like a change of behavior to me.

    DependencyOrderingService.php:94

    Both `mixed` should `array-key` (as they cannot be any other type than `string` or `int`).

    DependencyOrderingService.php:103

    We'll also need to update this type annotation to match the return type annotation.
  5. Oliver Hader uploaded patch set 2 V -1 08/31/23, 11:32

  6. Oliver Hader commented on patch set 2 08/31/23, 11:32

    PackageManager.php:47 Reply

    Done

    PackageManager.php:49 Reply

    Done

    PackageManager.php:64 Reply

    Done

    PackageManager.php:450 Reply

    PhpStorm was complaining. That's why I used it like that.

    PackageManager.php:624 Reply

    Yepp, I was missing it in the other patch... ;)

    ImportMapFactory.php:37 Reply

    Nope. `ImportMap` constructor is declared like the following: ``` @param list<PackageInterface> $packages ``` Internally in `ImportMap` the array keys are not used.

    DependencyOrderingService.php:94 Reply

    PHPStan failed when using `string|int` explicitly - seems to work with `array-key`.

    DependencyOrderingService.php:103 Reply

    There are other occurrence in that class which one could adjust later...
  7. core-ci voted on patch set 2 V +1 08/31/23, 11:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46089

  8. Oliver Klee voted on patch set 2 V +1 CR +1 08/31/23, 11:46

  9. Christian Kuhn voted on patch set 2 V +2 CR +2 08/31/23, 13:37

  10. Christian Kuhn merged patch set 3 08/31/23, 13:37