Review main Merged

73709[FEATURE] Add required flag in TCA instead of `eval` option

Andreas Kienast CR +2 V +2 Hard +467 −89 updated 02/28/22, 09:44

Commit message

In order to make TCA slimmer and more understandable, the
`required` configuration is now used in favor of
`eval`, which is also enforced by an automatic
TCA migration.

At least since #67354 TYPO3 is able to use an explicit `required`
configuration:

    'column' => [
        'label' => 'foo',
        'config' => [
            'type' => 'input',
            'required' => true,
        ],
    ]

Review

  • Code review CR +2 Done
    • Andreas Kienast +2
    • Oli Bartsch +1
    • Nikita Hovratov +1
  • Verified V +2 Done
    • Andreas Kienast +2
    • Oli Bartsch +1
    • Nikita Hovratov +1
    • core-ci +1 CI

Issues 1

Files 57

Show 37 more files

Review log 3451

Show 1526 earlier messages
  1. Andreas Kienast uploaded patch set 1 02/25/22, 10:36

  2. core-ci voted on patch set 1 V -1 02/25/22, 10:43 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24259

  3. Andreas Kienast uploaded patch set 2 02/25/22, 10:46

  4. Andreas Kienast uploaded patch set 3 02/25/22, 10:47

  5. core-ci voted on patch set 2 V -1 02/25/22, 10:54 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24260

  6. Benni Mack commented on patch set 3 02/25/22, 10:55

    DataHandler.php:2707

    I don't understand what this method does...
  7. core-ci voted on patch set 3 V -1 02/25/22, 10:55 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24261

  8. Benni Mack commented on patch set 3 02/25/22, 10:55

    I think the DataHandler changes could actually be backported to v11 then?
  9. Andreas Kienast uploaded patch set 4 02/25/22, 11:52

  10. core-ci voted on patch set 4 V -1 02/25/22, 12:01 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24263

  11. Andreas Kienast uploaded patch set 5 02/25/22, 12:15

  12. core-ci voted on patch set 5 V +1 02/25/22, 12:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24264

  13. Andreas Kienast uploaded patch set 6 02/25/22, 12:45

  14. core-ci voted on patch set 6 V +1 02/25/22, 13:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24267

  15. Benni Mack uploaded patch set 7 02/25/22, 13:50

  16. Benni Mack commented on patch set 6 02/25/22, 13:50

    DataHandler.php:2707 Reply

    Done
  17. Benni Mack uploaded patch set 8 02/25/22, 13:54

  18. core-ci voted on patch set 7 V -1 02/25/22, 13:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24276

  19. Benni Mack uploaded patch set 9 02/25/22, 14:00

  20. Benni Mack updated the commit message in patch set 10 02/25/22, 14:00

  21. core-ci voted on patch set 8 V -1 02/25/22, 14:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24277

  22. core-ci voted on patch set 10 V -1 02/25/22, 14:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24279

  23. core-ci voted on patch set 9 V -1 02/25/22, 14:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24278

  24. Benni Mack uploaded patch set 11 02/25/22, 15:45

  25. core-ci voted on patch set 11 V +1 02/25/22, 15:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24292

  26. Andreas Kienast uploaded patch set 12 02/25/22, 16:50

  1. core-ci voted on patch set 12 V +1 02/25/22, 17:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24298

  2. Andreas Kienast uploaded patch set 13 02/25/22, 20:04

  3. core-ci voted on patch set 13 V -1 02/25/22, 20:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24305

  4. Andreas Kienast uploaded patch set 14 02/25/22, 20:54

  5. core-ci voted on patch set 14 V +1 02/25/22, 21:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24306

  6. Oli Bartsch commented on patch set 14 02/25/22, 23:26

    ImageManipulationElement.php:206

    if ($config['required'] ?? false) should be sufficient.

    TcaMigration.php:57

    Usually new migrations are added at the bottom.

    TcaMigration.php:215

    I'm missing the PHPDoc describing what is migrated to what. See the other migrations for examples. Also the whole method is really hard to read. No early return, mixed "pass by reference" and yoda syntax. Additionally, the message is only added in case "required" does not yet exists as config. This means, there is a chance the migrations removes "required" from the eval list, without notifying the user. The message IMO should always be added as soon as we remove "required" from the "eval" list.

    TcaMigration.php:219

    Not 100% sure but "eval" is only valid for "type=input", right? If so, we should also check for the type to not touch unrelated config (This should then also get a test case).
  7. Oli Bartsch commented on patch set 14 02/25/22, 23:45

    TcaMigration.php:219 Reply

    Forget about this.
  8. Oli Bartsch commented on patch set 14 02/25/22, 23:57

    TcaMigration.php:219 Reply

    Resolved the comment due to various types supporting "eval", e.g. also "check". However since the "required" migration only makes sense for "input" and "text" my initial comment about also checking for the TCA type(s) might still make sense?
  9. Andreas Kienast commented on patch set 14 02/27/22, 12:24

    ImageManipulationElement.php:206 Reply

    Ack

    TcaMigration.php:57 Reply

    Ack

    TcaMigration.php:215 Reply

    IIRC other methods don't have early returns as well, also I'm not aware of yod syntax (I thought phpcs-fixer detects those). I agree with the notification point, I'll change the code accordingly.

    TcaMigration.php:219 Reply

    I'd keep this for now as we plan to introduce new field types (e.g. email). If somebody uses "the old"™ eval syntax (un)intentionally, this should get migrated as well.
  10. Andreas Kienast uploaded patch set 15 02/27/22, 12:32

  11. core-ci voted on patch set 15 V +1 02/27/22, 12:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24362

  12. Nikita Hovratov commented on patch set 15 02/27/22, 14:27

    TcaMigration.php:219 Reply

    On top of that "slug" and "imageManipulation" have the eval=required option, too. Btw check has "eval", but it's only for the combination with "validation".
  13. Nikita Hovratov commented on patch set 15 02/27/22, 14:52

    be_users.php:59

    "password" needs to be added back.

    Deprecation-97035-DeprecatedRequiredOptionInEvalKeyword.rst:4

    The word "deprecated" is redundant in the title, as it is a Deprecation rst. Let's change the filename and title to not include it twice.

    Deprecation-97035-DeprecatedRequiredOptionInEvalKeyword.rst:16

    refactoring without "s"

    Deprecation-97035-DeprecatedRequiredOptionInEvalKeyword.rst:24

    Its not logged, only visible in the TCA migration module.

    Deprecation-97035-DeprecatedRequiredOptionInEvalKeyword.rst:37

    true without quotation marks and also no log entry.

    Deprecation-97035-DeprecatedRequiredOptionInEvalKeyword.rst:61

    true

    Feature-97035-UtilizeRequiredDirectlyInTCAFieldConfiguration.rst:23

    required => true

    Feature-97035-UtilizeRequiredDirectlyInTCAFieldConfiguration.rst:37

    required => true
  14. Andreas Kienast commented on patch set 15 02/27/22, 14:55

    Deprecation-97035-DeprecatedRequiredOptionInEvalKeyword.rst:24 Reply

    In my tests I had entries in typo3temp/var/log/typo3_deprecations_xxx.log
  15. Andreas Kienast commented on patch set 15 02/27/22, 14:59

    be_users.php:59 Reply

    Ack

    Deprecation-97035-DeprecatedRequiredOptionInEvalKeyword.rst:4 Reply

    Ack

    Deprecation-97035-DeprecatedRequiredOptionInEvalKeyword.rst:16 Reply

    Ack

    Deprecation-97035-DeprecatedRequiredOptionInEvalKeyword.rst:24 Reply

    Deprecation-97035-DeprecatedRequiredOptionInEvalKeyword.rst:37 Reply

    Ack

    Deprecation-97035-DeprecatedRequiredOptionInEvalKeyword.rst:61 Reply

    Ack

    Feature-97035-UtilizeRequiredDirectlyInTCAFieldConfiguration.rst:23 Reply

    Ack

    Feature-97035-UtilizeRequiredDirectlyInTCAFieldConfiguration.rst:37 Reply

    Ack
  16. Andreas Kienast uploaded patch set 16 02/27/22, 14:59

  17. Nikita Hovratov commented on patch set 15 02/27/22, 15:00

    DataHandler.php:2715

    We could typehint $value with mixed.

    Deprecation-97035-DeprecatedRequiredOptionInEvalKeyword.rst:24 Reply

    Oh ok, nvm then.
  18. Andreas Kienast uploaded patch set 17 02/27/22, 15:07

  19. core-ci voted on patch set 16 V +1 02/27/22, 15:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24376

  20. Nikita Hovratov commented on patch set 16 02/27/22, 15:21

    DataHandler.php:2715 Reply

    Done
  21. Nikita Hovratov voted on patch set 17 V +1 CR +1 02/27/22, 15:21

  22. core-ci voted on patch set 17 V +1 02/27/22, 15:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24377

  23. Oli Bartsch commented on patch set 17 V +1 CR +1 02/28/22, 09:43

    TcaMigration.php:215 Reply

    Done

    TcaMigration.php:219 Reply

    Done
  24. Andreas Kienast voted on patch set 17 V +2 CR +2 02/28/22, 09:44

  25. Andreas Kienast merged patch set 18 02/28/22, 09:44