简体   繁体   中英

Automatically adding return types to methods and functions

Is there an option to automatically add return types, or at least all me to generate them?

What I want is my methods before PhpStorm generates the return types:

function isValid() 
{
    return true;
}

After

function isValid(): bool
{
    return true;
}

Is this possible?

This issue was already answered at: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000163824-Automatically-add-return-type-declarations-

By someone whose profile picture looks like that of LazyOne . ;-)

Their answer (quoted and link added) is:

... If you are talking about adding ": QueryBuilder" declaration for PHP 7.x -- the " Php Inspections (EA Extended) " plugin has such intentions/quick fixes; not sure if PhpStorm has the same/similar out of the box.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM