Updated Rector to commit c621d7650d8ab4c9f051aff92ae20701436cd0fc

c621d7650d [TypeDeclaration] Add void upper inner function has return on ReturnTypeDeclarationRector (#1447)
This commit is contained in:
Tomas Votruba 2021-12-10 09:57:54 +00:00
parent 1fcfcc2a92
commit 058d52567d
1037 changed files with 3735 additions and 2488 deletions

View File

@ -43,7 +43,7 @@ final class DoctrineAnnotationTagValueNode extends \Rector\BetterPhpDocParser\Va
/**
* @param string[] $classNames
*/
public function hasClassNames(array $classNames) : bool
public function hasClassNames($classNames) : bool
{
foreach ($classNames as $className) {
if ($this->hasClassName($className)) {
@ -52,7 +52,10 @@ final class DoctrineAnnotationTagValueNode extends \Rector\BetterPhpDocParser\Va
}
return \false;
}
public function hasClassName(string $className) : bool
/**
* @param string $className
*/
public function hasClassName($className) : bool
{
$annotationName = \trim($this->identifierTypeNode->name, '@');
if ($annotationName === $className) {

View File

@ -20,7 +20,10 @@ final class ArrayTypePhpDocNodeVisitor extends \RectorPrefix20211210\Symplify\Si
{
$this->attributeMirrorer = $attributeMirrorer;
}
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function enterNode($node) : ?\PHPStan\PhpDocParser\Ast\Node
{
if (!$node instanceof \PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode) {
return null;

View File

@ -20,7 +20,10 @@ final class CallableTypePhpDocNodeVisitor extends \RectorPrefix20211210\Symplify
{
$this->attributeMirrorer = $attributeMirrorer;
}
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function enterNode($node) : ?\PHPStan\PhpDocParser\Ast\Node
{
if (!$node instanceof \PHPStan\PhpDocParser\Ast\Type\CallableTypeNode) {
return null;

View File

@ -12,11 +12,17 @@ final class ChangedPhpDocNodeVisitor extends \RectorPrefix20211210\Symplify\Simp
* @var bool
*/
private $hasChanged = \false;
public function beforeTraverse(\PHPStan\PhpDocParser\Ast\Node $node) : void
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function beforeTraverse($node) : void
{
$this->hasChanged = \false;
}
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function enterNode($node) : ?\PHPStan\PhpDocParser\Ast\Node
{
$origNode = $node->getAttribute(\Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey::ORIG_NODE);
if ($origNode === null) {

View File

@ -20,7 +20,10 @@ final class IntersectionTypeNodePhpDocNodeVisitor extends \RectorPrefix20211210\
{
$this->attributeMirrorer = $attributeMirrorer;
}
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function enterNode($node) : ?\PHPStan\PhpDocParser\Ast\Node
{
if (!$node instanceof \PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode) {
return null;

View File

@ -20,7 +20,10 @@ final class ParamPhpDocNodeVisitor extends \RectorPrefix20211210\Symplify\Simple
{
$this->attributeMirrorer = $attributeMirrorer;
}
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function enterNode($node) : ?\PHPStan\PhpDocParser\Ast\Node
{
if (!$node instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode) {
return null;

View File

@ -32,7 +32,10 @@ final class TemplatePhpDocNodeVisitor extends \RectorPrefix20211210\Symplify\Sim
$this->currentTokenIteratorProvider = $currentTokenIteratorProvider;
$this->attributeMirrorer = $attributeMirrorer;
}
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function enterNode($node) : ?\PHPStan\PhpDocParser\Ast\Node
{
if (!$node instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode) {
return null;

View File

@ -31,7 +31,10 @@ final class UnionTypeNodePhpDocNodeVisitor extends \RectorPrefix20211210\Symplif
$this->currentTokenIteratorProvider = $currentTokenIteratorProvider;
$this->attributeMirrorer = $attributeMirrorer;
}
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function enterNode($node) : ?\PHPStan\PhpDocParser\Ast\Node
{
if (!$node instanceof \PHPStan\PhpDocParser\Ast\Type\UnionTypeNode) {
return null;

View File

@ -47,7 +47,10 @@ abstract class AbstractValuesAwareNode implements \PHPStan\PhpDocParser\Ast\PhpD
$this->silentKey = $silentKey;
$this->originalValues = $values;
}
public function removeValue(string $key) : void
/**
* @param string $key
*/
public function removeValue($key) : void
{
$quotedKey = '"' . $key . '"';
// isset?
@ -80,8 +83,9 @@ abstract class AbstractValuesAwareNode implements \PHPStan\PhpDocParser\Ast\PhpD
}
/**
* @param mixed $value
* @param string $key
*/
public function changeValue(string $key, $value) : void
public function changeValue($key, $value) : void
{
// is quoted?
if (isset($this->values[$key]) && \is_string($this->values[$key]) && \Rector\Core\Util\StringUtils::isMatch($this->values[$key], self::UNQUOTED_VALUE_REGEX)) {
@ -178,7 +182,7 @@ abstract class AbstractValuesAwareNode implements \PHPStan\PhpDocParser\Ast\PhpD
* @param mixed[] $values
* @return array<int|string, mixed>
*/
protected function removeQuotesFromArray(array $values) : array
protected function removeQuotesFromArray($values) : array
{
$unquotedArray = [];
foreach ($values as $key => $value) {
@ -191,7 +195,7 @@ abstract class AbstractValuesAwareNode implements \PHPStan\PhpDocParser\Ast\PhpD
/**
* @param mixed[] $values
*/
protected function printValuesContent(array $values) : string
protected function printValuesContent($values) : string
{
$itemContents = '';
\end($values);

View File

@ -8,7 +8,10 @@ use PhpParser\NodeVisitorAbstract;
use Rector\NodeTypeResolver\Node\AttributeKey;
final class CommentRemovingNodeVisitor extends \PhpParser\NodeVisitorAbstract
{
public function enterNode(\PhpParser\Node $node) : \PhpParser\Node
/**
* @param \PhpParser\Node $node
*/
public function enterNode($node) : \PhpParser\Node
{
// the node must be cloned, so original node is not touched in final print
$clonedNode = clone $node;

View File

@ -14,7 +14,7 @@ interface NodeNameResolverInterface
*/
public function getNode() : string;
/**
* @param TNode $node
* @param \PhpParser\Node $node
*/
public function resolve(\PhpParser\Node $node) : ?string;
public function resolve($node) : ?string;
}

View File

@ -29,9 +29,9 @@ final class ClassConstFetchNameResolver implements \Rector\NodeNameResolver\Cont
return \PhpParser\Node\Expr\ClassConstFetch::class;
}
/**
* @param ClassConstFetch $node
* @param \PhpParser\Node $node
*/
public function resolve(\PhpParser\Node $node) : ?string
public function resolve($node) : ?string
{
$class = $this->nodeNameResolver->getName($node->class);
$name = $this->nodeNameResolver->getName($node->name);

View File

@ -29,9 +29,9 @@ final class ClassConstNameResolver implements \Rector\NodeNameResolver\Contract\
return \PhpParser\Node\Stmt\ClassConst::class;
}
/**
* @param ClassConst $node
* @param \PhpParser\Node $node
*/
public function resolve(\PhpParser\Node $node) : ?string
public function resolve($node) : ?string
{
if ($node->consts === []) {
return null;

View File

@ -30,9 +30,9 @@ final class ClassNameResolver implements \Rector\NodeNameResolver\Contract\NodeN
return \PhpParser\Node\Stmt\ClassLike::class;
}
/**
* @param ClassLike $node
* @param \PhpParser\Node $node
*/
public function resolve(\PhpParser\Node $node) : ?string
public function resolve($node) : ?string
{
if (\property_exists($node, 'namespacedName') && $node->namespacedName instanceof \PhpParser\Node\Name) {
return $node->namespacedName->toString();

View File

@ -16,9 +16,9 @@ final class EmptyNameResolver implements \Rector\NodeNameResolver\Contract\NodeN
return \PhpParser\Node\Expr\Empty_::class;
}
/**
* @param Empty_ $node
* @param \PhpParser\Node $node
*/
public function resolve(\PhpParser\Node $node) : ?string
public function resolve($node) : ?string
{
return 'empty';
}

View File

@ -32,9 +32,9 @@ final class FuncCallNameResolver implements \Rector\NodeNameResolver\Contract\No
* If some function is namespaced, it will be used over global one.
* But only if it really exists.
*
* @param FuncCall $node
* @param \PhpParser\Node $node
*/
public function resolve(\PhpParser\Node $node) : ?string
public function resolve($node) : ?string
{
if ($node->name instanceof \PhpParser\Node\Expr) {
return null;

View File

@ -18,9 +18,9 @@ final class FunctionNameResolver implements \Rector\NodeNameResolver\Contract\No
return \PhpParser\Node\Stmt\Function_::class;
}
/**
* @param Function_ $node
* @param \PhpParser\Node $node
*/
public function resolve(\PhpParser\Node $node) : ?string
public function resolve($node) : ?string
{
$bareName = (string) $node->name;
$scope = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE);

View File

@ -28,9 +28,9 @@ final class NameNameResolver implements \Rector\NodeNameResolver\Contract\NodeNa
return \PhpParser\Node\Name::class;
}
/**
* @param Name $node
* @param \PhpParser\Node $node
*/
public function resolve(\PhpParser\Node $node) : ?string
public function resolve($node) : ?string
{
// possible function parent
$parent = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE);

View File

@ -29,9 +29,9 @@ final class ParamNameResolver implements \Rector\NodeNameResolver\Contract\NodeN
return \PhpParser\Node\Param::class;
}
/**
* @param Param $node
* @param \PhpParser\Node $node
*/
public function resolve(\PhpParser\Node $node) : ?string
public function resolve($node) : ?string
{
return $this->nodeNameResolver->getName($node->var);
}

View File

@ -29,9 +29,9 @@ final class PropertyNameResolver implements \Rector\NodeNameResolver\Contract\No
return \PhpParser\Node\Stmt\Property::class;
}
/**
* @param Property $node
* @param \PhpParser\Node $node
*/
public function resolve(\PhpParser\Node $node) : ?string
public function resolve($node) : ?string
{
if ($node->props === []) {
return null;

View File

@ -29,9 +29,9 @@ final class UseNameResolver implements \Rector\NodeNameResolver\Contract\NodeNam
return \PhpParser\Node\Stmt\Use_::class;
}
/**
* @param Use_ $node
* @param \PhpParser\Node $node
*/
public function resolve(\PhpParser\Node $node) : ?string
public function resolve($node) : ?string
{
if ($node->uses === []) {
return null;

View File

@ -19,9 +19,9 @@ final class VariableNameResolver implements \Rector\NodeNameResolver\Contract\No
return \PhpParser\Node\Expr\Variable::class;
}
/**
* @param Variable $node
* @param \PhpParser\Node $node
*/
public function resolve(\PhpParser\Node $node) : ?string
public function resolve($node) : ?string
{
$parentNode = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE);
// skip $some->$dynamicMethodName()

View File

@ -15,8 +15,9 @@ final class FunctionLikeParamArgPositionNodeVisitor extends \PhpParser\NodeVisit
{
/**
* @return Node
* @param \PhpParser\Node $node
*/
public function enterNode(\PhpParser\Node $node) : ?\PhpParser\Node
public function enterNode($node) : ?\PhpParser\Node
{
if ($node instanceof \PhpParser\Node\FunctionLike) {
foreach ($node->getParams() as $position => $param) {

View File

@ -28,7 +28,7 @@ final class NamespaceNodeVisitor extends \PhpParser\NodeVisitorAbstract
* @param Node[] $nodes
* @return Node[]|null
*/
public function beforeTraverse(array $nodes) : ?array
public function beforeTraverse($nodes) : ?array
{
// init basic use nodes for non-namespaced code
/** @var Use_[] $uses */
@ -36,7 +36,10 @@ final class NamespaceNodeVisitor extends \PhpParser\NodeVisitorAbstract
$this->useNodes = $uses;
return null;
}
public function enterNode(\PhpParser\Node $node) : ?\PhpParser\Node
/**
* @param \PhpParser\Node $node
*/
public function enterNode($node) : ?\PhpParser\Node
{
if ($node instanceof \PhpParser\Node\Stmt\Namespace_) {
/** @var Use_[] $uses */

View File

@ -17,12 +17,15 @@ final class StatementNodeVisitor extends \PhpParser\NodeVisitorAbstract
* @param Node[] $nodes
* @return Node[]|null
*/
public function beforeTraverse(array $nodes) : ?array
public function beforeTraverse($nodes) : ?array
{
$this->previousStmt = null;
return null;
}
public function enterNode(\PhpParser\Node $node) : ?\PhpParser\Node
/**
* @param \PhpParser\Node $node
*/
public function enterNode($node) : ?\PhpParser\Node
{
$parent = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE);
if (!$parent instanceof \PhpParser\Node) {

View File

@ -36,7 +36,10 @@ final class RemoveDeepChainMethodCallNodeVisitor extends \PhpParser\NodeVisitorA
$this->betterNodeFinder = $betterNodeFinder;
$this->nestedChainMethodCallLimit = (int) $parameterProvider->provideParameter(\Rector\Core\Configuration\Option::NESTED_CHAIN_METHOD_CALL_LIMIT);
}
public function enterNode(\PhpParser\Node $node) : ?int
/**
* @param \PhpParser\Node $node
*/
public function enterNode($node) : ?int
{
if (!$node instanceof \PhpParser\Node\Stmt\Expression) {
return null;
@ -52,8 +55,9 @@ final class RemoveDeepChainMethodCallNodeVisitor extends \PhpParser\NodeVisitorA
}
/**
* @return \PhpParser\Node|\PhpParser\Node\Stmt\Nop
* @param \PhpParser\Node $node
*/
public function leaveNode(\PhpParser\Node $node)
public function leaveNode($node)
{
if ($node === $this->removingExpression) {
// keep any node, so we don't remove it permanently

View File

@ -36,13 +36,19 @@ final class ClassRenamePhpDocNodeVisitor extends \RectorPrefix20211210\Symplify\
$this->staticTypeMapper = $staticTypeMapper;
$this->currentNodeProvider = $currentNodeProvider;
}
public function beforeTraverse(\PHPStan\PhpDocParser\Ast\Node $node) : void
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function beforeTraverse($node) : void
{
if ($this->oldToNewTypes === []) {
throw new \Rector\Core\Exception\ShouldNotHappenException('Configure "$oldToNewClasses" first');
}
}
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function enterNode($node) : ?\PHPStan\PhpDocParser\Ast\Node
{
if (!$node instanceof \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode) {
return null;
@ -73,7 +79,7 @@ final class ClassRenamePhpDocNodeVisitor extends \RectorPrefix20211210\Symplify\
/**
* @param OldToNewType[] $oldToNewTypes
*/
public function setOldToNewTypes(array $oldToNewTypes) : void
public function setOldToNewTypes($oldToNewTypes) : void
{
$this->oldToNewTypes = $oldToNewTypes;
}

View File

@ -68,13 +68,19 @@ final class NameImportingPhpDocNodeVisitor extends \RectorPrefix20211210\Symplif
$this->currentFileProvider = $currentFileProvider;
$this->classLikeExistenceChecker = $classLikeExistenceChecker;
}
public function beforeTraverse(\PHPStan\PhpDocParser\Ast\Node $node) : void
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function beforeTraverse($node) : void
{
if ($this->currentPhpParserNode === null) {
throw new \Rector\Core\Exception\ShouldNotHappenException('Set "$currentPhpParserNode" first');
}
}
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function enterNode($node) : ?\PHPStan\PhpDocParser\Ast\Node
{
if ($node instanceof \Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode) {
return $this->enterSpacelessPhpDocTagNode($node);
@ -103,7 +109,10 @@ final class NameImportingPhpDocNodeVisitor extends \RectorPrefix20211210\Symplif
}
return $this->processFqnNameImport($this->currentPhpParserNode, $node, $staticType, $file);
}
public function setCurrentNode(\PhpParser\Node $phpParserNode) : void
/**
* @param PhpParserNode $phpParserNode
*/
public function setCurrentNode($phpParserNode) : void
{
$this->currentPhpParserNode = $phpParserNode;
}

View File

@ -30,7 +30,10 @@ final class UnderscoreRenamePhpDocNodeVisitor extends \RectorPrefix20211210\Symp
{
$this->staticTypeMapper = $staticTypeMapper;
}
public function beforeTraverse(\PHPStan\PhpDocParser\Ast\Node $node) : void
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function beforeTraverse($node) : void
{
if ($this->pseudoNamespaceToNamespace === null) {
throw new \Rector\Core\Exception\ShouldNotHappenException('Set PseudoNamespaceToNamespace first');
@ -39,7 +42,10 @@ final class UnderscoreRenamePhpDocNodeVisitor extends \RectorPrefix20211210\Symp
throw new \Rector\Core\Exception\ShouldNotHappenException('Set "$currentPhpParserNode" first');
}
}
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
/**
* @param \PHPStan\PhpDocParser\Ast\Node $node
*/
public function enterNode($node) : ?\PHPStan\PhpDocParser\Ast\Node
{
if (!$node instanceof \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode) {
return null;
@ -56,11 +62,17 @@ final class UnderscoreRenamePhpDocNodeVisitor extends \RectorPrefix20211210\Symp
$slashedName = '\\' . \RectorPrefix20211210\Nette\Utils\Strings::replace($staticType->getClassName(), '#_#', '\\');
return new \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode($slashedName);
}
public function setPseudoNamespaceToNamespace(\Rector\Renaming\ValueObject\PseudoNamespaceToNamespace $pseudoNamespaceToNamespace) : void
/**
* @param \Rector\Renaming\ValueObject\PseudoNamespaceToNamespace $pseudoNamespaceToNamespace
*/
public function setPseudoNamespaceToNamespace($pseudoNamespaceToNamespace) : void
{
$this->pseudoNamespaceToNamespace = $pseudoNamespaceToNamespace;
}
public function setCurrentPhpParserNode(\PhpParser\Node $node) : void
/**
* @param \PhpParser\Node $node
*/
public function setCurrentPhpParserNode($node) : void
{
$this->currentPhpParserNode = $node;
}

View File

@ -23,7 +23,11 @@ final class IntermediateSourceLocator implements \PHPStan\BetterReflection\Sourc
{
$this->sourceLocatorProviders = $sourceLocatorProviders;
}
public function locateIdentifier(\PHPStan\BetterReflection\Reflector\Reflector $reflector, \PHPStan\BetterReflection\Identifier\Identifier $identifier) : ?\PHPStan\BetterReflection\Reflection\Reflection
/**
* @param \PHPStan\BetterReflection\Reflector\Reflector $reflector
* @param \PHPStan\BetterReflection\Identifier\Identifier $identifier
*/
public function locateIdentifier($reflector, $identifier) : ?\PHPStan\BetterReflection\Reflection\Reflection
{
foreach ($this->sourceLocatorProviders as $sourceLocatorProvider) {
$sourceLocator = $sourceLocatorProvider->provide();
@ -37,8 +41,10 @@ final class IntermediateSourceLocator implements \PHPStan\BetterReflection\Sourc
/**
* Find all identifiers of a type
* @return Reflection[]
* @param \PHPStan\BetterReflection\Reflector\Reflector $reflector
* @param \PHPStan\BetterReflection\Identifier\IdentifierType $identifierType
*/
public function locateIdentifiersByType(\PHPStan\BetterReflection\Reflector\Reflector $reflector, \PHPStan\BetterReflection\Identifier\IdentifierType $identifierType) : array
public function locateIdentifiersByType($reflector, $identifierType) : array
{
foreach ($this->sourceLocatorProviders as $sourceLocatorProvider) {
$sourceLocator = $sourceLocatorProvider->provide();

View File

@ -30,7 +30,10 @@ final class ClassRenamingPostRector extends \Rector\PostRector\Rector\AbstractPo
// must be run before name importing, so new names are imported
return 650;
}
public function enterNode(\PhpParser\Node $node) : ?\PhpParser\Node
/**
* @param \PhpParser\Node $node
*/
public function enterNode($node) : ?\PhpParser\Node
{
$oldToNewClasses = $this->renamedClassesDataCollector->getOldToNewClasses();
if ($oldToNewClasses === []) {

View File

@ -71,7 +71,10 @@ final class NameImportingPostRector extends \Rector\PostRector\Rector\AbstractPo
$this->currentFileProvider = $currentFileProvider;
$this->betterNodeFinder = $betterNodeFinder;
}
public function enterNode(\PhpParser\Node $node) : ?\PhpParser\Node
/**
* @param \PhpParser\Node $node
*/
public function enterNode($node) : ?\PhpParser\Node
{
if (!$this->parameterProvider->provideBoolParameter(\Rector\Core\Configuration\Option::AUTO_IMPORT_NAMES)) {
return null;

View File

@ -35,8 +35,9 @@ final class NodeAddingPostRector extends \Rector\PostRector\Rector\AbstractPostR
}
/**
* @return mixed[]|\PhpParser\Node
* @param \PhpParser\Node $node
*/
public function leaveNode(\PhpParser\Node $node)
public function leaveNode($node)
{
$newNodes = [$node];
$nodesToAddAfter = $this->nodesToAddCollector->getNodesToAddAfterNode($node);

View File

@ -40,7 +40,10 @@ final class NodeRemovingPostRector extends \Rector\PostRector\Rector\AbstractPos
{
return 800;
}
public function enterNode(\PhpParser\Node $node) : ?\PhpParser\Node
/**
* @param \PhpParser\Node $node
*/
public function enterNode($node) : ?\PhpParser\Node
{
if (!$this->nodesToRemoveCollector->isActive()) {
return null;
@ -71,8 +74,9 @@ final class NodeRemovingPostRector extends \Rector\PostRector\Rector\AbstractPos
}
/**
* @return int|\PhpParser\Node
* @param \PhpParser\Node $node
*/
public function leaveNode(\PhpParser\Node $node)
public function leaveNode($node)
{
foreach ($this->nodesToRemoveCollector->getNodesToRemove() as $key => $nodeToRemove) {
$nodeToRemoveParent = $nodeToRemove->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE);

View File

@ -22,7 +22,10 @@ final class NodeToReplacePostRector extends \Rector\PostRector\Rector\AbstractPo
{
return 1100;
}
public function leaveNode(\PhpParser\Node $node) : ?\PhpParser\Node
/**
* @param \PhpParser\Node $node
*/
public function leaveNode($node) : ?\PhpParser\Node
{
foreach ($this->nodesToReplaceCollector->getNodes() as [$nodeToFind, $replacement]) {
if ($node === $nodeToFind) {

View File

@ -54,7 +54,10 @@ final class PropertyAddingPostRector extends \Rector\PostRector\Rector\AbstractP
{
return 900;
}
public function enterNode(\PhpParser\Node $node) : ?\PhpParser\Node
/**
* @param \PhpParser\Node $node
*/
public function enterNode($node) : ?\PhpParser\Node
{
if (!$node instanceof \PhpParser\Node\Stmt\Class_) {
return null;

View File

@ -67,7 +67,7 @@ final class UseAddingPostRector extends \Rector\PostRector\Rector\AbstractPostRe
* @param Stmt[] $nodes
* @return Stmt[]
*/
public function beforeTraverse(array $nodes) : ?array
public function beforeTraverse($nodes) : ?array
{
// no nodes → just return
if ($nodes === []) {

View File

@ -52,7 +52,10 @@ final class AliasedObjectType extends \PHPStan\Type\ObjectType
$use->type = \PhpParser\Node\Stmt\Use_::TYPE_FUNCTION;
return $use;
}
public function equals(\PHPStan\Type\Type $type) : bool
/**
* @param \PHPStan\Type\Type $type
*/
public function equals($type) : bool
{
// compare with FQN classes
if ($type instanceof \PHPStan\Type\TypeWithClassName) {

View File

@ -21,7 +21,10 @@ final class ShortenedGenericObjectType extends \PHPStan\Type\Generic\GenericObje
$this->fullyQualifiedName = $fullyQualifiedName;
parent::__construct($shortName, $types);
}
public function isSuperTypeOf(\PHPStan\Type\Type $type) : \PHPStan\TrinaryLogic
/**
* @param \PHPStan\Type\Type $type
*/
public function isSuperTypeOf($type) : \PHPStan\TrinaryLogic
{
$genericObjectType = new \PHPStan\Type\Generic\GenericObjectType($this->fullyQualifiedName, $this->getTypes());
return $genericObjectType->isSuperTypeOf($type);

View File

@ -21,7 +21,10 @@ final class ShortenedObjectType extends \PHPStan\Type\ObjectType
$this->fullyQualifiedName = $fullyQualifiedName;
parent::__construct($shortName);
}
public function isSuperTypeOf(\PHPStan\Type\Type $type) : \PHPStan\TrinaryLogic
/**
* @param \PHPStan\Type\Type $type
*/
public function isSuperTypeOf($type) : \PHPStan\TrinaryLogic
{
$fullyQualifiedObjectType = new \PHPStan\Type\ObjectType($this->fullyQualifiedName);
return $fullyQualifiedObjectType->isSuperTypeOf($type);

View File

@ -93,10 +93,10 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\MethodCall::class, \PhpParser\Node\Expr\StaticCall::class, \PhpParser\Node\Stmt\ClassMethod::class];
}
/**
* @param MethodCall|StaticCall|ClassMethod $node
* @param \PhpParser\Node $node
* @return \PhpParser\Node\Expr\MethodCall|\PhpParser\Node\Expr\StaticCall|\PhpParser\Node\Stmt\ClassMethod|null
*/
public function refactor(\PhpParser\Node $node)
public function refactor($node)
{
$this->haveArgumentsChanged = \false;
foreach ($this->addedArguments as $addedArgument) {
@ -116,7 +116,7 @@ CODE_SAMPLE
/**
* @param mixed[] $configuration
*/
public function configure(array $configuration) : void
public function configure($configuration) : void
{
$addedArguments = $configuration[self::ADDED_ARGUMENTS] ?? $configuration;
\RectorPrefix20211210\Webmozart\Assert\Assert::allIsAOf($addedArguments, \Rector\Arguments\ValueObject\ArgumentAdder::class);

View File

@ -57,10 +57,10 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\MethodCall::class, \PhpParser\Node\Expr\StaticCall::class, \PhpParser\Node\Stmt\ClassMethod::class];
}
/**
* @param MethodCall|StaticCall|ClassMethod $node
* @param \PhpParser\Node $node
* @return \PhpParser\Node\Expr\MethodCall|\PhpParser\Node\Expr\StaticCall|\PhpParser\Node\Stmt\ClassMethod
*/
public function refactor(\PhpParser\Node $node)
public function refactor($node)
{
foreach ($this->replacedArguments as $replacedArgument) {
if (!$this->nodeTypeResolver->isMethodStaticCallOrClassMethodObjectType($node, $replacedArgument->getObjectType())) {
@ -76,7 +76,7 @@ CODE_SAMPLE
/**
* @param mixed[] $configuration
*/
public function configure(array $configuration) : void
public function configure($configuration) : void
{
$replacedArguments = $configuration[self::REPLACED_ARGUMENTS] ?? $configuration;
\RectorPrefix20211210\Webmozart\Assert\Assert::isArray($replacedArguments);

View File

@ -56,9 +56,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\FuncCall::class];
}
/**
* @param FuncCall $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : \PhpParser\Node\Expr\FuncCall
public function refactor($node) : \PhpParser\Node\Expr\FuncCall
{
foreach ($this->replacedArguments as $replacedArgument) {
if (!$this->isName($node->name, $replacedArgument->getFunction())) {
@ -71,7 +71,7 @@ CODE_SAMPLE
/**
* @param mixed[] $configuration
*/
public function configure(array $configuration) : void
public function configure($configuration) : void
{
$replacedArguments = $configuration[self::REPLACED_ARGUMENTS] ?? $configuration;
\RectorPrefix20211210\Webmozart\Assert\Assert::allIsAOf($replacedArguments, \Rector\Arguments\ValueObject\ReplaceFuncCallArgumentDefaultValue::class);

View File

@ -60,9 +60,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\FuncCall::class];
}
/**
* @param FuncCall $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node\Expr\FuncCall
public function refactor($node) : ?\PhpParser\Node\Expr\FuncCall
{
$isJustSwapped = (bool) $node->getAttribute(self::JUST_SWAPPED, \false);
if ($isJustSwapped) {
@ -87,7 +87,7 @@ CODE_SAMPLE
/**
* @param mixed[] $configuration
*/
public function configure(array $configuration) : void
public function configure($configuration) : void
{
$functionArgumentSwaps = $configuration[self::FUNCTION_ARGUMENT_SWAPS] ?? $configuration;
\RectorPrefix20211210\Webmozart\Assert\Assert::allIsAOf($functionArgumentSwaps, \Rector\Arguments\ValueObject\SwapFuncCallArguments::class);

View File

@ -79,9 +79,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\Class_::class];
}
/**
* @param Class_ $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if (!$this->doctrineDocBlockResolver->isDoctrineEntityClass($node)) {
return null;

View File

@ -77,9 +77,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\Class_::class];
}
/**
* @param Class_ $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
$this->processGroupNamesBySuffix($this->file->getSmartFileInfo(), $this->groupNamesBySuffix);
return null;
@ -87,7 +87,7 @@ CODE_SAMPLE
/**
* @param mixed[] $configuration
*/
public function configure(array $configuration) : void
public function configure($configuration) : void
{
$groupNamesBySuffix = $configuration[self::GROUP_NAMES_BY_SUFFIX] ?? $configuration;
\RectorPrefix20211210\Webmozart\Assert\Assert::isArray($groupNamesBySuffix);

View File

@ -113,9 +113,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\Class_::class];
}
/**
* @param Class_ $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if (!$this->isValueObjectMatch($node)) {
return null;
@ -132,7 +132,7 @@ CODE_SAMPLE
/**
* @param mixed[] $configuration
*/
public function configure(array $configuration) : void
public function configure($configuration) : void
{
$types = $configuration[self::TYPES] ?? [];
\RectorPrefix20211210\Webmozart\Assert\Assert::isArray($types);

View File

@ -63,9 +63,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\Interface_::class];
}
/**
* @param Interface_ $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if ($this->netteComponentFactoryInterfaceAnalyzer->isComponentFactoryInterface($node)) {
return null;

View File

@ -79,9 +79,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\Array_::class];
}
/**
* @param Array_ $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
$arrayCallable = $this->arrayCallableMethodMatcher->match($node);
if (!$arrayCallable instanceof \Rector\NodeCollector\ValueObject\ArrayCallable) {

View File

@ -92,9 +92,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\Array_::class];
}
/**
* @param Array_ $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
$arrayCallable = $this->arrayCallableMethodMatcher->match($node);
if (!$arrayCallable instanceof \Rector\NodeCollector\ValueObject\ArrayCallable) {

View File

@ -36,9 +36,9 @@ final class CombinedAssignRector extends \Rector\Core\Rector\AbstractRector
return [\PhpParser\Node\Expr\Assign::class];
}
/**
* @param Assign $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if (!$node->expr instanceof \PhpParser\Node\Expr\BinaryOp) {
return null;

View File

@ -49,9 +49,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\Assign::class];
}
/**
* @param Assign $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if ($this->shouldSkip($node)) {
return null;

View File

@ -42,9 +42,9 @@ final class SimplifyEmptyArrayCheckRector extends \Rector\Core\Rector\AbstractRe
return [\PhpParser\Node\Expr\BinaryOp\BooleanAnd::class];
}
/**
* @param BooleanAnd $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
$twoNodeMatch = $this->binaryOpManipulator->matchFirstAndSecondConditionNode(
$node,

View File

@ -32,9 +32,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\BooleanNot::class];
}
/**
* @param BooleanNot $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
$depth = 0;
$expr = $node->expr;

View File

@ -47,9 +47,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\BooleanNot::class];
}
/**
* @param BooleanNot $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if (!$node->expr instanceof \PhpParser\Node\Expr\BinaryOp\BooleanOr) {
return null;

View File

@ -79,9 +79,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\Catch_::class];
}
/**
* @param Catch_ $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
$caughtThrowableVariable = $node->var;
if (!$caughtThrowableVariable instanceof \PhpParser\Node\Expr\Variable) {

View File

@ -103,9 +103,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\ClassMethod::class, \PhpParser\Node\Stmt\Property::class];
}
/**
* @param ClassMethod|Property $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if ($node instanceof \PhpParser\Node\Stmt\ClassMethod) {
return $this->refactorClassMethod($node);

View File

@ -60,9 +60,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\ClassMethod::class];
}
/**
* @param ClassMethod $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
$params = $node->getParams();

View File

@ -101,9 +101,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\Class_::class];
}
/**
* @param Class_ $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if ($this->shouldSkipClass($node)) {
return null;

View File

@ -54,9 +54,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\BinaryOp\Concat::class];
}
/**
* @param Concat $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
$this->nodeReplacementIsRestricted = \false;
if (!$this->isTopMostConcatNode($node)) {

View File

@ -47,10 +47,10 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\Do_::class];
}
/**
* @param Do_ $node
* @param \PhpParser\Node $node
* @return mixed[]|null
*/
public function refactor(\PhpParser\Node $node)
public function refactor($node)
{
if (!$this->valueResolver->isFalse($node->cond)) {
return null;

View File

@ -50,9 +50,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\BinaryOp\Equal::class, \PhpParser\Node\Expr\BinaryOp\NotEqual::class];
}
/**
* @param Equal|NotEqual $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
$leftStaticType = $this->getType($node->left);
$rightStaticType = $this->getType($node->right);

View File

@ -68,9 +68,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\Expression::class];
}
/**
* @param Expression $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if ($node->expr instanceof \PhpParser\Node\Expr\BinaryOp\BooleanAnd) {
return $this->processExplicitIf($node);

View File

@ -62,9 +62,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\For_::class];
}
/**
* @param For_ $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
$countInCond = null;
$variableName = null;

View File

@ -109,9 +109,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\For_::class];
}
/**
* @param For_ $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
$this->reset();
$this->matchInit($node->init);

View File

@ -72,9 +72,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\Foreach_::class];
}
/**
* @param Foreach_ $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if ($this->shouldSkip($node)) {
return null;

View File

@ -65,9 +65,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\Foreach_::class];
}
/**
* @param Foreach_ $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if ($this->shouldSkipForeach($node)) {
return null;

View File

@ -47,9 +47,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\Foreach_::class];
}
/**
* @param Foreach_ $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if ($this->shouldSkip($node)) {
return null;

View File

@ -63,9 +63,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\Foreach_::class];
}
/**
* @param Foreach_ $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
$this->return = null;
if ($node->keyVar === null) {

View File

@ -64,9 +64,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\Foreach_::class];
}
/**
* @param Foreach_ $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if ($node->keyVar === null) {
return null;

View File

@ -41,9 +41,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\FuncCall::class];
}
/**
* @param FuncCall $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if (!$this->isName($node, 'preg_quote')) {
return null;

View File

@ -48,9 +48,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\FuncCall::class];
}
/**
* @param FuncCall $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if (!$this->nodeNameResolver->isName($node, 'in_array')) {
return null;

View File

@ -56,9 +56,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\FuncCall::class];
}
/**
* @param FuncCall $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if (!$this->isName($node, 'array_merge')) {
return null;

View File

@ -58,9 +58,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\FuncCall::class];
}
/**
* @param FuncCall $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if (!$this->isName($node, 'call_user_func')) {
return null;

View File

@ -52,9 +52,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\FuncCall::class];
}
/**
* @param FuncCall $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if (!$this->isName($node, 'array_push')) {
return null;

View File

@ -83,9 +83,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\FuncCall::class];
}
/**
* @param FuncCall $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if (!$this->isName($node, 'compact')) {
return null;

View File

@ -37,9 +37,9 @@ final class InArrayAndArrayKeysToArrayKeyExistsRector extends \Rector\Core\Recto
return [\PhpParser\Node\Expr\FuncCall::class];
}
/**
* @param FuncCall $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if (!$this->isName($node, 'in_array')) {
return null;

View File

@ -47,9 +47,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\FuncCall::class];
}
/**
* @param FuncCall $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if (!$this->isName($node, 'intval')) {
return null;

View File

@ -45,9 +45,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\FuncCall::class];
}
/**
* @param FuncCall $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if (!$this->isName($node, 'is_a')) {
return null;

View File

@ -62,9 +62,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\FuncCall::class];
}
/**
* @param FuncCall $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if (!$this->isName($node, 'sprintf')) {
return null;

View File

@ -75,9 +75,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\FuncCall::class];
}
/**
* @param FuncCall $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if (!$this->isName($node, 'settype')) {
return null;

View File

@ -26,9 +26,9 @@ final class SimplifyFuncGetArgsCountRector extends \Rector\Core\Rector\AbstractR
return [\PhpParser\Node\Expr\FuncCall::class];
}
/**
* @param FuncCall $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if (!$this->isName($node, 'count')) {
return null;

View File

@ -26,9 +26,9 @@ final class SimplifyInArrayValuesRector extends \Rector\Core\Rector\AbstractRect
return [\PhpParser\Node\Expr\FuncCall::class];
}
/**
* @param FuncCall $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if (!$this->isName($node, 'in_array')) {
return null;

View File

@ -61,9 +61,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\FuncCall::class, \PhpParser\Node\Expr\StaticCall::class];
}
/**
* @param FuncCall|StaticCall $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
$patterns = $this->regexPatternArgumentManipulator->matchCallArgumentWithRegexPattern($node);
if ($patterns === []) {

View File

@ -27,9 +27,9 @@ final class SimplifyStrposLowerRector extends \Rector\Core\Rector\AbstractRector
return [\PhpParser\Node\Expr\FuncCall::class];
}
/**
* @param FuncCall $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if (!$this->isName($node, 'strpos')) {
return null;

View File

@ -52,9 +52,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\FuncCall::class];
}
/**
* @param FuncCall $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if (!$this->isName($node, 'in_array')) {
return null;

View File

@ -43,9 +43,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\FuncCall::class];
}
/**
* @param FuncCall $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if (!$this->isName($node, 'sprintf')) {
return null;

View File

@ -92,9 +92,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\ClassMethod::class, \PhpParser\Node\Expr\Closure::class];
}
/**
* @param ClassMethod|Closure $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if ($node->stmts === null) {
return null;

View File

@ -57,9 +57,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\BinaryOp\Identical::class, \PhpParser\Node\Expr\BooleanNot::class];
}
/**
* @param Identical|BooleanNot $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if ($node instanceof \PhpParser\Node\Expr\BinaryOp\Identical) {
return $this->processIdentical($node);

View File

@ -75,9 +75,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\BinaryOp\Identical::class];
}
/**
* @param Identical $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if (!$this->valueResolver->isNull($node->left) && !$this->valueResolver->isNull($node->right)) {
return null;

View File

@ -49,9 +49,9 @@ final class GetClassToInstanceOfRector extends \Rector\Core\Rector\AbstractRecto
return [\PhpParser\Node\Expr\BinaryOp\Identical::class, \PhpParser\Node\Expr\BinaryOp\NotIdentical::class];
}
/**
* @param Identical|NotIdentical $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
$twoNodeMatch = $this->binaryOpManipulator->matchFirstAndSecondConditionNode($node, function (\PhpParser\Node $node) : bool {
return $this->isClassReference($node);

View File

@ -39,9 +39,9 @@ final class SimplifyArraySearchRector extends \Rector\Core\Rector\AbstractRector
return [\PhpParser\Node\Expr\BinaryOp\Identical::class, \PhpParser\Node\Expr\BinaryOp\NotIdentical::class];
}
/**
* @param Identical|NotIdentical $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
$twoNodeMatch = $this->binaryOpManipulator->matchFirstAndSecondConditionNode($node, function (\PhpParser\Node $node) : bool {
if (!$node instanceof \PhpParser\Node\Expr\FuncCall) {

View File

@ -49,9 +49,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\BinaryOp\Identical::class, \PhpParser\Node\Expr\BinaryOp\NotIdentical::class];
}
/**
* @param Identical|NotIdentical $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
$leftType = $this->getType($node->left);
if ($leftType instanceof \PHPStan\Type\BooleanType && !$this->valueResolver->isTrueOrFalse($node->left)) {

View File

@ -47,9 +47,9 @@ final class SimplifyConditionsRector extends \Rector\Core\Rector\AbstractRector
return [\PhpParser\Node\Expr\BooleanNot::class, \PhpParser\Node\Expr\BinaryOp\Identical::class];
}
/**
* @param BooleanNot|Identical $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if ($node instanceof \PhpParser\Node\Expr\BooleanNot) {
return $this->processBooleanNot($node);

View File

@ -58,9 +58,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Expr\BinaryOp\Identical::class];
}
/**
* @param Identical $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if ($node->left instanceof \PhpParser\Node\Expr\FuncCall) {
return $this->processIdentical($node->right, $node->left);

View File

@ -62,9 +62,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\If_::class];
}
/**
* @param If_ $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if ($this->shouldSkip($node)) {
return null;

View File

@ -75,9 +75,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\If_::class];
}
/**
* @param If_ $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
$this->reset();
$currentNode = $node;

View File

@ -93,9 +93,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\If_::class, \PhpParser\Node\Stmt\ElseIf_::class, \PhpParser\Node\Expr\Ternary::class];
}
/**
* @param If_|ElseIf_|Ternary $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
// skip short ternary
if ($node instanceof \PhpParser\Node\Expr\Ternary && $node->if === null) {

View File

@ -55,9 +55,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\If_::class];
}
/**
* @param If_ $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
return $this->shortenElseIf($node);
}

View File

@ -57,9 +57,9 @@ CODE_SAMPLE
return [\PhpParser\Node\Stmt\If_::class];
}
/**
* @param If_ $node
* @param \PhpParser\Node $node
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
public function refactor($node) : ?\PhpParser\Node
{
if ($node->else === null) {
return null;

Some files were not shown because too many files have changed in this diff Show More