#66322Use static:: instead of self::
Description
Hi there,
is there a reason why TYPO3 uses “self::” to access static methods? For more flexibility it would be nice if TYPO3 uses “static::” (so you can extend the classes).
For example in the fluid translation view helper:
class TranslateViewHelper extends AbstractViewHelper implements CompilableInterface {
public function render(...) {
return self::renderStatic(...);
}
static public function renderStatic(...) {
...
}
}
class MyPrefixedTranslateViewHelper extends TranslateViewHelper {
public function render(...) {
// this function has nothing new, it's just there to call our own static function
return self::renderStatic(...);
}
static public function renderStatic(...) {
...
}
}
If you just want to overwrite the static function “renderStatic”, you also have to overwrite the non-static function “render”. If “static::” would be used in the function “render”, you just have to overwrite the function “renderStatic”.
This looks this way:
class TranslateViewHelper extends AbstractViewHelper implements CompilableInterface {
public function render(...) {
return static::renderStatic(...);
}
static public function renderStatic(...) {
...
}
}
class MyPrefixedTranslateViewHelper extends TranslateViewHelper {
static public function renderStatic(...) {
...
}
}
What do you think?
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.