Review main Merged

89444[BUGFIX] Support access to specific property validators

Elias Häußler CR +2 V +2 Easy +46 −1 updated 05/20/25, 15:07

Commit message

When accessing validators of a concrete object property within
AbstractGenericObjectValidator, an instance of \SplObjectStorage
is returned. This type is now added as return type to the
appropriate method, since it was left out by now.

Review

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

Issues 1

Files 2

Review log 1621

  1. Elias Häußler uploaded patch set 1 05/19/25, 10:56

  2. Elias Häußler uploaded patch set 2 05/19/25, 10:57

  3. core-ci voted on patch set 1 V +1 05/19/25, 11:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79158

  4. core-ci voted on patch set 2 V +1 05/19/25, 11:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79159

  5. Oliver Klee voted on patch set 2 CR +1 V +1 05/19/25, 11:51

  6. Stefan Bürk commented on patch set 2 05/19/25, 18:42

    AbstractGenericObjectValidator.php:159

    ```suggestion * @return ($propertyName is null ? array<string, \SplObjectStorage<ValidatorInterface>> : \SplObjectStorage<ValidatorInterface>) ``` Is `@return` not enough here ? Usually we do not use specific phpstan type annotations.

    GenericObjectValidatorTest.php:237

    ```suggestion $validatorForFoo = $this->createStub(ValidatorInterface::class); $validatorForBar = $this->createStub(ValidatorInterface::class); ``` Full blown mocks not required here, no expecations added nor any overrides and operating on interface. Let's use slimmer stubs here.

    GenericObjectValidatorTest.php:261

    ```suggestion $validatorForFoo = $this->createStub(ValidatorInterface::class); $validatorForBar = $this->createStub(ValidatorInterface::class); ``` Full blown mocks not required here, no expecations added nor any overrides and operating on interface. Let's use slimmer stubs here.
  7. Elias Häußler commented on patch set 2 05/19/25, 19:45

    AbstractGenericObjectValidator.php:159 Reply

    AFAIK, using `@return` won't enable us to use conditional return types. We could, however, combine both like so: ``` @return array<string, \SplObjectStorage<ValidatorInterface>>|\SplObjectStorage<ValidatorInterface> @phpstan-return ($propertyName is null ? array<string, \SplObjectStorage<ValidatorInterface>> : \SplObjectStorage<ValidatorInterface>) ``` But I'm not sure if this may confuse PHPStan.
  8. Elias Häußler uploaded patch set 3 CR +1 V +1 05/19/25, 19:49

  9. Elias Häußler commented on patch set 3 05/19/25, 19:49

    GenericObjectValidatorTest.php:237 Reply

    Done

    GenericObjectValidatorTest.php:261 Reply

    Done
  10. core-ci voted on patch set 3 V -1 05/19/25, 19:55 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79176

  11. Elias Häußler uploaded patch set 4 V -1 05/19/25, 19:56

  12. core-ci voted on patch set 4 V +1 05/19/25, 20:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79177

  13. Oliver Klee commented on patch set 4 05/19/25, 20:05

    AbstractGenericObjectValidator.php:159 Reply

    Yes, we can use the normal `@return` here as far as PHPStan is concerned: https://phpstan.org/writing-php-code/phpdoc-types#conditional-return-types
  14. Elias Häußler uploaded patch set 5 V +1 05/19/25, 20:12

  15. Elias Häußler commented on patch set 4 05/19/25, 20:12

    AbstractGenericObjectValidator.php:159 Reply

    Done
  16. core-ci voted on patch set 5 V +1 05/19/25, 20:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79178

  17. Oliver Klee voted on patch set 5 CR +1 V +1 05/19/25, 20:18

  18. Jochen Roth voted on patch set 5 CR +1 V +1 05/19/25, 20:52

  19. Oliver Hader voted on patch set 5 CR +1 V +1 05/20/25, 06:19

  20. Christian Kuhn voted on patch set 5 CR +2 V +2 05/20/25, 15:07

  21. Christian Kuhn merged patch set 6 05/20/25, 15:07