Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions rules/CodeQuality/Rector/Class_/ConvertStaticToSelfRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

namespace Rector\CodeQuality\Rector\Class_;

use PHPStan\Analyser\Scope;
use PHPStan\Reflection\ClassConstantReflection;
use PhpParser\Node;
use PhpParser\Node\Expr\ClassConstFetch;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Expr\StaticPropertyFetch;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt\Class_;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\ClassConstantReflection;
use PHPStan\Reflection\ClassReflection;
use Rector\Configuration\Parameter\FeatureFlags;
use Rector\Enum\ObjectReference;
Expand Down Expand Up @@ -165,7 +165,8 @@ private function shouldSkip(
if (! $isFinal) {
$memberIsFinal = $reflection instanceof ClassConstantReflection
? $reflection->isFinal()
: $reflection->isFinalByKeyword()->yes();
: $reflection->isFinalByKeyword()
->yes();

// Final native members can be safely converted
if ($memberIsFinal) {
Expand Down
2 changes: 1 addition & 1 deletion rules/Php85/Rector/Switch_/ColonAfterSwitchCaseRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function refactor(Node $node): ?Node
}

if (count($case->stmts) === 0) {
$startCaseStmtsPos = isset($node->cases[$key + 1])
$startCaseStmtsPos = isset($node->cases[$key + 1])
? $node->cases[$key + 1]->getStartTokenPos()
: $node->getEndTokenPos();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private function isWrappedFuncCall(StmtsAwareInterface $stmtsAware): bool
}

$phpVersionId = $this->getPhpVersionId($stmtsAware->cond);
if (!$phpVersionId instanceof Int_) {
if (! $phpVersionId instanceof Int_) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@
namespace Rector\TypeDeclaration\Rector\ClassMethod;

use PhpParser\Node;
use PHPStan\Type\Type;
use PhpParser\Node\Expr;
use PHPStan\Type\ArrayType;
use PHPStan\Type\FloatType;
use PHPStan\Type\MixedType;
use PHPStan\Type\StringType;
use PHPStan\Type\IntegerType;
use PhpParser\Node\Expr\Array_;
use PhpParser\Node\Expr\ArrayDimFetch;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Scalar\Int_;
use PhpParser\Node\Stmt\Return_;
use PhpParser\Node\Expr\Variable;
use Rector\Rector\AbstractRector;
use PhpParser\Node\Scalar\DNumber;
use PhpParser\Node\Scalar\Int_;
use PhpParser\Node\Scalar\String_;
use PhpParser\Node\Stmt\Function_;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Expr\ArrayDimFetch;
use PhpParser\Node\Stmt\Function_;
use PhpParser\Node\Stmt\Return_;
use PHPStan\Type\ArrayType;
use PHPStan\Type\FloatType;
use PHPStan\Type\IntegerType;
use PHPStan\Type\MixedType;
use PHPStan\Type\StringType;
use PHPStan\Type\Type;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger;
use Rector\PhpParser\Node\BetterNodeFinder;
use Rector\Rector\AbstractRector;
use Rector\TypeDeclaration\NodeAnalyzer\ReturnAnalyzer;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;

/**
* @see \Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddReturnDocblockForScalarArrayFromAssignsRector\AddReturnDocblockForScalarArrayFromAssignsRectorTest
Expand Down Expand Up @@ -123,7 +123,6 @@ public function refactor(Node $node): ?Node

$returnsScoped = $this->betterNodeFinder->findReturnsScoped($node);


if (! $this->returnAnalyzer->hasOnlyReturnWithExpr($node, $returnsScoped)) {
return null;
}
Expand Down Expand Up @@ -191,7 +190,10 @@ private function resolveScalarArrayTypeForVariable(ClassMethod|Function_ $node,
$arrayHasDimAssigns = false;

foreach ($assigns as $assign) {
if ($assign->var instanceof Variable && $this->isName($assign->var, $variableName) && ($assign->expr instanceof Array_ && $assign->expr->items === [])) {
if ($assign->var instanceof Variable && $this->isName(
$assign->var,
$variableName
) && ($assign->expr instanceof Array_ && $assign->expr->items === [])) {
$arrayHasInitialized = true;
continue;
}
Expand Down
Loading