mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-26 12:52:36 +00:00
fix cs
This commit is contained in:
parent
5a898f593c
commit
6095a810ad
|
@ -70,7 +70,7 @@ CODE_SAMPLE
|
|||
}
|
||||
|
||||
/**
|
||||
* @param Node\Stmt\Class_ $node
|
||||
* @param Class_ $node
|
||||
*/
|
||||
public function refactor(Node $node): ?Node
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Rector\CodeQuality\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PHPStan\Type\StringType;
|
||||
use Rector\Rector\AbstractRector;
|
||||
|
@ -64,7 +65,7 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
$node->args[2] = new Node\Arg($this->createTrue());
|
||||
$node->args[2] = new Arg($this->createTrue());
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
|
|
@ -3,8 +3,10 @@
|
|||
namespace Rector\CodeQuality\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\BinaryOp\Identical;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use Rector\Rector\AbstractRector;
|
||||
use Rector\RectorDefinition\CodeSample;
|
||||
use Rector\RectorDefinition\RectorDefinition;
|
||||
|
@ -76,7 +78,7 @@ CODE_SAMPLE
|
|||
$variable = $node->right->args[0]->value;
|
||||
}
|
||||
|
||||
/** @var Node\Expr $variable */
|
||||
return new Identical($variable, new Node\Scalar\String_(''));
|
||||
/** @var Expr $variable */
|
||||
return new Identical($variable, new String_(''));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ final class NameTypeResolver implements PerNodeTypeResolverInterface
|
|||
return $class;
|
||||
}
|
||||
|
||||
/** @var Name|null $resolvedNameNode */
|
||||
$resolvedNameNode = $nameNode->getAttribute(AttributeKey::RESOLVED_NAME);
|
||||
if ($resolvedNameNode instanceof Name) {
|
||||
return $resolvedNameNode->toString();
|
||||
|
|
|
@ -6,6 +6,16 @@ use Nette\Utils\Strings;
|
|||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\AssignRef;
|
||||
use PhpParser\Node\Stmt\Echo_;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use PhpParser\Node\Stmt\Foreach_;
|
||||
use PhpParser\Node\Stmt\If_;
|
||||
use PhpParser\Node\Stmt\Nop;
|
||||
use PhpParser\Node\Stmt\Return_;
|
||||
use PhpParser\Node\Stmt\Static_;
|
||||
use PhpParser\Node\Stmt\Switch_;
|
||||
use PhpParser\Node\Stmt\Throw_;
|
||||
use PhpParser\Node\Stmt\While_;
|
||||
use Rector\BetterPhpDocParser\Attributes\Ast\PhpDoc\AttributeAwareVarTagValueNode;
|
||||
use Rector\NodeTypeResolver\PhpDoc\NodeAnalyzer\DocBlockManipulator;
|
||||
use Rector\PHPStan\Tests\Rector\Node\RemoveNonExistingVarAnnotationRector\RemoveNonExistingVarAnnotationRectorTest;
|
||||
|
@ -93,16 +103,16 @@ CODE_SAMPLE
|
|||
{
|
||||
return ! $node instanceof Assign
|
||||
&& ! $node instanceof AssignRef
|
||||
&& ! $node instanceof Node\Stmt\Foreach_
|
||||
&& ! $node instanceof Node\Stmt\Static_
|
||||
&& ! $node instanceof Node\Stmt\Echo_
|
||||
&& ! $node instanceof Node\Stmt\Return_
|
||||
&& ! $node instanceof Node\Stmt\Expression
|
||||
&& ! $node instanceof Node\Stmt\Throw_
|
||||
&& ! $node instanceof Node\Stmt\If_
|
||||
&& ! $node instanceof Node\Stmt\While_
|
||||
&& ! $node instanceof Node\Stmt\Switch_
|
||||
&& ! $node instanceof Node\Stmt\Nop;
|
||||
&& ! $node instanceof Foreach_
|
||||
&& ! $node instanceof Static_
|
||||
&& ! $node instanceof Echo_
|
||||
&& ! $node instanceof Return_
|
||||
&& ! $node instanceof Expression
|
||||
&& ! $node instanceof Throw_
|
||||
&& ! $node instanceof If_
|
||||
&& ! $node instanceof While_
|
||||
&& ! $node instanceof Switch_
|
||||
&& ! $node instanceof Nop;
|
||||
}
|
||||
|
||||
private function getVarTagVariableName(Node $node): ?string
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Rector\Php\Rector\FuncCall;
|
|||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Name;
|
||||
use Rector\Rector\AbstractRector;
|
||||
use Rector\RectorDefinition\CodeSample;
|
||||
use Rector\RectorDefinition\RectorDefinition;
|
||||
|
@ -63,7 +64,7 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
$node->name = new Node\Name('time');
|
||||
$node->name = new Name('time');
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Rector\TypeDeclaration\Rector\FunctionLike;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassLike;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
|
@ -153,7 +154,7 @@ CODE_SAMPLE
|
|||
$paramNode->type = $paramTypeInfo->getTypeNode();
|
||||
|
||||
// "resource" is valid phpdoc type, but it's not implemented in PHP
|
||||
if ($paramNode->type instanceof Node\Name && reset($paramNode->type->parts) === 'resource') {
|
||||
if ($paramNode->type instanceof Name && reset($paramNode->type->parts) === 'resource') {
|
||||
$paramNode->type = null;
|
||||
|
||||
continue;
|
||||
|
|
|
@ -17,5 +17,4 @@ parameters:
|
|||
php_version_features: '7.1'
|
||||
|
||||
services:
|
||||
Rector\PHPStan\Rector\Node\RemoveNonExistingVarAnnotationRector:
|
||||
# Rector\CodingStyle\Rector\Namespace_\ImportFullyQualifiedNamesRector: ~
|
||||
Rector\CodingStyle\Rector\Namespace_\ImportFullyQualifiedNamesRector: ~
|
||||
|
|
|
@ -264,7 +264,7 @@ final class ClassManipulator
|
|||
public function removeProperty(Class_ $class, string $propertyName): void
|
||||
{
|
||||
foreach ($class->stmts as $key => $classStmt) {
|
||||
if (! $classStmt instanceof Node\Stmt\Property) {
|
||||
if (! $classStmt instanceof Property) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user