A
A
Alex2018-08-22 13:56:15
phpstorm
Alex, 2018-08-22 13:56:15

PHPSTORM how to automatically provide type hinting for all class methods?

Good afternoon.
Is there a way in PHPSTORM to automatically provide type hinting for all class methods?
Those. there is some class

class Test
{
    /** @var string|null */
    protected $varString;
    
    /** return string|null */
    public function getVarString () {
        //...
    }
}

We need the opportunity, at will or otherwise, to specify the types returned by methods in the entire class.
class Test
{
    /** @var string|null */
    protected $varString;
    
    /** return string|null */
    public function getVarString (): ?string {
        //...
    }
}

I got the code that needs to be brought to the standards, but hundreds of files to be redone manually, this is still rubbish.
Thanks

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Kim, 2018-08-22
@kimono

Free hack: before declaring a method, enter /**and press Enter.

A
Alexander Aksentiev, 2018-08-22
@Sanasol

Google said that this is https://plugins.jetbrains.com/plugin/7622-php-insp...
This is not called type hinting, but return type declaration.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question