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
Process error in just one file of 756 files: Name cannot be empty while analysing file /path/to/file/file.php #10867
Comments
This bug report is missing a link to reproduction at phpstan.org/try. It will most likely be closed after manual review. |
Please reproduce the issue with a minimal code snippet. |
My file has PHP and HTML in the same file, trying to reduce the code and testing, I managed to get to this minimum piece of code to analyze. https://phpstan.org/r/1b2b6ea3-65d6-4ba1-8a6e-bf82a013b137 Apparently the problem is in the constant() method, because removing the method, the file will run succesfully. Edit: Doing some tests here, I found another information about the problem, the method only causes problems if used with a variable. Edit2: another file having the constant($variable) method used don't show any errors, it's just with this specific code snippet. |
So there's a case where your code runs with |
It's not exactly on purpose, it's legacy code with a lot of old and incorrect implementations, I figured PHPStan would mention the problem to fix it, but this is breaking PHPStan itself. The code was much larger, this is just a small part of the code to reproduce the error. This $sysERR variable can be changed in the middle of the code, so it is not exactly empty, the empty is just the first initialization of the variable and even then PHPStan is breaking. |
Bug report
My application has 756 files, but only one of them is generating this error, excluding the file from analysis, PHPStan runs normally.
Follow the error and image:
The image is running just the file with PHPStan!
Code snippet that reproduces the problem
No response
Expected output
The file should be analyzed and errors printed on the terminal!
Did PHPStan help you today? Did it make you happy in any way?
No response
The text was updated successfully, but these errors were encountered: