Review main Merged

78142[TASK] Simplify ValidatorResolver::buildBaseValidatorConjunction()

Alexander Schnitzler CR +2 V +2 Normal +94 −80 updated 03/21/23, 09:52

Commit message

Prior to this change, buildBaseValidatorConjunction() was responsible
for initializing $this->baseValidatorConjunctions[$indexKey] and
additionally adding an object validator if the given target type
was a class name.

Now, the initialization takes place in getBaseValidatorConjunction()
already and buildBaseValidatorConjunction() is only called if target
types is a class name.

That way, buildBaseValidatorConjunction() gets rid of an if-statement
and the whole method looses one indentation.

Additionally, buildBaseValidatorConjunction() is guaranteed to get
passed a class-string, so argument name $targetClassName actually
makes sense.

Review

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

Issues 1

Files 5

Review log 2630

Show 45 earlier messages
  1. Alexander Schnitzler uploaded patch set 1 03/17/23, 07:33

  2. Alexander Schnitzler wrote 03/17/23, 07:35

    Topic set to extbase
  3. core-ci voted on patch set 1 V +1 03/17/23, 07:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39101

  4. Oliver Klee voted on patch set 1 CR +1 03/20/23, 10:25

  5. Oliver Klee voted on patch set 1 V +1 03/20/23, 10:25

  1. Markus Klein commented on patch set 1 CR -1 03/20/23, 16:42

    ValidatorResolver.php:173

    Shouldn't this if be outside of the loop, like it was before?
  2. Alexander Schnitzler commented on patch set 1 03/20/23, 17:19

    ValidatorResolver.php:173 Reply

    Absolutely right. Will push a fix.
  3. Alexander Schnitzler uploaded patch set 2 CR +1 V +1 03/20/23, 17:20

  4. Alexander Schnitzler commented on patch set 2 03/20/23, 17:20

    ValidatorResolver.php:173 Reply

    Done
  5. core-ci voted on patch set 2 V +1 03/20/23, 17:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39263

  6. Oliver Klee voted on patch set 2 V +1 CR +1 03/20/23, 17:29

  7. Christian Kuhn commented on patch set 2 03/20/23, 19:18

    AbstractCompositeValidator.php:39

    The issue with `__construct()` in abstracts which are API is: This 'pollutes' the constructor and extending classes must call `parent::__construct()` now. Strictly speaking, this is breaking. In this case, it most likely does not matter, though, since probably nobody adds another composite validator and has an own `__construct()`. However, to avoid any discussion in this direction, it might be easier to simply put this constructor to the two extending classes which are not abstract but final already. What do you think?
  8. Alexander Schnitzler commented on patch set 2 03/20/23, 19:41

    AbstractCompositeValidator.php:39 Reply

    Yep, let's do that. This class was marked @api in 2018 but we should mark it @internal, like many many other things.
  9. Markus Klein commented on patch set 2 03/20/23, 19:55

    ValidatorResolver.php:173 Reply

    Hm... what worries me a bit is that tests did not fail with this mistake
  10. Alexander Schnitzler commented on patch set 2 03/21/23, 06:45

    ValidatorResolver.php:173 Reply

    IIRC we have just one test that checks the amount of validators applied. And it obviously does not cover this case. However, we had the case of duplicate registered validators some time ago. It doesn't result in a change of validation logic, it just eats more cpu time and memory. And besides that: Our test coverage is horrible. Looks like sooo many tests but when you look at the tests, it's very often 90% test setup, building mock hierarchies.
  11. Markus Klein voted on patch set 2 V +1 CR +1 03/21/23, 07:52

  12. Markus Klein voted on patch set 2 V 0 CR 0 03/21/23, 07:53

  13. Alexander Schnitzler uploaded patch set 3 CR +1 V +1 03/21/23, 08:25

  14. Alexander Schnitzler commented on patch set 3 03/21/23, 08:25

    AbstractCompositeValidator.php:39 Reply

    Done
  15. core-ci voted on patch set 3 V +1 03/21/23, 08:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39299

  16. Markus Klein voted on patch set 3 V +1 CR +1 03/21/23, 08:39

  17. Oliver Klee voted on patch set 3 V +1 CR +1 03/21/23, 09:22

  18. Christian Kuhn commented on patch set 3 CR -1 03/21/23, 09:23

    ValidatorResolver.php:107

    i'll push on this to clean up the messy comment styling in this method a bit.
  19. Christian Kuhn uploaded patch set 4 CR +1 V +1 03/21/23, 09:37

  20. Christian Kuhn commented on patch set 4 V +1 CR +1 03/21/23, 09:40

    ValidatorResolver.php:107 Reply

    Done. Sorry for messing around on this again ;)
  21. core-ci voted on patch set 4 V +1 03/21/23, 09:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39306

  22. Markus Klein voted on patch set 4 V +1 CR +1 03/21/23, 09:46

  23. Oliver Klee voted on patch set 4 V +1 CR +1 03/21/23, 09:51

  24. Christian Kuhn voted on patch set 4 V +2 CR +2 03/21/23, 09:52

  25. Christian Kuhn merged patch set 5 03/21/23, 09:52