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
Uncaught UnexpectedValueException on psalm --init #5013
Comments
Hey @wnedoe, can you reproduce the issue on https://psalm.dev ? |
Of yourse not, dear bot. ;-) |
Can you reproduce in a separate public repo? |
When i run it in the repo vendor\verot\class.upload.php where the error occurs, then the --init works perfectly. mybe my composer.json has a problem? This is the content of it: `{ "config": {
}, |
I run --debug and have a suspicion: The exception happens at the processing of vendor/installed.php **and here it MOST PROBABLY parses the directory verot/class.upload.php as a file and then the file parsing throws that exeption.**
############################### |
:o There is actually a repo name No surprise Psalm was confused. This is probably coming from the module that detects php files to analyze. This should be pretty simple to fix by looking at the stack trace and adding a is_file() check somewhere... Do you mind pushing a PR? |
I believe this issue may be resolved now as I've done the following steps without the Exception being thrown.
|
I think the error was in a repo using verot/class.upload.php, not in the repo itself, as the author said earlier "When i run it in the repo vendor\verot\class.upload.php where the error occurs, then the --init works perfectly." But yeah, I'll close this anyway. It should be easy to ignore this directory in config while it may take a lot of resources in Psalm to check that every .php is indeed a file and not a directory |
When trying to run the init psalm crashes :-(
windows 10 php 7.4.13
Calculating best config level based on project files
Calculating best config level based on project files
Scanning files...
Uncaught UnexpectedValueException: File Z:\www.example.com\vendor\verot\class.upload.php is a directory in Z:\www.example.com\vendor\vimeo\psalm\src\Psalm\Internal\Provider\FileProvider.php:39
Stack trace:
#0 Z:\www.example.com\vendor\vimeo\psalm\src\Psalm\Internal\Codebase\Scanner.php(547): Psalm\Internal\Provider\FileProvider->getContents('Z:\www.terraris...')
#1 Z:\www.example.com\vendor\vimeo\psalm\src\Psalm\Internal\Codebase\Scanner.php(321): Psalm\Internal\Codebase\Scanner->scanFile('Z:\www.terraris...', Array, true)
#2 Z:\www.example.com\vendor\vimeo\psalm\src\Psalm\Internal\Codebase\Scanner.php(433): Psalm\Internal\Codebase\Scanner->Psalm\Internal\Codebase{closure}(548, 'Z:\www.terraris...')
#3 Z:\www.example.com\vendor\vimeo\psalm\src\Psalm\Internal\Codebase\Scanner.php(285): Psalm\Internal\Codebase\Scanner->scanFilePaths(1)
#4 Z:\www.example.com\vendor\vimeo\psalm\src\Psalm\Codebase.php(463): Psalm\Internal\Codebase\Scanner->scanFiles(Object(Psalm\Internal\Codebase\ClassLikes), 1)
#5 Z:\www.example.com\vendor\vimeo\psalm\src\Psalm\Internal\Analyzer\ProjectAnalyzer.php(588): Psalm\Codebase->scanFiles(1)
#6 Z:\www.example.com\vendor\vimeo\psalm\src\psalm.php(676): Psalm\Internal\Analyzer\ProjectAnalyzer->check('Z:\www.terraris...', true)
#7 Z:\www.example.com\vendor\vimeo\psalm\psalm(2): require_once('Z:\www.terraris...')
#8 {main}
(Psalm 4.4.0@ef4afd72bca50a0aff61599d3e433c9ee64287ac crashed due to an uncaught Throwable)
The text was updated successfully, but these errors were encountered: