Skip to content

Commit 7c6393a

Browse files
authored
[TypeDeclarationDocblocks] Skip class name string return on AddReturnDocblockForCommonObjectDenominatorRector (#7252)
* [TypeDeclarationDocblocks] Skip class name string return on AddReturnDocblockForCommonObjectDenominatorRector * Fix * use isObject() check
1 parent 71cde52 commit 7c6393a

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace Rector\Tests\TypeDeclarationDocblocks\Rector\ClassMethod\AddReturnDocblockForCommonObjectDenominatorRector\Fixture;
4+
5+
use PhpParser\Node\Stmt\Class_;
6+
7+
final class SkipClassNameString
8+
{
9+
public function run(): array
10+
{
11+
return [
12+
Class_::class,
13+
];
14+
}
15+
}

rules/TypeDeclarationDocblocks/Rector/ClassMethod/AddReturnDocblockForCommonObjectDenominatorRector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ public function refactor(Node $node): ?Node
133133
}
134134

135135
/**
136-
* nested structure
136+
* not an object, can be nested array, or string class as Foo::class
137137
*/
138-
if ($valueType->isArray()->yes()) {
138+
if (! $valueType->isObject()->yes()) {
139139
return null;
140140
}
141141

0 commit comments

Comments
 (0)