Skip to content
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

[NodeTypeResolver] Handle crash PHPStan\File\CouldNotReadFileException: Could not read file on IntermediateSourceLocator #5438

Merged
merged 3 commits into from
Jan 6, 2024

Conversation

samsonasik
Copy link
Member

@samsonasik samsonasik commented Jan 6, 2024

Running phpunit on latest main, tested with composer update got error:

There were 6 errors:

1) Rector\Tests\Skipper\Skipper\SkipperTest::testSkipFilePath with data set #0 ('/Users/samsonasik/www/rector-...le.txt', false)
PHPStan\File\CouldNotReadFileException: Could not read file: /Users/samsonasik/www/rector-src/tests/PhpParser/Printer/CommentPreserving/Fixture/keep_multiline_single_asterisk.php

phar:///Users/samsonasik/www/rector-src/vendor/phpstan/phpstan/phpstan.phar/src/File/FileReader.php:20
phar:///Users/samsonasik/www/rector-src/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/SourceLocator/FileNodesFetcher.php:29
phar:///Users/samsonasik/www/rector-src/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocator.php:60
phar:///Users/samsonasik/www/rector-src/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/SourceLocator/Type/AggregateSourceLocator.php:26
/Users/samsonasik/www/rector-src/src/NodeTypeResolver/Reflection/BetterReflection/SourceLocator/IntermediateSourceLocator.php:26
phar:///Users/samsonasik/www/rector-src/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/SourceLocator/Type/AggregateSourceLocator.php:26
phar:///Users/samsonasik/www/rector-src/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/SourceLocator/Type/MemoizingSourceLocator.php:33
phar:///Users/samsonasik/www/rector-src/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/Reflector/DefaultReflector.php:32
phar:///Users/samsonasik/www/rector-src/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/Reflector/MemoizingReflector.php:45
phar:///Users/samsonasik/www/rector-src/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/BetterReflectionProvider.php:161
phar:///Users/samsonasik/www/rector-src/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/ReflectionProvider/MemoizingReflectionProvider.php:35
/Users/samsonasik/www/rector-src/src/Skipper/SkipVoter/ClassSkipVoter.php:27
/Users/samsonasik/www/rector-src/src/Skipper/Skipper/Skipper.php:47
/Users/samsonasik/www/rector-src/src/Skipper/Skipper/Skipper.php:41
/Users/samsonasik/www/rector-src/tests/Skipper/Skipper/SkipperTest.php:53

The try catch seems resolve it.

…n: Could not read file on IntermediateSourceLocator
@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba I am merging it ;)

@samsonasik samsonasik merged commit a8cc19a into main Jan 6, 2024
40 checks passed
@samsonasik samsonasik deleted the fix-phpstan-could-not-read branch January 6, 2024 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant