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

Traits Functions are not supported at level 2 diagnostic #37

Closed
Bolkun opened this issue Feb 28, 2019 · 3 comments
Closed

Traits Functions are not supported at level 2 diagnostic #37

Bolkun opened this issue Feb 28, 2019 · 3 comments
Labels
needs details Further information is requested

Comments

@Bolkun
Copy link

Bolkun commented Feb 28, 2019

It will be great if method will be found from traits declaration. Till now phpstan cannot recognize it.

@mglaman
Copy link
Owner

mglaman commented Apr 8, 2019

@Bolkun can you provide an example where this is failing so that I can write a specific test

@mglaman mglaman added the needs details Further information is requested label Apr 8, 2019
@hirvinen
Copy link

hirvinen commented Dec 9, 2019

PHPstan skips analyzing traits when those traits are not in the analysis scope. I experimented with various ways of running phpstan, and after some diving into its internals with a debugger I managed to realize that this was the cause of why I got different results inside a vagrant guest and outside of it;

Since our custom code is not under drupal/web in the repo, I used symlinks to replicate the expected directory structure as a "virtual drupal root", which I passed to phpstan. Of course the real paths to those traits would not match the paths given to phpstan, so the traits would get skipped. (This should probably be filed as a bug against phpstan.)

For now my solution is to use rsync for setting up the directory structure for running from the command line.

With VS Code extension PHP Static Analysis I however do get the expected results using symlinks for the "virtual drupal root" and pointing phpstan.neon at it.

@mglaman
Copy link
Owner

mglaman commented Feb 24, 2022

For all intents and purposes this seems to be working fine. I'm closing

@mglaman mglaman closed this as completed Feb 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs details Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants