fix some errors reported by PhpStorm + Php Inspections (EA Ultimate)#2113
fix some errors reported by PhpStorm + Php Inspections (EA Ultimate)#2113voku wants to merge 7 commits intorectorphp:masterfrom
Conversation
|
Nice, those checks should be in Rector rules 👍 |
|
|
||
| // is suffix in the same category, e.g. "Exception/SomeException.php" | ||
| $expectedLocationFilePattern = sprintf('#\/%s\/.+%s#', preg_quote($groupName), preg_quote($suffixPattern)); | ||
| $expectedLocationFilePattern = sprintf('#\/%s\/.+%s#', preg_quote($groupName, '#'), preg_quote($suffixPattern, '#')); |
There was a problem hiding this comment.
@TomasVotruba Maybe the usage of "preg_quote" need to be checked in "ConsistentPregDelimiterRector"?
There was a problem hiding this comment.
Indeed. Care for PR to add it?
There was a problem hiding this comment.
It seems that "ConsistentPregDelimiterRector" will only work for simple strings without variables etc. So "preg_quote" is not effected, because it will not be replaced anyway, correct?
PS: I tried to debug some stuff but I don't know why I can't simply "var_dump" something in e.g. "ConsistentPregDelimiterRector"? My laptop will crash while running the phpunit tests, it also crash if I add a "exit(1)" after the "var_dump"? Is there a debug option or something like that?
e.g.:
if (! $arg->value instanceof String_) {
var_dump($arg); exit();
return;
}| } | ||
|
|
||
| if ($interfaceMethods !== []) { | ||
| $interfaceMethods = array_merge([], ...$interfaceMethods); |
There was a problem hiding this comment.
This is rather confusing, same variable is used for different array nesting
|
|
||
| if ($allTypes !== []) { | ||
| $allTypes = array_merge([], ...$allTypes); | ||
| } |
|
|
||
| if ($autoloadDirectories !== []) { | ||
| $autoloadDirectories = array_merge([], ...$autoloadDirectories); | ||
| } |
| $dataProviderClassMethods = $this->createDataProviderClassMethodsFromRecipes(); | ||
|
|
||
| $node->stmts = array_Merge($node->stmts, $dataProviderClassMethods); | ||
| $node->stmts = array_merge($node->stmts, $dataProviderClassMethods); |
|
|
||
| if ($collectedTypes !== []) { | ||
| $collectedTypes = array_merge([], ...$collectedTypes); | ||
| } |
| return array_unique($previousMethodCallNames); | ||
| if ($previousMethodCallNames !== []) { | ||
| $previousMethodCallNames = array_unique(array_merge([], ...$previousMethodCallNames)); | ||
| } |
|
|
||
| if ($absoluteDirectories !== []) { | ||
| $absoluteDirectories = array_merge([], ...$absoluteDirectories); | ||
| } |
|
|
||
| if ($declareNode) { | ||
| $nodes = array_merge([$declareNode], [$node]); | ||
| $nodes = [$declareNode, $node]; |
| $expectedLocationFilePattern = sprintf( | ||
| '#\/%s\/.+%s#', | ||
| preg_quote($groupName, '#'), | ||
| preg_quote($suffixPattern, '#') |
|
Integrated as Rector rules in:
Thanks for your PR, it helped to identify patterns and automate them, so you won't have to do it manually ever again 😄 |
This change is