ozahorulia
ozahorulia

Reputation: 10084

Static class vars type definition in PhpStorm

I have some class named myClass, and following structure in there:

class myClass
{
    static $foo;

    public static function init()
    {
        self::$foo = new bar();
    }
}

How can I make phpstorm define myClass::$foo as bar's object in the rest of my code?

Upvotes: 1

Views: 864

Answers (1)

Madara's Ghost
Madara's Ghost

Reputation: 174937

Use a PHPDoc.

class myClass
{
    /**
     * @var bar $foo - Holds a bar object.
     */
    static $foo;
}

Upvotes: 2

Related Questions