-
-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CodeQuality] Skip Always return in try catch with finally on Explici…
…tReturnNullRector (#5807) * [CodeQuality] Skip Always return in try catch with finally on ExplicitReturnNullRector * [ci-review] Rector Rectify * [ci-review] Rector Rectify --------- Co-authored-by: GitHub Action <actions@github.com>
- Loading branch information
1 parent
145b616
commit 690fe89
Showing
3 changed files
with
35 additions
and
54 deletions.
There are no files selected for viewing
48 changes: 0 additions & 48 deletions
48
...od/ExplicitReturnNullRector/Fixture/if_else_return_in_try_catch_finally_no_return.php.inc
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
...d/ExplicitReturnNullRector/Fixture/skip_always_returned_in_try_catch_with_finally.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\ClassMethod\ExplicitReturnNullRector\Fixture; | ||
|
||
final class SkipAlwaysReturnInTryCatchWithFinally | ||
{ | ||
public function run(int $number) | ||
{ | ||
if (rand(0, 1)) { | ||
try { | ||
return execute(); | ||
} catch (\Exception $e) { | ||
return 2; | ||
} finally { | ||
echo 'here executed after return'; | ||
} | ||
} else { | ||
return 2; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters