Phpinspectionsea: Inspection suggest usage of static:: when the method name begins with static

Created on 7 Nov 2017  路  8Comments  路  Source: kalessil/phpinspectionsea

When a method is defined in a class via annotations like this: @method StaticBlockManager staticBlock() and later used withing the $this context $this->staticBlock()->get("CONTACTS") the inspections suggest that I use static:: instead of $this->.

Here's an attachment:
screenshot from 2017-11-07 10-12-42

bug / false-positive fixed

All 8 comments

Thank you for reporting @thexpand.
What happens if you apply the suggested change?

@kalessil It becomes static::staticBlock()->getTitle("CONTACTS")

And then, does application get broken or keep running?

No, it's broken, because it is not a static method. I'm using ZendFramework and in the template, I'm using a fake class, where I write my @method doc blocks (for auto-suggest in the template). The reason why I'm doing this is because the view helpers in ZendFramework are called via the magic method __call().

You can take a look how it's written here:
https://github.com/zendframework/zend-view/blob/master/src/Renderer/PhpRenderer.php#L35

I do the same, but my method's name is staticBlock()

Oh, I see now. This is a bug in IDE itself:

Please vote for it and I'll write a workaround.

@kalessil I voted, but it seems that they have abandoned the issue. It's more than an year old.

Ths. Once I have done with the workaround, I'll ask guys to close the issue.

Fixed.

Was this page helpful?
0 / 5 - 0 ratings