Skip to content

Commit

Permalink
TASK: Fix idempotent rector
Browse files Browse the repository at this point in the history
Resolves: #3234
  • Loading branch information
sabbelasichon committed Jul 31, 2023
1 parent f1118d9 commit aa526ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Rector/v12/v0/typo3/AbstractMessageGetSeverityRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public function refactor(Node $node)
return null;
}

$nextNode = $this->betterNodeFinder->resolveNextNode($node);

if ($nextNode instanceof Node\Identifier && $this->isName($nextNode, 'value')) {
return null;
}

return $this->nodeFactory->createPropertyFetch($node, 'value');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use \TYPO3\CMS\Core\Messaging\FlashMessage;

$flashMessage = new FlashMessage('This is a message');
$severityAsInt = $flashMessage->getSeverity();
$severityValue = $flashMessage->getSeverity()->value;
?>
-----
<?php
Expand All @@ -16,4 +17,5 @@ use \TYPO3\CMS\Core\Messaging\FlashMessage;

$flashMessage = new FlashMessage('This is a message');
$severityAsInt = $flashMessage->getSeverity()->value;
$severityValue = $flashMessage->getSeverity()->value;
?>

0 comments on commit aa526ad

Please sign in to comment.