-
-
Notifications
You must be signed in to change notification settings - Fork 739
fix some errors reported by PhpStorm + Php Inspections (EA Ultimate) #2113
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
Changes from all commits
e764111
03c41e7
af387c1
94db11b
341f291
454d0ae
07246d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,7 +101,11 @@ private function filterOutInterfaceRequiredMethods(Class_ $class, array $unusedM | |
|
|
||
| $interfaceMethods = []; | ||
| foreach ($interfaces as $interface) { | ||
| $interfaceMethods = array_merge($interfaceMethods, get_class_methods($interface)); | ||
| $interfaceMethods[] = get_class_methods($interface); | ||
| } | ||
|
|
||
| if ($interfaceMethods !== []) { | ||
| $interfaceMethods = array_merge([], ...$interfaceMethods); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is rather confusing, same variable is used for different array nesting |
||
| } | ||
|
|
||
| return array_diff($unusedMethods, $interfaceMethods); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -710,13 +710,14 @@ private function unionWithParentClassesInterfacesAndUsedTraits(Type $type): Type | |
|
|
||
| $classReflection = $this->broker->getClass($unionedType->getClassName()); | ||
|
|
||
| $allTypes = array_merge( | ||
| $allTypes, | ||
| $this->classReflectionTypesResolver->resolve($classReflection) | ||
| ); | ||
| $allTypes[] = $this->classReflectionTypesResolver->resolve($classReflection); | ||
| } | ||
| } | ||
|
|
||
| if ($allTypes !== []) { | ||
| $allTypes = array_merge([], ...$allTypes); | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
|
|
||
| return $this->typeFactory->createObjectTypeOrUnionType($allTypes); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,7 +41,11 @@ public function provide(): array | |
| } | ||
|
|
||
| $sectionDirectories = $this->collectDirectoriesFromAutoload($composerJson[$autoloadSection]); | ||
| $autoloadDirectories = array_merge($autoloadDirectories, $sectionDirectories); | ||
| $autoloadDirectories[] = $sectionDirectories; | ||
| } | ||
|
|
||
| if ($autoloadDirectories !== []) { | ||
| $autoloadDirectories = array_merge([], ...$autoloadDirectories); | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
|
|
||
| return $autoloadDirectories; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -200,7 +200,7 @@ public function refactor(Node $node): ?Node | |
|
|
||
| $dataProviderClassMethods = $this->createDataProviderClassMethodsFromRecipes(); | ||
|
|
||
| $node->stmts = array_Merge($node->stmts, $dataProviderClassMethods); | ||
| $node->stmts = array_merge($node->stmts, $dataProviderClassMethods); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
|
||
| return $node; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,7 +104,11 @@ private function collectTypesFromCatchedByIds(TryCatch $tryCatch, array $keys): | |
| $collectedTypes = []; | ||
|
|
||
| foreach ($keys as $key) { | ||
| $collectedTypes = array_merge($collectedTypes, $tryCatch->catches[$key]->types); | ||
| $collectedTypes[] = $tryCatch->catches[$key]->types; | ||
| } | ||
|
|
||
| if ($collectedTypes !== []) { | ||
| $collectedTypes = array_merge([], ...$collectedTypes); | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
|
|
||
| return $collectedTypes; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -116,13 +116,16 @@ private function findMethodCallNamesOnVariable(Variable $variable): array | |
| $previousMethodCallNames = []; | ||
|
|
||
| do { | ||
| $methodCallNames = $this->collectMethodCallsOnVariableName($parentNode, $variableName); | ||
| $previousMethodCallNames = array_merge($previousMethodCallNames, $methodCallNames); | ||
| $previousMethodCallNames[] = $this->collectMethodCallsOnVariableName($parentNode, $variableName); | ||
|
|
||
| $parentNode = $parentNode->getAttribute(AttributeKey::PARENT_NODE); | ||
| } while ($parentNode instanceof Node && ! $parentNode instanceof FunctionLike); | ||
|
|
||
| return array_unique($previousMethodCallNames); | ||
| if ($previousMethodCallNames !== []) { | ||
| $previousMethodCallNames = array_unique(array_merge([], ...$previousMethodCallNames)); | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
|
|
||
| return $previousMethodCallNames; | ||
| } | ||
|
|
||
| /** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,13 +18,20 @@ public function resolveDirectoriesWithFnmatch(array $directories): array | |
| $absoluteDirectories = []; | ||
| foreach ($directories as $directory) { | ||
| if (Strings::contains($directory, '*')) { // is fnmatch for directories | ||
| $absoluteDirectories = array_merge($absoluteDirectories, glob($directory, GLOB_ONLYDIR)); | ||
| $globDirectory = glob($directory, GLOB_ONLYDIR); | ||
| if ($globDirectory !== false) { | ||
| $absoluteDirectories[] = $globDirectory; | ||
| } | ||
| } else { // is classic directory | ||
| $this->ensureDirectoryExists($directory); | ||
| $absoluteDirectories[] = $directory; | ||
| $absoluteDirectories[] = [$directory]; | ||
| } | ||
| } | ||
|
|
||
| if ($absoluteDirectories !== []) { | ||
| $absoluteDirectories = array_merge([], ...$absoluteDirectories); | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
|
|
||
| return $absoluteDirectories; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -214,7 +214,7 @@ private function processNodesWithoutNamespace(array $nodes, SmartFileInfo $smart | |
| $fileDestination = $this->createClassLikeFileDestination($node, $smartFileInfo); | ||
|
|
||
| if ($declareNode) { | ||
| $nodes = array_merge([$declareNode], [$node]); | ||
| $nodes = [$declareNode, $node]; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good one, let's make a Rector from this: |
||
| } else { | ||
| $nodes = [$node]; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍