Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new CatchBlockRemoval mutator #1742

Merged
merged 1 commit into from
Oct 18, 2022
Merged

Add new CatchBlockRemoval mutator #1742

merged 1 commit into from
Oct 18, 2022

Conversation

sidz
Copy link
Member

@sidz sidz commented Oct 16, 2022

This PR:

try {
    $callback();
- } catch (\DomainException $ex) {
-     $logger->log($ex);
} catch (\LogicException $e) {
    throw $e;
}

It won't remove catch block in case there is no statements

<?php

try {
    $callback();
} catch (\DomainException $e) {
    // DO nothing
- } catch (\Throwable $e) {
-     throw new \RuntimeException();
}

@sidz sidz added the Mutator label Oct 16, 2022
@sidz sidz force-pushed the catch-block-removal-mutator branch from 8cc9018 to 1d44f58 Compare October 16, 2022 19:54
Copy link
Member

@maks-rafalko maks-rafalko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Can't believe we didn't have such mutator so far.

Please update the docs as well.

@sidz
Copy link
Member Author

sidz commented Oct 17, 2022

Done

@sidz sidz merged commit f9bd211 into master Oct 18, 2022
@sidz sidz deleted the catch-block-removal-mutator branch October 18, 2022 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants