-
-
Notifications
You must be signed in to change notification settings - Fork 947
Internal error: Cannot rename on Windows #12460
Copy link
Copy link
Closed
Description
Bug report
When switching branches, I often run into the following error when using PHPStan on Windows, which makes me have to rerun the PHPStan command a second time:
Internal error: Cannot rename "C:\Users\Mickverm\Documents\project\var\cache\dev\App982.tmp" to
"C:\Users\Mickverm\Documents\project/var/cache/dev/App_KernelDevDebugContainer.php.meta.json":
rename(C:\Users\Mickverm\Documents\project\var\cache\dev\App982.tmp,C:\Users\Mickverm\Documents\project/var/cache/dev/App_KernelDevDebugContainer.php.meta.json):
Access is denied (code: 5) while analysing file C:\Users\Mickverm\Documents\project\src\Controller\UserController.php
Run PHPStan with -v option and post the stack trace to:
https://github.com/phpstan/phpstan/issues/new?template=Bug_report.yaml
[ERROR] Found 7 errors
⚠️ Result is incomplete because of severe errors. ⚠️
Fix these errors first and then re-run PHPStan
to get all reported errors.
I'm not sure if this is related to PHPStan itself or phpstan-symfony, seeing as all errors occur in the /var/cache/dev directory of the Symfony project.
The issue is a little hard to reproduce since it doesn't always happen.
This looks similar to issues that can be found in the Rector and Symfony repositories:
- [Cache] use copy() instead of rename() on Windows symfony/symfony#57663
- [Windows] Utilize Nette\Utils\FileSystem instead of Symfony\Component\Filesystem\Filesystem to write file rectorphp/rector-src#5514
Code snippet that reproduces the problem
Not something we can reproduce on phpstan.org/try
Expected output
PHPStan runs first try without any severe errors.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels