John Davidson

phpdoc - Php, code competion for inline-factory / dynamic method name?

0 comments
Message:


given this snippet:


class Test
{
public function run2()
{
}
}

class Factory
{
public function createTest()
{
return new Test();
}
}

$factory = new Factory();
$m = 'createTest';
$factory->{$m}->run2();

Phpstorm will say most of it are unused:



of course I can extract the calls:


$factory = new Factory();
$m = 'createTest';
$x = $factory->{$m}();
/** @var $x Test */
$x->run2();

that way at least run2() is shown:



is there a "magic" phpdoc which Im not aware of? I dont want to extract method calls.



My Answer:
> createTest()->run2();

Rate this post

3 of 5 based on 3171 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us