Review main Merged

78031[TASK] Introduce type declarations for makeInstance()

Alexander Schnitzler CR +2 V +2 Normal +3 −52 updated 03/14/23, 20:29

Commit message

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oliver Klee +1
    • Dmitry Dulepov +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oliver Klee +1
    • Dmitry Dulepov +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 2937

Show 812 earlier messages
  1. Alexander Schnitzler uploaded patch set 1 03/05/23, 14:48

  2. Alexander Schnitzler commented on patch set 1 03/05/23, 14:54

  3. Alexander Schnitzler wrote 03/05/23, 14:54

    Topic set to phpstan
  4. core-ci voted on patch set 1 V -1 03/05/23, 15:49 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38496

  5. Alexander Schnitzler uploaded patch set 2 V -1 03/06/23, 08:44

  6. core-ci voted on patch set 2 V +1 03/06/23, 09:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38520

  7. Oliver Klee voted on patch set 2 V +1 CR +1 03/07/23, 12:43

  8. Alexander Schnitzler uploaded patch set 3 CR +1 V +1 03/09/23, 09:07

  9. Alexander Schnitzler rebased onto patch set 4 03/09/23, 09:07

  10. core-ci voted on patch set 3 V -1 03/09/23, 09:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38681

  11. core-ci voted on patch set 4 V -1 03/09/23, 09:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38682

  12. Alexander Schnitzler uploaded patch set 5 V -1 03/09/23, 09:19

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

  2. core-ci voted on patch set 5 V +1 03/09/23, 09:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38683

  3. Oliver Klee commented on patch set 5 CR 0 03/09/23, 09:28

    GeneralUtility.php:2917

    We can also have a type declaration for `$constructorArguments`: ``` public static function makeInstance(string $className, mixed ...$constructorArguments): object ```
  4. Oliver Klee uploaded patch set 6 V +1 03/09/23, 09:28

  5. Oliver Klee commented on patch set 5 V +1 CR +1 03/09/23, 09:28

    GeneralUtility.php:2917 Reply

    Done
  6. Oliver Klee voted on patch set 6 V +1 CR +1 03/09/23, 09:28

  7. Alexander Schnitzler commented on patch set 6 03/09/23, 09:42

    Reply

    Done
  8. core-ci voted on patch set 6 V -1 03/09/23, 09:46 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38684

  9. Oliver Klee uploaded patch set 7 CR +1 V +1 03/09/23, 09:51

  10. Oliver Klee voted on patch set 7 V +1 CR +1 03/09/23, 09:52

  11. core-ci voted on patch set 7 V +1 03/09/23, 09:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38686

  12. Oliver Klee commented on patch set 7 CR -1 03/09/23, 09:59

    I'd like to get https://review.typo3.org/c/Packages/TYPO3.CMS/+/78080 merged as a pre-patch first.
  13. Oliver Klee uploaded patch set 8 CR -1 V +1 03/09/23, 13:13

  14. Oliver Klee voted on patch set 8 V +1 CR +1 03/09/23, 13:15

  15. core-ci voted on patch set 8 V +1 03/09/23, 13:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38699

  16. Nikita Hovratov commented on patch set 8 V -1 03/09/23, 13:24

  17. Oliver Klee commented on patch set 8 03/09/23, 13:58

    Reply

    GeneralUtility is already listed in that ReST. Would it make sense to add another ReST file with similar contents for 12.3.0, or does having it for 12.0 suffice?
  18. Alexander Schnitzler commented on patch set 8 03/09/23, 14:27

    Reply

    This is not breaking because the type had been checked before and threw an exception if `$className` was not a string. There is no actual use case where users have a worse experience with a TypeError instead of an \InvalidArgumentException. Let's be pragmatic from time to time ;)
  19. Nikita Hovratov commented on patch set 8 03/09/23, 16:28

    Reply

    I don't mean the usage itself, but in (super) rare cases, where people might extend GeneralUtility. Need another opinion on that, but that was our rule for being breaking in early v12 development.
  20. Alexander Schnitzler commented on patch set 8 03/09/23, 18:16

    Reply

    To be frank here, this is hilarious. If we respect those edge cases we are nuts. I can't come up with any legit scenario where I extend a static class, overwrite a factory method and exchange the type of `$classString`. To me it's wasted time thinking about it even. API (contract) should be: You pass a class-string, you get an object. That's not violated, hence not breaking.
  21. Benni Mack commented on patch set 8 03/09/23, 20:05

    Reply

    X-Classing is not covered by BC, however, there are a few cases (like AbstractPlugin) where I would refrain from such changes. Within a class with static methods like GeneralUtility or ExtensionManagementUtility that already have these checks anyway, I don't see a problem.
  22. Nikita Hovratov commented on patch set 8 V 0 03/10/23, 08:33

    Reply

    Ack
  23. Dmitry Dulepov commented on patch set 8 V +1 CR +1 03/13/23, 11:56

    I had this issue with phpstorm: https://forge.typo3.org/issues/100152 Then Georg pointed me to this change and it works fine for me if I change code in v12.2.0 to look like here.
  24. Benni Mack voted on patch set 8 V +2 CR +2 03/14/23, 20:29

  25. Benni Mack merged patch set 9 03/14/23, 20:29