Review main Abandoned Breaking

89671[!!!][TASK] Properly initialize properties in AbstractCompositeValidator

Torben Hansen CR 0 V 0 Normal +49 −22 updated 06/17/25, 11:53

Commit message

The properties `validators` and `validatedInstancesContainer` are not
properly initialized in the `AbstractCompositeValidator` class.
Validators extending the class have to initialize the properties
manually as done in `DisjunctionValidator` and `ConjunctionValidator`.

This change initializes the properties correctly in the abstract
class and removes the now superfluous initialization in extending
validators.

Additionally, the `AbstractCompositeValidator` has been marked
as `@internal`, since it should not be extended by 3rd party
extensions.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 4

Review log 1621

  1. Torben Hansen uploaded patch set 1 06/08/25, 11:24

  2. core-ci voted on patch set 1 V -1 06/08/25, 11:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80063

  3. Torben Hansen uploaded patch set 2 V -1 06/08/25, 11:33

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

  5. Garvin Hicking updated the commit message in patch set 3 V +1 06/08/25, 16:24

  6. core-ci voted on patch set 3 V +1 06/08/25, 16:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80065

  7. Oliver Klee voted on patch set 3 CR +1 06/09/25, 08:27

  8. Stefan Bürk commented on patch set 3 06/10/25, 08:12

    AbstractCompositeValidator.php:45

    Why not using constructor promotion now ? Creating object instances in casual properties as assignment does not work, but as part of the constructor this works pretty fine: * https://3v4l.org/ug61i * https://3v4l.org/rR9vu
  9. Torben Hansen uploaded patch set 4 CR +1 V +1 06/11/25, 17:00

  10. Torben Hansen commented on patch set 4 06/11/25, 17:01

    AbstractCompositeValidator.php:45 Reply

    Thanks, good suggestion 👍
  11. core-ci voted on patch set 4 V +1 06/11/25, 17:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80215

  12. Oliver Klee voted on patch set 4 CR +1 06/11/25, 17:13

  13. Christian Kuhn commented on patch set 4 06/13/25, 14:26

    AbstractCompositeValidator.php:43

    mmmh. this violates the principle that abstracts shouldn't pollute __construct().
  14. Torben Hansen uploaded patch set 5 CR +1 V +1 06/14/25, 11:25

  15. Torben Hansen commented on patch set 5 06/14/25, 11:26

    AbstractCompositeValidator.php:43 Reply

    Alright, I changed it then back to the previous state and avoid the constructor arguments.
  16. core-ci voted on patch set 5 V +1 06/14/25, 11:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80322

  17. Oliver Klee voted on patch set 5 CR +1 06/14/25, 18:05

  18. Simon Schaufelberger voted on patch set 5 CR +1 V +1 06/15/25, 23:59

  19. Christian Kuhn commented on patch set 5 06/17/25, 10:48

    AbstractCompositeValidator.php:43 Reply

    well. it means the abstract still has __construct() making it "API", no matter if there are arguments or not (implementing services need to call parent::__construct() now which breaks if the abstract decides to add a constructor argument later). imho, abstracts shouldn't do this at all. it looks to me as if this change does not really help much. the issue with the validators is deeper as we can see with the statefulness of the object: they are a mixture of a data object and service and that's what bites us. it feels to me as if we should rather think about a proper class structure that solves the root issue instead of having a breaking change to improve convenience of this broken structure: it was clear we should revamp the construct when we introduced the request in v13, where we also didn't solve the real issue. maybe it's time to solve the root cause now?
  20. Torben Hansen commented on patch set 5 06/17/25, 11:53

    AbstractCompositeValidator.php:43 Reply

    You`re right, the change does not help much except trying to "resolve" a todo which has been there for years. I'm fine, if this does not come in and will abandon the patch. I understand that the current structure is not perfect from a software design principle, but have no good idea on how to resolve the issue. I'm however open for discussions/improvements in this area, which are beneficial for users of the validators.
  21. Torben Hansen abandoned the change 06/17/25, 11:53

    Change has no real benefit