Updated Rector to commit 8cab945ae45b651cdf66c8bfbb1603c514733896

8cab945ae4 The ReturnTypeFromReturnNewRector must only handle new instances, to avoid leaking to everything (#5115)
This commit is contained in:
Tomas Votruba 2023-10-04 13:14:06 +00:00
parent 68e74833fe
commit 1c164a642f
2 changed files with 4 additions and 14 deletions

View File

@ -4,7 +4,6 @@ declare (strict_types=1);
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_;
@ -228,20 +227,11 @@ CODE_SAMPLE
{
$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;

View File

@ -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
*/