diff --git a/src/Rector/v8/v7/BackendUtilityGetRecordRawRector.php b/src/Rector/v8/v7/BackendUtilityGetRecordRawRector.php index aed296fc9..64630c648 100644 --- a/src/Rector/v8/v7/BackendUtilityGetRecordRawRector.php +++ b/src/Rector/v8/v7/BackendUtilityGetRecordRawRector.php @@ -34,7 +34,7 @@ final class BackendUtilityGetRecordRawRector extends AbstractRector */ public function getNodeTypes(): array { - return [Node\Stmt\Expression::class]; + return [Expression::class]; } /** @@ -52,6 +52,7 @@ public function refactor(Node $node): ?array if (! $staticCall instanceof StaticCall) { return null; } + if (! $this->nodeTypeResolver->isMethodStaticCallOrClassMethodObjectType( $staticCall, new ObjectType('TYPO3\CMS\Backend\Utility\BackendUtility') @@ -72,16 +73,12 @@ public function refactor(Node $node): ?array $this->nodeFactory->createMethodCall(new Variable(self::QUERY_BUILDER), 'getRestrictions'), 'removeAll' ); - - $nodes = []; - foreach ([ + $nodes = [ new Nop(), new Expression($queryBuilderAssign), new Expression($queryBuilderRemoveRestrictions), new Nop(), - ] as $newNode) { - $nodes[] = $newNode; - } + ]; $node->expr->expr = $this->fetchQueryBuilderResults($firstArgument, $secondArgument, $thirdArgument);