From 0b2ceb4fdb567e1d9a263759856f0a3a5c3989b8 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Mon, 8 Nov 2021 12:10:35 +0100 Subject: [PATCH] fix FuncCall node name --- .../Pow/DowngradeExponentialAssignmentOperatorRector.php | 4 ++-- .../Rector/FunctionLike/ReturnTypeDeclarationRector.php | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/rules/DowngradePhp56/Rector/Pow/DowngradeExponentialAssignmentOperatorRector.php b/rules/DowngradePhp56/Rector/Pow/DowngradeExponentialAssignmentOperatorRector.php index 229cf8f4158..964d032ae36 100644 --- a/rules/DowngradePhp56/Rector/Pow/DowngradeExponentialAssignmentOperatorRector.php +++ b/rules/DowngradePhp56/Rector/Pow/DowngradeExponentialAssignmentOperatorRector.php @@ -39,8 +39,8 @@ public function getNodeTypes(): array */ public function refactor(Node $node): Assign { - $powCall = $this->nodeFactory->createFuncCall('pow', [$node->var, $node->expr]); + $powFuncCall = $this->nodeFactory->createFuncCall('pow', [$node->var, $node->expr]); - return new Assign($node->var, $powCall); + return new Assign($node->var, $powFuncCall); } } diff --git a/rules/TypeDeclaration/Rector/FunctionLike/ReturnTypeDeclarationRector.php b/rules/TypeDeclaration/Rector/FunctionLike/ReturnTypeDeclarationRector.php index 733aa303b63..2b081e53a19 100644 --- a/rules/TypeDeclaration/Rector/FunctionLike/ReturnTypeDeclarationRector.php +++ b/rules/TypeDeclaration/Rector/FunctionLike/ReturnTypeDeclarationRector.php @@ -220,7 +220,13 @@ private function isNullableTypeSubType(Type $currentType, Type $inferedType): bo return false; } - return $currentType->isSubTypeOf($currentType) + // probably more/less strict union type on purpose + if ($currentType->isSubTypeOf($inferedType) + ->yes()) { + return true; + } + + return $inferedType->isSubTypeOf($currentType) ->yes(); }