2
votes
public static function someStaticMethod($method, ...$args)
{
    ...
    return self::{"_$method"}(...$args);
}

So despite code is valid for PHP 7, and in Languages & Frameworks | PHP settings Language Level is set to 7.1, I'm getting error hint for the return line.

Can it be somehow disabled for this line or for this case, or maybe I'm really messing something badly?

PhpStorm version: 2016.2.2

Error hint that shows on the first curly brace:

Expected: namespace or use or goto or if or elseif or else or for or foreach keyword or while or do or switch or case or default keyword or try or catch or declare or break or endif or endfor or endforeach or endwhile or endswitch or enddeclare or die or exit or private or function or new or instanceof or const or list or implements or eval or final or as or throw or include_once or class or abstract or interface keyword or public keyword or static keyword or clone keyword or isset keyword or empty keyword or return or var or continue or protected or print or echo or include or global or extends or unset or require_once or array or callable or require or identifier or and keyword or or keyword or xor keyword or trait or insteadof or finally or yield

1

1 Answers

3
votes

This is fixed (WI-13620 ticket) for next major version -- PhpStorm 2017.1 (I see no warning in the code below).

enter image description here

If you wish -- you may try 2017.1 EAP build now (different IDE versions can be run in parallel as they store IDE-wide settings in separate locations by default).

Please note: it's an EAP build (Early Access Program) so it may have other issues (incompatible plugins, slow execution, other new bugs caused by newly-introduced feature etc.).