Skip to content

Commit

Permalink
Updated Rector to commit 8cab945ae45b651cdf66c8bfbb1603c514733896
Browse files Browse the repository at this point in the history
rectorphp/rector-src@8cab945 The ReturnTypeFromReturnNewRector must only handle new instances, to avoid leaking to everything (#5115)
  • Loading branch information
TomasVotruba committed Oct 4, 2023
1 parent 68e7483 commit 1c164a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
namespace Rector\TypeDeclaration\Rector\ClassMethod;

use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\ArrowFunction;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\Expr\New_;
Expand Down Expand Up @@ -228,20 +227,11 @@ private function resolveReturnNewType(array $returns) : ?array
{
$newTypes = [];
foreach ($returns as $return) {
if (!$return->expr instanceof Expr) {
return null;
}
if (!$return->expr instanceof New_) {
$returnType = $this->nodeTypeResolver->getNativeType($return->expr);
if ($returnType instanceof ObjectType) {
$newTypes[] = $returnType;
continue;
}
return null;
}
$new = $return->expr;
$newType = $this->createObjectTypeFromNew($new);
if ($newType === null) {
$newType = $this->createObjectTypeFromNew($return->expr);
if (!$newType instanceof Type) {
return null;
}
$newTypes[] = $newType;
Expand Down
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'fe2c85cde9f06c2ccb0e6e7bbbb24f8def25efa9';
public const PACKAGE_VERSION = '8cab945ae45b651cdf66c8bfbb1603c514733896';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-10-04 18:36:04';
public const RELEASE_DATE = '2023-10-04 15:11:16';
/**
* @var int
*/
Expand Down

0 comments on commit 1c164a6

Please sign in to comment.