39825[CLEANUP] Remove usage of self::class
Commit message
Review
-
Code review CR +2
- Wouter Wolters +2
- Helmut Hummel +2
- Susi Moog +1
-
Verified V +2
- Wouter Wolters +2
- Helmut Hummel +2
- Susi Moog +1
Issues 1
Files 4
Review log 10
-
Frank Nägler uploaded patch set 1 05/30/15, 13:44
-
Helmut Hummel voted on patch set 1 CR +2 V +2 05/30/15, 14:02
-
Susi Moog voted on patch set 1 CR +1 V +1 05/30/15, 17:34
-
Wouter Wolters voted on patch set 1 V +2 CR +2 05/30/15, 17:51
-
Wouter Wolters merged patch set 1 05/30/15, 17:51
-
Andreas Allacher commented on patch set 2 06/01/15, 19:36
Is there a reason for this? New CGL? Or a PHP reason? Especially, for using the full qualified name with ::class as array keys? Because even if one extends a class, self::class would still point to the original. Only static::class would point to the extended. -
Frank Nägler commented on patch set 2 06/01/15, 20:22
The reason was that the full qualified namespace is better readable. and that we use __CLASS__ in the core. The CGL need an update, because the ::class feature is very new. Another reason was, that the array key should not change if the class get a new name. While refactoring the FQN as array key need a change too, while self::class would work automatic, this is then a possible breaking change, and maybe no one notice this. -
Andreas Allacher commented on patch set 2 06/02/15, 05:49
Ah. OK. renaming class makes sense. But if the class doesn't exist anymore ::class isn't perfect anyway :) __CLASS__ makes sense for makeInstance as there is no to e.g. use static::class as even if there were an Xclass makeInstance would already take care of it (and might be required to use the same name for singletons). Of course, static::class might make sense if I had a getInstance method in a class which I want to extend later on without having to override getInstance. Though I don't think that is very often the case :) -
Andreas Allacher commented on patch set 2 06/02/15, 20:18
Regarding renaming again, I just thought about it but it actually wouldn't help to have the full name with ::class because most likely the renaming would be done with the IDE which would also rename those ::class references. However, it might be "easier" to not forget those references. Well, as array key it has, however, definitely the advantage for developers who want to make use of those hooks because they will see the full name in the array, so that might be an advantage (to it shoud be easy to get the fully qualified name with the IDE). -
Andreas Allacher commented on patch set 2 06/02/15, 20:19
... Ah, I just noticed you already mentioned the point that it would also need refactoring but one would most likely notice it at least because if is in the changed part of the code.