- ๐ญ๐ฐHong Kong kt2ssh
I got the same problem and found the unexpected <?php tag from phpstan result.
- Status changed to Active
over 1 year ago 2:03pm 6 August 2023 - ๐ซ๐ทFrance fgm Paris, France
It looks like a similar problem I just met: I have a custom theme that extends a base theme but does not include a single line of PHP, so when running an upgrade_status 4.0 scan, I get this error
PHPStan command failed: /opt/homebrew/Cellar/php@8.1/8.1.21/bin/php /Users/fgm/src/OSInet/org/riff/blog/./vendor/bin/phpstan analyse --memory-limit=1500M --error-format=json --configuration=/tmp/upgrade_status/deprecation_testing.neon /Users/fgm/src/OSInet/org/riff/blog/web/themes/osinet/riffblogt Command output: Empty. Command error: ! [NOTE] No files found to analyse. [WARNING] This will cause a non-zero exit code in PHPStan 2.0.
Adding an almost empty (theme).theme file fixed the issue for me.
- ๐ญ๐บHungary Gรกbor Hojtsy Hungary
That there was no file found to analyse sounds like a legitimate problem. At least it does not say everything was ok because there was nothing to check if it was ok. I guess for themes that could be a realistic scenario that no PHP file was found, but it would only be reasonable for modules very rarely. Should we have a special case for this situation? We would still need to somehow surface that there was no file scanned, but maybe a nicer error handler for this case?
- ๐ซ๐ทFrance fgm Paris, France
I think one could imagine a module only consisting of libraries, so with a mymodule.libraries.yml and a bunch of CSS / JS files pointed by those, so no PHP code either.
That's probably not common but does not have to be an error. It's a bit similar to the "theme extends a base theme, only changing CSS / JS".
- ๐ญ๐บHungary Gรกbor Hojtsy Hungary
Let's focus this issue on the no files case then. The others don't seem to have more info on why they would happen.
- ๐ญ๐บHungary Gรกbor Hojtsy Hungary
However how we represent this situation is a question. That no file was found could be an error or it could be a legitimate thing to ignore. So we should IMHO report it, but maybe not as a raw error, but more like a warning level? It would still show it as one problem to resolve though, so those that want to make that go away would "need to" add an empty module file or somesuch for the error to go away. We can maybe discourage that in the message?
- ๐บ๐ธUnited States tobby
FWIW, I'm having the same issue. I've got a module with only
my_module.info.yml
andmy_module.libraries.yml
files, so I get the "No files found to analyse" warning. I created a temporarymy_module.module
file, and I was able to validate that the module is indeed D10-ready.I agree with Gรกbor -- maybe this "no file" issue can be a warning or even an info level. And place it in a "Compatible with next major Drupal core version (with caveats)" category instead of "Fix manually". My thinking is that a module with no executable code is technically compatible with Drupal 10...
- ๐ฎ๐ณIndia sahilgidwani Jaipur
- I am getting the error for PHP Stan command failed, as mentioned in the issue description, but not getting any error related to "No files found to analyse".
- When I debugged the analyze method of the DeprecationAnalyzer class, I found that the Process class is not returning output on line 373, and as a result, we are getting null in $json.
- Further, the condition check implemented for checking any JSON errors is returning true, and it is showing errors, although the PHP stan command is being executed successfully without any errors.
Anyone can please look into this and implement a solution to resolve the issue mentioned above.
- I am getting the error for PHP Stan command failed, as mentioned in the issue description, but not getting any error related to "No files found to analyse".