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

Clear cache after composer.lock change #3155

Open
greg0ire opened this issue Apr 15, 2020 · 10 comments
Open

Clear cache after composer.lock change #3155

greg0ire opened this issue Apr 15, 2020 · 10 comments
Labels

Comments

@greg0ire
Copy link
Contributor

Uncaught TypeError: Return value of PhpParser\Comment::getFilePos() must be of the type int, null returned in /home/greg/dev/doctrine-dbal/vendor/nikic/php-parser/lib/PhpParser/Comment.php:53
Stack trace:
#0 /home/greg/dev/doctrine-dbal/vendor/vimeo/psalm/src/Psalm/CodeLocation.php(131): PhpParser\Comment->getFilePos()
#1 /home/greg/dev/doctrine-dbal/vendor/vimeo/psalm/src/Psalm/Internal/PhpVisitor/ReflectorVisitor.php(947): Psalm\CodeLocation->__construct(Object(Psalm\Internal\Scanner\FileScanner), Object(PhpParser\Node\Stmt\Interface_))
#2 /home/greg/dev/doctrine-dbal/vendor/vimeo/psalm/src/Psalm/Internal/PhpVisitor/ReflectorVisitor.php(272): Psalm\Internal\PhpVisitor\ReflectorVisitor->registerClassLike(Object(PhpParser\Node\Stmt\Interface_))
#3 /home/greg/dev/doctrine-dbal/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(200): Psalm\Internal\PhpVisitor\ReflectorVisitor->enterNode(Object(PhpParser\Node\Stmt\Interface_))
#4 /home/greg/dev/doctrine-dbal/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(114): PhpParser\NodeTraverser->traverseArray(Array)
#5 /home/greg/dev/doctrine-dbal/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(223): PhpParser\NodeTraverser->traverseNode(Object(PhpParser\Node\Stmt\Namespace_))
#6 /home/greg/dev/doctrine-dbal/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(91): PhpParser\NodeTraverser->traverseArray(Array)
#7 /home/greg/dev/doctrine-dbal/vendor/vimeo/psalm/src/Psalm/Internal/Scanner/FileScanner.php(94): PhpParser\NodeTraverser->traverse(Array)
#8 /home/greg/dev/doctrine-dbal/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(586): Psalm\Internal\Scanner\FileScanner->scan(Object(Psalm\Codebase), Object(Psalm\Storage\FileStorage), false, Object(Psalm\Progress\DefaultProgress))
#9 /home/greg/dev/doctrine-dbal/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(367): Psalm\Internal\Codebase\Scanner->scanFile('/home/greg/dev/...', Array, true)
#10 /home/greg/dev/doctrine-dbal/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(475): Psalm\Internal\Codebase\Scanner->Psalm\Internal\Codebase\{closure}(0, '/home/greg/dev/...')
#11 /home/greg/dev/doctrine-dbal/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(325): Psalm\Internal\Codebase\Scanner->scanFilePaths(1)
#12 /home/greg/dev/doctrine-dbal/vendor/vimeo/psalm/src/Psalm/Codebase.php(477): Psalm\Internal\Codebase\Scanner->scanFiles(Object(Psalm\Internal\Codebase\ClassLikes), 3)
#13 /home/greg/dev/doctrine-dbal/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(519): Psalm\Codebase->scanFiles(3)
#14 /home/greg/dev/doctrine-dbal/vendor/vimeo/psalm/src/psalm.php(588): Psalm\Internal\Analyzer\ProjectAnalyzer->check('/home/greg/dev/...', false)
#15 /home/greg/dev/doctrine-dbal/vendor/vimeo/psalm/psalm(2): require_once('/home/greg/dev/...')
#16 {main}
(Psalm 3.11.2@d470903722cfcbc1cd04744c5491d3e6d13ec3d9 crashed due to an uncaught Throwable)

Note that upgrading to v4.4.0 fixes the issue

@psalm-github-bot
Copy link

Hey @greg0ire, can you reproduce the issue on https://psalm.dev ?

@greg0ire
Copy link
Contributor Author

Nope, sorry little bot

@muglug
Copy link
Collaborator

muglug commented Apr 15, 2020

I think this was fixed in the current release - do you still see it?

@weirdan
Copy link
Collaborator

weirdan commented Apr 16, 2020

@muglug Psalm 3.11.2@d470903722cfcbc1cd04744c5491d3e6d13ec3d9 (in the error message) is the current release as far as can tell.

@vasily-kartashov
Copy link

Try with --no-cache. Solved it for me.

@greg0ire
Copy link
Contributor Author

It must have to do with cache because it works after a reboot.

@YetiCGN
Copy link

YetiCGN commented Apr 24, 2020

@greg0ire Then, I believe, you can close the ticket. 😉

@greg0ire
Copy link
Contributor Author

I will let Matthew Brown decide on this, maybe there is something that needs to be fixed, like auto-cleaning the cache under some circumstances. Or maybe this will never happen again for some other reason and it can be closed, but since it happen to me and other people, I guess it could happen again to anyone.

@weirdan weirdan added the bug label Apr 26, 2020
@muglug muglug added the easy problems Issues that can be fixed without background knowledge of Psalm label Apr 26, 2020
@muglug
Copy link
Collaborator

muglug commented Apr 26, 2020

@zerkms this fits the bill of an easy problem to fix – the cache should clear whenever there's a lockfile change, but it appears not to be

@weirdan
Copy link
Collaborator

weirdan commented Apr 26, 2020

However multiple lockfiles may need to be considered when Psalm is installed globally (with composer global require vimeo/psalm).

@muglug muglug removed the easy problems Issues that can be fixed without background knowledge of Psalm label May 20, 2020
@orklah orklah changed the title Crash with nikic/php-parser 4.3.0 Clear cache after composer.lock change Oct 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants