Attention

TYPO3 v9 has reached its end-of-life September 30th, 2021 and is not maintained by the community anymore. Looking for a stable version? Use the version switch on the top left.

You can order Extended Long Term Support (ELTS) here: TYPO3 ELTS.

Static Methods

When a given class calls one of its own static methods (or one from one of its parents), the code should use the self keyword instead of the class name. For more information on when or where static methods are a good idea (or not), see modelling cross cutting concerns.

Example

class MyClass
{
    public static function methodA()
    {
        //...
    }
    public static function methodB()
    {
        // instead of MyClass::methodA():
        self::methodA();
    }
}

Note that using static:: does not work in closures/lambda functions/anonymous functions.