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

FileNotFound when using phpstan with BleedingEdge include #6915

Closed
simPod opened this issue Jan 5, 2022 · 3 comments
Closed

FileNotFound when using phpstan with BleedingEdge include #6915

simPod opened this issue Jan 5, 2022 · 3 comments
Labels

Comments

@simPod
Copy link

simPod commented Jan 5, 2022

Bug Report

Subject Details
Rector version fee8a47

Minimal PHP Code Causing Issue

$parameters->set(Option::PHPSTAN_FOR_RECTOR_PATH, getcwd() . '/phpstan.neon');

includes:
    - vendor/phpstan/phpstan/conf/bleedingEdge.neon

gives:

PHP Fatal error:  Uncaught _PHPStan_71572f9a1\Nette\FileNotFoundException: 
File 'phar://phpstan.phar/conf/bleedingEdge.neon' is missing or is not readable. in phar:///path/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Config/Loader.php:29
@simPod simPod added the bug label Jan 5, 2022
@TomasVotruba
Copy link
Member

TomasVotruba commented Jan 5, 2022

This option is configurable to be flexible and work around configuration that is used in PHPStan but not in Rector. Here phar paths in bleedingEdge.neon work only inside scope of PHAR. Sometimes PHPStan extensions remove static reflection, e.g. Symfony extension, and Rector cannot include it as it needs complete static reflection.

In this case, create own custom phpstan-for-rector.neon or remove vendor/phpstan/phpstan/conf/bleedingEdge.neon from phpstan.neon. I guess first option is better.

In ideal state, the phpstan-for-rector.neon should only include extensions so Rector can analyse types better.

See our custom PHPStan config to get the idea: https://github.com/rectorphp/rector-src/blob/main/phpstan-for-rector.neon

@simPod
Copy link
Author

simPod commented Jan 5, 2022

@TomasVotruba so it also ignores extensions that are installed via https://github.com/phpstan/extension-installer?

@TomasVotruba
Copy link
Member

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

2 participants