mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 05:48:21 +01:00
fix cs
This commit is contained in:
parent
9e0d83fdff
commit
25258e1028
@ -10,6 +10,7 @@ use PhpParser\Node\Expr\Closure;
|
||||
use PhpParser\Node\Expr\ClosureUse;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Return_;
|
||||
use Rector\NodeContainer\ParsedNodesByType;
|
||||
@ -88,7 +89,7 @@ CODE_SAMPLE
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Node\Expr\Array_ $node
|
||||
* @param Array_ $node
|
||||
*/
|
||||
public function refactor(Node $node): ?Node
|
||||
{
|
||||
@ -126,8 +127,8 @@ CODE_SAMPLE
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Node\Param[] $params
|
||||
* @return Node\Arg[]
|
||||
* @param Param[] $params
|
||||
* @return Arg[]
|
||||
*/
|
||||
private function convertParamsToArgs(array $params): array
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ CODE_SAMPLE
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Identical|Node\Expr\BooleanNot $node
|
||||
* @param Identical|BooleanNot $node
|
||||
*/
|
||||
public function refactor(Node $node): ?Node
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ namespace Rector\Nette\Rector\Identical;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\BinaryOp\Identical;
|
||||
use PhpParser\Node\Expr\BinaryOp\NotIdentical;
|
||||
use PhpParser\Node\Expr\BooleanNot;
|
||||
@ -95,7 +96,7 @@ CODE_SAMPLE
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Node\Expr[]|null
|
||||
* @return Expr[]|null
|
||||
*/
|
||||
private function matchContentAndNeedleOfSubstrOfVariableLength(Node $node, Variable $variable): ?array
|
||||
{
|
||||
@ -111,7 +112,7 @@ CODE_SAMPLE
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Node\Expr\UnaryMinus $unaryMinus */
|
||||
/** @var UnaryMinus $unaryMinus */
|
||||
$unaryMinus = $node->args[1]->value;
|
||||
|
||||
if (! $unaryMinus->expr instanceof FuncCall) {
|
||||
@ -122,7 +123,7 @@ CODE_SAMPLE
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Node\Expr\FuncCall $strlenFuncCall */
|
||||
/** @var FuncCall $strlenFuncCall */
|
||||
$strlenFuncCall = $unaryMinus->expr;
|
||||
|
||||
if ($this->areNodesEqual($strlenFuncCall->args[0]->value, $variable)) {
|
||||
|
@ -4,6 +4,7 @@ namespace Rector\Nette\Rector\Identical;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\BinaryOp\Identical;
|
||||
use PhpParser\Node\Expr\BinaryOp\NotIdentical;
|
||||
use PhpParser\Node\Expr\BooleanNot;
|
||||
@ -94,7 +95,7 @@ CODE_SAMPLE
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Node\Expr[]|null
|
||||
* @return Expr[]|null
|
||||
*/
|
||||
private function matchContentAndNeedleOfSubstrOfVariableLength(Node $node, Variable $variable): ?array
|
||||
{
|
||||
@ -121,7 +122,7 @@ CODE_SAMPLE
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Node\Expr\FuncCall $strlenFuncCall */
|
||||
/** @var FuncCall $strlenFuncCall */
|
||||
$strlenFuncCall = $node->args[2]->value;
|
||||
if ($this->areNodesEqual($strlenFuncCall->args[0]->value, $variable)) {
|
||||
return [$node->args[0]->value, $strlenFuncCall->args[0]->value];
|
||||
|
@ -58,7 +58,7 @@ CODE_SAMPLE
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Node\Expr\BinaryOp\NotIdentical|Node\Expr\BinaryOp\Identical $node
|
||||
* @param NotIdentical|Identical $node
|
||||
*/
|
||||
public function refactor(Node $node): ?Node
|
||||
{
|
||||
|
@ -4,9 +4,13 @@ namespace Rector\Php\Rector\FunctionLike;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\Closure;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\FunctionLike;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use PhpParser\Node\Stmt\Function_;
|
||||
use PhpParser\Node\Stmt\Unset_;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\PhpParser\NodeTraverser\CallableNodeTraverser;
|
||||
@ -78,7 +82,7 @@ CODE_SAMPLE
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Node\Stmt\ClassMethod|Node\Stmt\Function_|Node\Expr\Closure $node
|
||||
* @param ClassMethod|Function_|Closure $node
|
||||
*/
|
||||
public function refactor(Node $node): ?Node
|
||||
{
|
||||
@ -111,7 +115,7 @@ CODE_SAMPLE
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($parentNode instanceof Node\Stmt\Unset_ || $parentNode instanceof Node\Expr\Cast\Unset_) {
|
||||
if ($parentNode instanceof Unset_ || $parentNode instanceof Node\Expr\Cast\Unset_) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ CODE_SAMPLE
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Node\Stmt\Class_ $node
|
||||
* @param Class_ $node
|
||||
*/
|
||||
public function refactor(Node $node): ?Node
|
||||
{
|
||||
|
@ -142,7 +142,7 @@ CODE_SAMPLE
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Node\Expr\StaticCall|Node\Stmt\Class_ $node
|
||||
* @param StaticCall|Class_ $node
|
||||
*/
|
||||
public function refactor(Node $node): ?Node
|
||||
{
|
||||
@ -183,7 +183,7 @@ CODE_SAMPLE
|
||||
|
||||
private function processStaticCall(StaticCall $staticCall): ?MethodCall
|
||||
{
|
||||
/** @var Node\Stmt\Class_|null $class */
|
||||
/** @var Class_|null $class */
|
||||
$class = $staticCall->getAttribute(AttributeKey::CLASS_NODE);
|
||||
if ($class === null) {
|
||||
return null;
|
||||
|
@ -153,7 +153,7 @@ CODE_SAMPLE
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Node\Expr\StaticCall|Node\Stmt\Class_ $node
|
||||
* @param StaticCall|Class_ $node
|
||||
*/
|
||||
public function refactor(Node $node): ?Node
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ CODE_SAMPLE
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Node\Expr\StaticCall|Node\Stmt\Class_ $node
|
||||
* @param StaticCall|Class_ $node
|
||||
*/
|
||||
public function refactor(Node $node): ?Node
|
||||
{
|
||||
|
@ -66,7 +66,7 @@ CODE_SAMPLE
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Node\Stmt\Class_ $node
|
||||
* @param Class_ $node
|
||||
*/
|
||||
public function refactor(Node $node): ?Node
|
||||
{
|
||||
|
@ -144,7 +144,7 @@ CODE_SAMPLE
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Node\Arg[]|null
|
||||
* @return Arg[]|null
|
||||
*/
|
||||
private function matchAssertContainsCrawlerArg(MethodCall $methodCall): ?array
|
||||
{
|
||||
@ -182,7 +182,7 @@ CODE_SAMPLE
|
||||
|
||||
private function processAssertResponseRedirects(MethodCall $methodCall): ?Node
|
||||
{
|
||||
/** @var Node\Stmt\Expression|null $previousNode */
|
||||
/** @var Expression|null $previousNode */
|
||||
$previousExpression = $methodCall->getAttribute(AttributeKey::PREVIOUS_EXPRESSION);
|
||||
if (! $previousExpression instanceof Expression) {
|
||||
return null;
|
||||
|
@ -107,7 +107,7 @@ final class ParsedNodesByType
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Node\Expr\New_[]
|
||||
* @return New_[]
|
||||
*/
|
||||
public function getNewNodes(): array
|
||||
{
|
||||
@ -115,7 +115,7 @@ final class ParsedNodesByType
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Node\Expr\StaticCall[]
|
||||
* @return StaticCall[]
|
||||
*/
|
||||
public function getStaticCallNodes(): array
|
||||
{
|
||||
|
@ -143,7 +143,7 @@ final class BetterNodeFinder
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Node\Expr\Assign[]
|
||||
* @return Assign[]
|
||||
*/
|
||||
public function findAssignsOfVariable(Node $node, Variable $variable): array
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ namespace Rector\PhpParser\Node\Manipulator;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\PropertyFetch;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Broker\Broker;
|
||||
use PHPStan\Type\ObjectType;
|
||||
@ -56,7 +57,7 @@ final class PropertyFetchManipulator
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var Node\Stmt\Class_|null $class */
|
||||
/** @var Class_|null $class */
|
||||
$class = $propertyFetch->getAttribute(AttributeKey::CLASS_NODE);
|
||||
if ($class === null) {
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user