This doesn't affect the code, but it is kind of annoying.
I have these 3 methods inside my controller:
public function chainOne()
{
return $this;
}
public function chainTwo()
{
return $this;
}
public function chainThree()
{
return $this;
}
The method that is being called once hitting the specific route is this:
public function indexAction()
{
$this->chainOne()
->chainTwo()
->chainThree();
}
PHPStorm says method chainThree() not found in class $this
. But the code inside chainThree()
is being executed without a problem.
How can I fix it? Is it a bug?
You can use docblocks to help PHPStorm recognize the return value:
public class Foo
{
/**
* @return Foo $this
*/
public function chainOne()
{
return $this;
}
/**
* @return Foo $this
*/
public function chainTwo()
{
return $this;
}
/**
* @return Foo $this
*/
public function chainThree()
{
return $this;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With