Skip to content

Commit 17dc597

Browse files
committed
cs
1 parent 0ca4e91 commit 17dc597

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

rules/Naming/Rector/ClassMethod/RenameParamToMatchTypeRector.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,12 @@ public function refactor(Node $node): ?Node
8585

8686
foreach ($node->params as $param) {
8787
// skip as array-like
88-
if ($param->variadic || $param->type === null) {
88+
if ($param->variadic) {
89+
continue;
90+
}
91+
if ($param->type === null) {
8992
continue;
9093
}
91-
9294
if ($node instanceof ClassMethod && $this->shouldSkipClassMethodFromVendor($node)) {
9395
return null;
9496
}

rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByParentCallTypeRector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ public function refactor(Node $node): ?Node
135135
$paramType = $parentParam->type;
136136

137137
// original attributes have to removed to avoid tokens crashing from origin positions
138-
$this->traverseNodesWithCallable($paramType, static function (Node $classMethod): null {
139-
$classMethod->setAttribute(AttributeKey::ORIGINAL_NODE, null);
138+
$this->traverseNodesWithCallable($paramType, static function (Node $node): null {
139+
$node->setAttribute(AttributeKey::ORIGINAL_NODE, null);
140140
return null;
141141
});
142142

rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorRector.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,14 @@ private function shouldSkipPropertyType(Type $propertyType): bool
185185
return $this->doctrineTypeAnalyzer->isInstanceOfCollectionType($propertyType);
186186
}
187187

188-
private function hasSomeUntypedProperties(Node|Class_ $node): bool
188+
private function hasSomeUntypedProperties(Class_ $class): bool
189189
{
190-
foreach ($node->getProperties() as $property) {
191-
if ($property->type instanceof \PhpParser\Node) {
190+
if ($class->getProperties() === []) {
191+
return false;
192+
}
193+
194+
foreach ($class->getProperties() as $property) {
195+
if ($property->type instanceof Node) {
192196
continue;
193197
}
194198

0 commit comments

Comments
 (0)