Review main Merged

61086[BUGFIX] Use late static binding return type for Enumeration::cast

Sascha Egerer CR +2 V +2 Easy +4 −5 updated 06/27/19, 11:14

Commit message

The return type annotation must be `static` instead of `self` as the
method returns an instance of the inheriting class.

Do also replace some occurrences of get_calling_class()
by static::class

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oliver Klee +1
    • Alexander Schnitzler +1
    • Oliver Hader +1
  • Verified V +2 Done
    • Benni Mack +2
    • Alexander Schnitzler +1
    • Oliver Hader +1
    • TYPO3com +1 CI

Issues 1

Files 1

Review log 3744

Show 1619 earlier messages
  1. Sascha Egerer uploaded patch set 1 06/18/19, 14:46

  2. TYPO3com voted on patch set 1 V +1 06/18/19, 15:03 Completed build in 15m 32s on Tue, 18 Jun, 05:03 PM Test Summary: 46442 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-34425

  3. Mathias Brodala commented on patch set 1 CR -1 06/18/19, 15:08

    Please create a new ticket instead.
    This is no high-priority fix so it cannot go into v8.
  4. Sascha Egerer commented on patch set 1 06/18/19, 15:14

    Reply Unresolved

    Ups, i did but just used the wrong issue number...

    Reply

    Ok, i would opt for adding it as it makes usage of static code linters pretty hard and this fix does not have any functional change but is only "documentation". Opinions on that?
  5. Sascha Egerer updated the commit message in patch set 2 06/18/19, 15:14

  6. Mathias Brodala commented on patch set 2 06/18/19, 15:25

    Reply Unresolved

    Personally I wouldn't mind but that's the policy of TYPO3.
  7. TYPO3com voted on patch set 2 V +1 06/18/19, 15:27 Completed build in 12m 44s on Tue, 18 Jun, 05:27 PM Test Summary: 46442 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-34426

  8. Oliver Klee voted on patch set 2 CR +1 06/18/19, 17:19

  9. Benni Mack commented on patch set 2 06/19/19, 04:37

    I'd consider this a bug. So how about [BUGFIX] in the commit message?
  10. Sascha Egerer updated the commit message in patch set 3 06/19/19, 06:53

  11. Alexander Schnitzler commented on patch set 3 06/19/19, 06:57

    What kind of bug does this fix? I mean, besides getting proper IDE support, maybe.
  12. Sascha Egerer commented on patch set 3 06/19/19, 07:00

    > Patch Set 3: > > What kind of bug does this fix? I mean, besides getting proper IDE support, maybe. The return type is simply wrong which does show errors in you IDE, let static code linters fail and could end up in misusage of the return value (not that important in that case) as generated documentation is also wrong. I would also consider it as a bug.
  13. TYPO3com voted on patch set 3 V +1 06/19/19, 07:20 Completed build in 23m 30s on Wed, 19 Jun, 09:20 AM Test Summary: 46448 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-34436

  14. Alexander Schnitzler commented on patch set 3 06/19/19, 07:31

    > Patch Set 3: > > > Patch Set 3: > > > > What kind of bug does this fix? I mean, besides getting proper IDE support, maybe. > > The return type is simply wrong which does show errors in you IDE, let static code linters fail and could end up in misusage of the return value (not that important in that case) as generated documentation is also wrong. I would also consider it as a bug. Ok, just wanted to know that we don't have an actual code change here because we take the return type of the annotation to do some magic. I acknowledge that this is wrong and should be fixed, just wanted to know the implications of such a change.
  15. Sascha Egerer commented on patch set 3 06/19/19, 07:32

    > Patch Set 3: > > > Patch Set 3: > > > > > Patch Set 3: > > > > > > What kind of bug does this fix? I mean, besides getting proper IDE support, maybe. > > > > The return type is simply wrong which does show errors in you IDE, let static code linters fail and could end up in misusage of the return value (not that important in that case) as generated documentation is also wrong. I would also consider it as a bug. > > Ok, just wanted to know that we don't have an actual code change here because we take the return type of the annotation to do some magic. I acknowledge that this is wrong and should be fixed, just wanted to know the implications of such a change. No there should be no implications for the code execution. So it should not really change anything in the code flow.
  16. Alexander Schnitzler voted on patch set 3 V +1 CR +1 06/19/19, 07:32

  17. Benni Mack commented on patch set 3 V +1 CR +1 06/19/19, 07:52

    Oli, feel free to add your vote, then I will merge.
  18. Benni Mack commented on patch set 3 06/25/19, 14:30

    @Sascha: I wonder why we don't use static:: instead of get_calling_class(). Can you elaborate?
  19. Sascha Egerer uploaded patch set 4 06/26/19, 08:51

  1. Sascha Egerer commented on patch set 4 06/26/19, 08:52

    > Patch Set 3: > > @Sascha: I wonder why we don't use static:: instead of get_calling_class(). Can you elaborate? Maybe this was related to the supported PHP versions when this functionality was introduced. Or maybe just because... I've pushed a new patch set
  2. Sascha Egerer commented on patch set 4 06/26/19, 08:53

    Enumeration.php:186

    We have to keep that variable because "new static::class" does not work (line 188)
  3. Oliver Klee commented on patch set 4 06/26/19, 09:00

    Enumeration.php:186 Reply

    That should be new static(), not new static::class.
  4. TYPO3com voted on patch set 4 V +1 06/26/19, 09:02 Completed build in 10m 21s on Wed, 26 Jun, 11:02 AM Test Summary: 46508 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-34544

  5. Sascha Egerer commented on patch set 4 06/26/19, 09:23

    Enumeration.php:186 Reply Unresolved

    Ah ok, thx!
  6. Sascha Egerer uploaded patch set 5 06/26/19, 09:24

  7. TYPO3com voted on patch set 5 V +1 06/26/19, 09:36 Completed build in 12m 05s on Wed, 26 Jun, 11:36 AM Test Summary: 46508 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-34545

  8. Oliver Klee commented on patch set 5 06/26/19, 10:49

    The code looks good. Now can we cover this with a test?
  9. Sascha Egerer commented on patch set 5 06/26/19, 10:55

    > Patch Set 5: > > The code looks good. Now can we cover this with a test? What exactly would you like to cover that is not already covered?
  10. Oliver Klee commented on patch set 5 06/26/19, 10:56

    > What exactly would you like to cover that is not already covered? I'd like to have a regression test that fails without the fix and passes with it.
  11. Alexander Schnitzler commented on patch set 5 06/26/19, 10:58

    > Patch Set 5: > > > What exactly would you like to cover that is not already covered? > > I'd like to have a regression test that fails without the fix and passes with it. What bug do we actually fix here that could be covered with such a test?
  12. Sascha Egerer commented on patch set 5 06/26/19, 10:58

    > Patch Set 5: > > > What exactly would you like to cover that is not already covered? > > I'd like to have a regression test that fails without the fix and passes with it. The fix a php doc that is interpreted by the IDE. You mean we should write a test that creates an reflection of the class to check the php doc return type?
  13. Sascha Egerer updated the commit message in patch set 6 06/26/19, 11:02

  14. Oliver Klee commented on patch set 6 06/26/19, 11:04

    Oh, I was not aware that the actual fix is only the change to the PHPDoc, and that the code changes are mere cleanup. Then we indeed don't need a test. And we should make this more clear in the commit message.
  15. Oliver Klee commented on patch set 6 06/26/19, 11:06

    Unresolved

    Maybe we can word this as "return type declaration"? Or would "return type annotation" be better?
  16. Sascha Egerer updated the commit message in patch set 7 06/26/19, 11:07

  17. Sascha Egerer commented on patch set 7 06/26/19, 11:08

    > Patch Set 6: > > Oh, I was not aware that the actual fix is only the change to the PHPDoc, and that the code changes are mere cleanup. Then we indeed don't need a test. > > And we should make this more clear in the commit message. Ah ok. AFAIK this was the first class that had 100% test coverage in TYPO3 :)
  18. TYPO3com voted on patch set 6 V +1 06/26/19, 11:15 Completed build in 12m 54s on Wed, 26 Jun, 01:15 PM Test Summary: 46508 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-34546

  19. TYPO3com voted on patch set 7 V +1 06/26/19, 11:18 Completed build in 10m 46s on Wed, 26 Jun, 01:18 PM Test Summary: 46508 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-34547

  20. Alexander Schnitzler voted on patch set 7 V +1 CR +1 06/26/19, 11:59

  21. Oliver Klee commented on patch set 7 CR +1 06/26/19, 12:41

    Beautiful!
  22. Oliver Hader voted on patch set 7 CR +1 06/26/19, 20:31

  23. Benni Mack voted on patch set 7 V +2 CR +2 06/27/19, 11:07

  24. Benni Mack merged patch set 8 06/27/19, 11:07

  25. Oliver Hader voted on patch set 8 V +1 06/27/19, 11:14