fixup! [DeadCode] Add RemoveDeadTryCatchRector

This commit is contained in:
TomasVotruba 2020-02-14 15:41:54 +01:00
parent af90cba019
commit 1881f534de
2 changed files with 59 additions and 0 deletions

View File

@ -0,0 +1,40 @@
<?php
namespace Rector\DeadCode\Tests\Rector\TryCatch\RemoveDeadTryCatchRector\Fixture;
class MultiLines
{
public function run()
{
try {
$one = 1;
$two = 1;
if ($one + $two > 1) {
return 155;
}
}
catch (Throwable $throwable) {
throw $throwable;
}
}
}
?>
-----
<?php
namespace Rector\DeadCode\Tests\Rector\TryCatch\RemoveDeadTryCatchRector\Fixture;
class MultiLines
{
public function run()
{
$one = 1;
$two = 1;
if ($one + $two > 1) {
return 155;
}
}
}
?>

View File

@ -0,0 +1,19 @@
<?php
namespace Rector\DeadCode\Tests\Rector\TryCatch\RemoveDeadTryCatchRector\Fixture;
use InvalidArgumentException;
class SkipCatchElse
{
public function run()
{
try {
$one = 1;
}
catch (Throwable $throwable) {
$throwable = new InvalidArgumentException();
throw $throwable;
}
}
}