Skip to content

Commit 4f91a37

Browse files
authored
Rectify (#7852)
1 parent ef454a2 commit 4f91a37

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

rules/Php81/NodeManipulator/NullToStrictStringIntConverter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Rector\Php81\NodeManipulator;
66

7-
use PHPStan\Analyser\Fiber\FiberScope;
87
use PhpParser\Node\Arg;
98
use PhpParser\Node\Expr;
109
use PhpParser\Node\Expr\Cast\Int_ as CastInt_;
@@ -16,6 +15,7 @@
1615
use PhpParser\Node\Scalar\Int_;
1716
use PhpParser\Node\Scalar\InterpolatedString;
1817
use PhpParser\Node\Scalar\String_;
18+
use PHPStan\Analyser\Fiber\FiberScope;
1919
use PHPStan\Analyser\Scope;
2020
use PHPStan\Reflection\Native\ExtendedNativeParameterReflection;
2121
use PHPStan\Reflection\ParametersAcceptor;

rules/TypeDeclaration/NodeAnalyzer/StrictTypeSafetyChecker.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use PHPStan\Reflection\MethodReflection;
1616
use PHPStan\Reflection\ParameterReflection;
1717
use PHPStan\Reflection\ParametersAcceptorSelector;
18+
use PHPStan\Reflection\Php\PhpPropertyReflection;
1819
use PHPStan\Type\MixedType;
1920
use PHPStan\Type\NeverType;
2021
use PHPStan\Type\Type;
@@ -154,7 +155,8 @@ private function areFunctionReturnsTypeSafe(FunctionLike $functionLike): bool
154155
if (
155156
$declaredReturnType instanceof MixedType
156157
|| $declaredReturnType instanceof NeverType
157-
|| $declaredReturnType->isVoid()->yes()
158+
|| $declaredReturnType->isVoid()
159+
->yes()
158160
) {
159161
return true;
160162
}
@@ -183,7 +185,7 @@ private function isPropertyAssignSafe(Assign $assign): bool
183185
}
184186

185187
$propertyReflection = $this->reflectionResolver->resolvePropertyReflectionFromPropertyFetch($assign->var);
186-
if ($propertyReflection === null) {
188+
if (! $propertyReflection instanceof PhpPropertyReflection) {
187189
return false;
188190
}
189191

src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Rector\NodeTypeResolver\PHPStan\Scope;
66

7-
use PHPStan\Analyser\Fiber\FiberScope;
87
use Error;
98
use PhpParser\Node;
109
use PhpParser\Node\Arg;
@@ -86,6 +85,7 @@
8685
use PhpParser\Node\Stmt\While_;
8786
use PhpParser\Node\UnionType;
8887
use PhpParser\NodeTraverser;
88+
use PHPStan\Analyser\Fiber\FiberScope;
8989
use PHPStan\Analyser\MutatingScope;
9090
use PHPStan\Analyser\NodeScopeResolver;
9191
use PHPStan\Analyser\ScopeContext;

tests/Issues/IssuePropertyPromoRemoveDelegatingParent/config/configured_rule.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
use Rector\Config\RectorConfig;
46
use Rector\DeadCode\Rector\ClassMethod\RemoveParentDelegatingConstructorRector;
57
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;

0 commit comments

Comments
 (0)