mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-06 19:30:50 +00:00
[Php71] Ensure return $node only when catch of TryCatch removed on MultiExceptionCatchRector (#2350)
* [Php71] Ensure return $node only when catch of TryCatch removed on MultiExceptionCatchRector * [Php71] Ensure return $node only when catch of TryCatch removed on MultiExceptionCatchRector
This commit is contained in:
parent
3fe07aa6a1
commit
f134b6183e
|
@ -73,6 +73,7 @@ CODE_SAMPLE
|
|||
}
|
||||
|
||||
$catchKeysByContent = $this->collectCatchKeysByContent($node);
|
||||
$hasRemovedCatch = false;
|
||||
/** @var Catch_[] $catchKeys */
|
||||
foreach ($catchKeysByContent as $catchKeys) {
|
||||
// no duplicates
|
||||
|
@ -89,9 +90,14 @@ CODE_SAMPLE
|
|||
|
||||
foreach ($catchKeys as $catchKey) {
|
||||
$this->removeNode($catchKey);
|
||||
$hasRemovedCatch = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $hasRemovedCatch) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user