Skip to content

Commit 1c164a6

Browse files
committed
Updated Rector to commit 8cab945ae45b651cdf66c8bfbb1603c514733896
rectorphp/rector-src@8cab945 The ReturnTypeFromReturnNewRector must only handle new instances, to avoid leaking to everything (#5115)
1 parent 68e7483 commit 1c164a6

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
namespace Rector\TypeDeclaration\Rector\ClassMethod;
55

66
use PhpParser\Node;
7-
use PhpParser\Node\Expr;
87
use PhpParser\Node\Expr\ArrowFunction;
98
use PhpParser\Node\Expr\Closure;
109
use PhpParser\Node\Expr\New_;
@@ -228,20 +227,11 @@ private function resolveReturnNewType(array $returns) : ?array
228227
{
229228
$newTypes = [];
230229
foreach ($returns as $return) {
231-
if (!$return->expr instanceof Expr) {
232-
return null;
233-
}
234230
if (!$return->expr instanceof New_) {
235-
$returnType = $this->nodeTypeResolver->getNativeType($return->expr);
236-
if ($returnType instanceof ObjectType) {
237-
$newTypes[] = $returnType;
238-
continue;
239-
}
240231
return null;
241232
}
242-
$new = $return->expr;
243-
$newType = $this->createObjectTypeFromNew($new);
244-
if ($newType === null) {
233+
$newType = $this->createObjectTypeFromNew($return->expr);
234+
if (!$newType instanceof Type) {
245235
return null;
246236
}
247237
$newTypes[] = $newType;

src/Application/VersionResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ final class VersionResolver
1919
* @api
2020
* @var string
2121
*/
22-
public const PACKAGE_VERSION = 'fe2c85cde9f06c2ccb0e6e7bbbb24f8def25efa9';
22+
public const PACKAGE_VERSION = '8cab945ae45b651cdf66c8bfbb1603c514733896';
2323
/**
2424
* @api
2525
* @var string
2626
*/
27-
public const RELEASE_DATE = '2023-10-04 18:36:04';
27+
public const RELEASE_DATE = '2023-10-04 15:11:16';
2828
/**
2929
* @var int
3030
*/

0 commit comments

Comments
 (0)