You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't see anything actionable here. You'd need to create a project with the slow performance reproduced. It might be enough to create a project that has a few source files but that has many things in vendor.
I agree with mvorisek, we have the same issue on our WordPress platform.
We have a lot of themes and inside 30+ themes we have standalone node_modules directories and compiled_styles_dirs.
It's WordPress architecture and we could not to do something with it.
@renakdup Just to clarify - do you just have a performance problem? (please share the numbers), or are you seeking a change of behaviour when finding files? Thank you.
@ondrejmirtes, the first issue that I found is a performance issue. It was significantly noticeable when I switched to Mac M1. But then I found that excluding themes directory from scanning can boot performance unbelievably!
The themes directory has 30+ node_modules inside you will see it in the config.
I show real examples, all tests were run without PHPStan cache.
Tests on Mac M1:
Docker PHP 7.4 with plugins, themes directories
Count of files: 802480
Time: I waited 10m 30s minutes to see the first percentages animation of the analysis, then the analyzer reached 100% and was completed by 11m 50s.
Docker PHP 7.4 with excluded themes directory
Count of files: 21806
Time: 1m 27s
Without docker PHP8 with plugins, themes directories
Count of files: 802480
Time: 2m 30s
Without docker PHP8 with plugins directory
Count of files: 21806
Time: 45s
Count of files identified via the command find <dir> | wc.
And I think that would be great do not go throw paths that are excluded from analyseAndScan. Because I saw such significant performance drop, just when I installed and compiled all node packages. But I am not able to exclude these themes because there are a lot of PHP files inside that should be checked via PHPStan.
I am encountering this with a package using orchestral/testbench. Testbench creates a symlink which phpstan then tries to resolve despite it being excluded, meaning stan is stuck:
@mvorisek I had not seen that issue, thanks for the link.
Yes, it is similar.
I'll happily help out by putting in a PR in if it is deemed necessary.
I have found a way to get around this for now with using neon, I separated out the file with my exclusions etc from the include/exclude paths in our package so we can include the core level and exclusions, but when we come across this issue again we can define include paths separately if we choose.
The thing that tripped me up here is that YAML can override the element (like excludePath) when it extends a file, but NEON will extend the element (so I can't overrule paths in a ruleset that extends it).
My solution for any of our repos that use testbench is an exception to using the full ruleset (phpstan.neon) but defining the filepaths (which will not catch new folders) by a local ruleset/CLi defined folders extending phpstan-rules.neon
Activity
mergeable commentedon Jul 1, 2023
This bug report is missing a link to reproduction at phpstan.org/try.
It will most likely be closed after manual review.
ondrejmirtes commentedon Jul 1, 2023
Use a different config, don't do
pathswith..I don't see anything actionable here. You'd need to create a project with the slow performance reproduced. It might be enough to create a project that has a few source files but that has many things in
vendor.renakdup commentedon Dec 5, 2023
I agree with mvorisek, we have the same issue on our WordPress platform.
We have a lot of themes and inside 30+ themes we have standalone node_modules directories and compiled_styles_dirs.
It's WordPress architecture and we could not to do something with it.
This is a part of my config:
It would be great if phpstan excludes directories from
analyseAndScandirectories when it goes throw bypathsdirectories.ondrejmirtes commentedon Dec 5, 2023
@renakdup Just to clarify - do you just have a performance problem? (please share the numbers), or are you seeking a change of behaviour when finding files? Thank you.
renakdup commentedon Dec 6, 2023
@ondrejmirtes, the first issue that I found is a performance issue. It was significantly noticeable when I switched to Mac M1. But then I found that excluding
themesdirectory from scanning can boot performance unbelievably!The
themesdirectory has 30+node_modulesinside you will see it in the config.I show real examples, all tests were run without PHPStan cache.
Tests on Mac M1:
Count of files: 802480
Time: I waited 10m 30s minutes to see the first percentages animation of the analysis, then the analyzer reached 100% and was completed by 11m 50s.
Count of files: 21806
Time: 1m 27s
Count of files: 802480
Time: 2m 30s
Count of files: 21806
Time: 45s
Count of files identified via the command
find <dir> | wc.Command:
phpstan analyse -c phpstan.neon --memory-limit 12GConfig:
And I think that would be great do not go throw paths that are excluded from
analyseAndScan. Because I saw such significant performance drop, just when I installed and compiled all node packages. But I am not able to exclude these themes because there are a lot of PHP files inside that should be checked via PHPStan.phily245 commentedon Jun 10, 2024
I am encountering this with a package using orchestral/testbench. Testbench creates a symlink which phpstan then tries to resolve despite it being excluded, meaning stan is stuck:
orchestral/testbench#369
ondrejmirtes commentedon Jun 10, 2024
@phily245 What is your project structure that you need to
../../..to reference paths?phily245 commentedon Jun 10, 2024
The phpstan.neon file is located at
vendor/providerName/packageName/larastan/phpstan.neon.The command I'm running at the package root is:
It is in the vendor folder so that I can normalise standards across all large set of repos with the same rules.
when I
cdto thephpstan.neon's folder and use thelscommand to view the paths, these are correctphily245 commentedon Jun 10, 2024
I have quickly pulled a repo together to demonstrate this issue:
https://github.com/phily245/phpstan-testbench-reproduction
mvorisek commentedon Jun 10, 2024
Isn't your issue more #10321?
phily245 commentedon Jun 11, 2024
@mvorisek I had not seen that issue, thanks for the link.
Yes, it is similar.
I'll happily help out by putting in a PR in if it is deemed necessary.
I have found a way to get around this for now with using neon, I separated out the file with my exclusions etc from the include/exclude paths in our package so we can include the core level and exclusions, but when we come across this issue again we can define include paths separately if we choose.
Core rules (phpstan-rules.neon):
Standard inclusion (phpstan.neon in the package):
The thing that tripped me up here is that YAML can override the element (like
excludePath) when it extends a file, but NEON will extend the element (so I can't overrule paths in a ruleset that extends it).My solution for any of our repos that use testbench is an exception to using the full ruleset (
phpstan.neon) but defining the filepaths (which will not catch new folders) by a local ruleset/CLi defined folders extendingphpstan-rules.neonmvorisek commentedon Jun 11, 2024
PR is definitely highly welcomed ❤