Return empty array instead of null

This commit is contained in:
Gabriel Caruso 2018-01-18 19:46:27 -02:00
parent 022e74c999
commit 84eb4a0225
2 changed files with 6 additions and 7 deletions

View File

@ -16,7 +16,6 @@ parameters:
- '#Method Rector\\Node\\NodeFactory::createNamespace\(\) should return PhpParser\\Node\\Stmt\\Namespace_ but returns PhpParser\\Node#' # 1
- '#Calling method getText\(\) on possibly null value of type PhpParser\\Comment\\Doc\|null#' # 3
- '#Calling method getParentClassNames\(\) on possibly null value of type Rector\\BetterReflection\\Reflection\\ReflectionClass\|null#' # 1
- '#Argument of an invalid type array(?:<array>)\|null supplied for foreach, only iterables are supported#' # 1
- '#Parameter \#2 \$name of class PhpParser\\Node\\Expr\\PropertyFetch constructor expects PhpParser\\Node\\Expr|string, PhpParser\\Node\\Identifier given#' # 2
- '#Instanceof between PhpParser\\Node\\Expr\|string and PhpParser\\Node\\Identifier will always evaluate to false#' # 8
- '#PHPDoc tag @param for parameter \$classLikeNode with type PhpParser\\Builder\\Trait_\|PhpParser\\Node\\Stmt\\Class_\|PhpParser\\Node\\Stmt#' # 1

View File

@ -29,9 +29,9 @@ final class ArgumentReplacerRector extends AbstractRector
private $methodCallAnalyzer;
/**
* @var mixed[][]|null
* @var mixed[][]
*/
private $activeArgumentChangesByPosition;
private $activeArgumentChangesByPosition = [];
/**
* @var ClassMethodAnalyzer
@ -108,12 +108,12 @@ final class ArgumentReplacerRector extends AbstractRector
}
/**
* @return mixed[][]|null
* @return mixed[][]
*/
private function matchArgumentChanges(Node $node): ?array
private function matchArgumentChanges(Node $node): array
{
if (! $node instanceof ClassMethod && ! $node instanceof MethodCall && ! $node instanceof StaticCall) {
return null;
return [];
}
foreach ($this->argumentChangesMethodAndClass as $type => $argumentChangesByMethod) {
@ -126,7 +126,7 @@ final class ArgumentReplacerRector extends AbstractRector
}
}
return null;
return [];
}
/**