Closed andycowan closed 2 years ago
if I remove the larastan include from phpstan.neon, phpstan runs to completion
That is the key.
Thank you!
Please consider reading https://github.com/phpstan/phpstan/discussions/5124
There may be a die
in your code. Honestly I do not understand the above discussion :(
Thanks for reply - I have a phpcs rule in place that prevents those getting into a commit.
Just checked anyway, for dd
and die
and can confirm none present.
Have you tried running a single process?
parameters:
parallel:
maximumNumberOfProcesses: 1
--debug
turns off parallel processes and the result cache.
But I've tried it, just in case, and same result.
It should also print a stacktrace on an internal error...
It should also print a stacktrace on an internal error...
Do you have xdebug enabled?
Xdebug is enabled in php (as shown in the PHP version above), but phpstan automatically disables it.
Interestingly, running phpstan with xdebug on using the --xdebug
option produces
Note: Using configuration file /Users/andrew/PS/Code/mother/phpstan.neon.
PHPStan crashed in the previous run probably because of excessive memory consumption.
/Users/andrew/PS/Code/mother/app/Mixins/FindByHashIdMixin.php
[1] 67754 segmentation fault vendor/bin/phpstan analyze --no-progress --debug --xdebug
A segfault.
Just for fun's sake - I reran that using php8.0
No error, runs to completion.
How about raising memory limit?
vendor/bin/phpstan analyze --no-progress --debug --xdebug --memory-limit 2G
Yeah, that was my first attempt at solving it. No change.
➜ mother git:(trev-projector) ✗ vendor/bin/phpstan analyze --no-progress --debug --xdebug --memory-limit 2G
Note: Using configuration file /Users/andrew/PS/Code/mother/phpstan.neon.
/Users/andrew/PS/Code/mother/app/Mixins/FindByHashIdMixin.php
[1] 71179 segmentation fault vendor/bin/phpstan analyze --no-progress --debug --xdebug --memory-limit 2G
All I can think of is asking help from @ondrejmirtes
I think it might be this: https://bugs.php.net/bug.php?id=81630 (fixed today, try to build the latest PHP commit)
Otherwise there is very little information. It'd be nice to configure your error handler (display errors?) so that we can see more.
Hi Ondřej - thanks for joining in.
Are you referring to php's display_errors? Or is there a phpstan setting I need to tweak?
Maybe Laravel's error handler.
I had the same problem with this one.
I agree with @andycowan so I just updated my php8.1 from PHP 8.1.0RC5-dev
to PHP 8.1.0-dev
I think it might be this: https://bugs.php.net/bug.php?id=81630 (fixed today, try to build the latest PHP commit)
Otherwise there is very little information. It'd be nice to configure your error handler (display errors?) so that we can see more.
Updated PHP 8.1 to the overnight (from homebrew using shimamathur/php@8.1) - note the build date
PHP 8.1.0-dev (cli) (built: Nov 18 2021 00:35:21) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.0-dev, Copyright (c) Zend Technologies
with Xdebug v3.1.1, Copyright (c) 2002-2021, by Derick Rethans
with Zend OPcache v8.1.0-dev, Copyright (c), by Zend Technologies
phpstan now working as expected! Thanks for the help everyone
--level
used: 5Description
With php 8.0
With php 8.1
If I enable debug mode on phpstan, I get the following
I'm fully aware that this is not enough detail to diagnose the problem, but I'm asking for help collecting whatever you need.
However, removing/excluding that file just then repeats the problem for another file.
I've tried changing the level, which made no difference, and I've tried lengthening the parallel.processTimeout parameter - again with no change.
But, if I remove the larastan include from phpstan.neon, phpstan runs to completion - albeit with a pile of errors it now finds because of laravel's magic.