diff --git a/src/Rector/v11/v3/SubstituteMethodRmFromListOfGeneralUtilityRector.php b/src/Rector/v11/v3/SubstituteMethodRmFromListOfGeneralUtilityRector.php index b83b9703a..8c53d8b3e 100644 --- a/src/Rector/v11/v3/SubstituteMethodRmFromListOfGeneralUtilityRector.php +++ b/src/Rector/v11/v3/SubstituteMethodRmFromListOfGeneralUtilityRector.php @@ -59,8 +59,9 @@ public function refactor(Node $node): ?Node $explodeFuncCall = $this->nodeFactory->createFuncCall('explode', [',', $node->args[1]]); $itemVariable = new Variable('item'); + $elementVariable = new Variable($this->nodeNameResolver->getName($node->args[0]->value)); - $stmts = [new Return_(new Equal(new Variable('element'), $itemVariable))]; + $stmts = [new Return_(new Equal($elementVariable, $itemVariable))]; $closureFunction = $this->anonymousFunctionFactory->create([new Param($itemVariable)], $stmts, null); diff --git a/tests/Rector/v11/v3/SubstituteMethodRmFromListOfGeneralUtilityRector/Fixture/remove_from_list_to_array_filter.php.inc b/tests/Rector/v11/v3/SubstituteMethodRmFromListOfGeneralUtilityRector/Fixture/remove_from_list_to_array_filter.php.inc index 345317e33..e991f3883 100644 --- a/tests/Rector/v11/v3/SubstituteMethodRmFromListOfGeneralUtilityRector/Fixture/remove_from_list_to_array_filter.php.inc +++ b/tests/Rector/v11/v3/SubstituteMethodRmFromListOfGeneralUtilityRector/Fixture/remove_from_list_to_array_filter.php.inc @@ -9,6 +9,11 @@ $list = '1,2,3'; $newList = GeneralUtility::rmFromList($element, $list); +$newElementVarName = '1'; +$newListVarName = '1,2,3'; + +$newListTwo = GeneralUtility::rmFromList($newElementVarName, $newListVarName); + ?> -----