Skip to content

Commit a3e42d5

Browse files
committed
[ci-review] Rector Rectify
1 parent 2eb04bd commit a3e42d5

3 files changed

Lines changed: 8 additions & 9 deletions

File tree

rules/TypeDeclaration/NodeAnalyzer/ClassMethodAndPropertyAnalyzer.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,18 @@ public function hasPropertyFetchReturn(ClassMethod $classMethod, string $propert
4242
return $this->nodeNameResolver->isName($return->expr, $propertyName);
4343
}
4444

45-
public function hasOnlyPropertyAssign(ClassMethod $classMethod, string $propertyName): bool
45+
public function hasOnlyPropertyAssign(ClassMethod $classMethod): bool
4646
{
4747
$stmts = (array) $classMethod->stmts;
4848
if (count($stmts) !== 1) {
4949
return false;
5050
}
5151

5252
$onlyClassMethodStmt = $stmts[0];
53-
return $this->isLocalPropertyVariableAssign($onlyClassMethodStmt, $propertyName);
53+
return $this->isLocalPropertyVariableAssign($onlyClassMethodStmt);
5454
}
5555

56-
public function hasPropertyAssignWithReturnThis(ClassMethod $classMethod, string $propertyName): bool
56+
public function hasPropertyAssignWithReturnThis(ClassMethod $classMethod): bool
5757
{
5858
$stmts = (array) $classMethod->stmts;
5959
if (count($stmts) !== 2) {
@@ -63,7 +63,7 @@ public function hasPropertyAssignWithReturnThis(ClassMethod $classMethod, string
6363
$possibleAssignStmt = $stmts[0];
6464
$possibleReturnThis = $stmts[1];
6565

66-
if (! $this->isLocalPropertyVariableAssign($possibleAssignStmt, $propertyName)) {
66+
if (! $this->isLocalPropertyVariableAssign($possibleAssignStmt)) {
6767
return false;
6868
}
6969

@@ -80,7 +80,7 @@ public function hasPropertyAssignWithReturnThis(ClassMethod $classMethod, string
8080
return $this->nodeNameResolver->isName($returnExpr, 'this');
8181
}
8282

83-
private function isLocalPropertyVariableAssign(Stmt $onlyClassMethodStmt, string $propertyName): bool
83+
private function isLocalPropertyVariableAssign(Stmt $onlyClassMethodStmt): bool
8484
{
8585
if (! $onlyClassMethodStmt instanceof Expression) {
8686
return false;

rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/SetterTypeDeclarationPropertyTypeInferer.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ public function __construct(
2424

2525
public function inferProperty(Property $property, Class_ $class): ?Type
2626
{
27-
/** @var string $propertyName */
28-
$propertyName = $this->nodeNameResolver->getName($property);
27+
$this->nodeNameResolver->getName($property);
2928

3029
foreach ($class->getMethods() as $classMethod) {
31-
if (! $this->classMethodAndPropertyAnalyzer->hasOnlyPropertyAssign($classMethod, $propertyName)) {
30+
if (! $this->classMethodAndPropertyAnalyzer->hasOnlyPropertyAssign($classMethod)) {
3231
continue;
3332
}
3433

rules/Unambiguous/Rector/Class_/RemoveReturnThisFromSetterClassMethodRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function refactor(Node $node): ?Class_
101101
continue;
102102
}
103103

104-
if (! $this->classMethodAndPropertyAnalyzer->hasPropertyAssignWithReturnThis($classMethod, $paramName)) {
104+
if (! $this->classMethodAndPropertyAnalyzer->hasPropertyAssignWithReturnThis($classMethod)) {
105105
continue;
106106
}
107107

0 commit comments

Comments
 (0)