Skip to content

Commit

Permalink
[BUGFIX] Prevent incorrect flexformtools method refactor (#4280)
Browse files Browse the repository at this point in the history
* [BUGFIX] Prevent incorrect flexformtools method refactor

Resolves: #4279

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

---------

Co-authored-by: helsner <helsner@users.noreply.github.com>
  • Loading branch information
helsner and helsner committed Jun 27, 2024
1 parent 5e6885e commit 6e362ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rules/TYPO311/v5/FlexFormToolsArrayValueByPathRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ private function refactorSetValueByPath(Expression $node): ?Node
return null;
}

if (! $this->isNames($methodCall->name, ['setArrayValueByPath'])) {
return null;
}

$variableName = $this->getName($methodCall->args[1]->value) ?? 'dataArray';

$variable = new Variable($variableName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ $searchArray = [];
$value = $flexFormTools->getArrayValueByPath('search/path', $searchArray);

$flexFormTools->setArrayValueByPath('set/path', $dataArray, $value);

$flexFormTools->cleanFlexFormXML('tt_content', 'pi_flexform', $row);
?>
-----
<?php
Expand All @@ -19,4 +21,6 @@ $searchArray = [];
$value = ArrayUtility::getValueByPath($searchArray, 'search/path');

$dataArray = ArrayUtility::setValueByPath($dataArray, 'set/path', $value);

$flexFormTools->cleanFlexFormXML('tt_content', 'pi_flexform', $row);
?>

0 comments on commit 6e362ca

Please sign in to comment.