Skip to content

Commit 8bd3c47

Browse files
authored
[TypeDeclarationDocblocks] Skip first class callable on AddReturnDocblockForJsonArrayRector (#7322)
* [TypeDeclarationDocblocks] Skip first class callable on AddReturnDocblockForJsonArrayRector * Fix
1 parent ea5ad96 commit 8bd3c47

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Rector\Tests\TypeDeclarationDocblocks\Rector\ClassMethod\AddReturnDocblockForJsonArrayRector\Fixture;
6+
7+
final class SkipFirstClassCallable
8+
{
9+
public function provide(string $contents)
10+
{
11+
return json_decode(...);
12+
}
13+
}
14+
15+
?>

rules/TypeDeclarationDocblocks/Rector/ClassMethod/AddReturnDocblockForJsonArrayRector.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ private function isJsonDecodeToArray(Expr $expr): bool
135135
return false;
136136
}
137137

138+
if ($expr->isFirstClassCallable()) {
139+
return false;
140+
}
141+
138142
if (count($expr->getArgs()) !== 2) {
139143
return false;
140144
}
@@ -152,6 +156,10 @@ private function isJsonDecodeToArray(Expr $expr): bool
152156
return false;
153157
}
154158

159+
if ($expr->isFirstClassCallable()) {
160+
return false;
161+
}
162+
155163
if (count($expr->getArgs()) !== 2) {
156164
return false;
157165
}

0 commit comments

Comments
 (0)