[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:
Abdul Malik Ikhsan 2022-05-23 10:43:42 +07:00 committed by GitHub
parent 3fe07aa6a1
commit f134b6183e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}