PHP-CS-Fixer PHP Interpreted Version Is Wrong
I have constantly been getting false positive code hints like the following:
Expected "Name\Space\string", got string
I initially thought this was a problem I'd encountered before, where a new workspace is always set to PHP 5.6 rather than the latest stable. However the project I am within is set to PHP 7.2.
I am experiencing this issue on both Windows 10 and Mac OSX.
After looking online it appears PHP-CS-Fixer is the source of this issue, as if it believes another PHP version is being used. However I have never touched this tools configuration, and so see no reason for it to within the last few months on two separate machines running completely different OS's decide to make my life a living hell.
My config in Lang/Frameworks > PHP > Quality Tools > PHP CS Fixer is:
- Configuration: Local
This has a warning of `(!) PHP CS Fixer path is empty for selected configuration`
Has anyone seen this issue before and is this the problem?
请先登录再写评论。
Please note that PHP-CS-Fixer is a code formatting checking tool, it does not analyze the types as it doesn't know a thing about them. What exactly made you think the issue is caused by it?
Generally, it looks like this notorious issue: https://youtrack.jetbrains.com/issue/WI-44945
What version are you using? Please upgrade to 2019.2 if you can and then invalidate the caches just in case.
Apologies, I was receiving the following from PHP-CS-Fixer:
Default value for parameters with a class type hint can only be NULL
Possibly makes sense that because PHPStorm was telling PHP-CS-Fixer that it was of type {object} and not string? I saw [this](https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/2546) which acted as if the above error was from PHP-CS-Fixer.
Updating to 2019.2 and invalidating caches/restarting has worked for now, so it seems that it is just PHPStorm thinking the wrong PHP version is being used again?