Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to undefined method when using Nette Events #29

Open
Lukeluha opened this issue Oct 4, 2018 · 1 comment
Open

Call to undefined method when using Nette Events #29

Lukeluha opened this issue Oct 4, 2018 · 1 comment

Comments

@Lukeluha
Copy link

Lukeluha commented Oct 4, 2018

I am trying to use phpstan with nette and I have a problem with not recognizing Nette Events (even if this should be supported according to README).

My code looks like this:

trait CommonTrait
{
	use SmartObject;

	/** @var array  */
	public $onUpdate = [];
...
        public function insert($data) {
                ...
                $this->onUpdate($data);
        }

But after running PHP stan with Nette extension I am getting these errors:
Call to an undefined method App\Model\Db\Languages::onUpdate()
And it is the same with other classes using this trait.

I am using Nette 2.4 and the latest PHPStan shim and I have tried that the Nette extension loads correctly.

@ondrejmirtes
Copy link
Member

This should work, but I'm not sure if it works with traits correctly. Feel free to debug the issue. The class responsible for this is: https://github.com/phpstan/phpstan-nette/blob/master/src/Reflection/Nette/NetteObjectClassReflectionExtension.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants