-
-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Php56] Skip multiple catch with same variable on AddDefaultValueForU…
…ndefinedVariableRector (#2533) Co-authored-by: GitHub Action <action@github.com>
- Loading branch information
1 parent
87b3dad
commit 4eeadae
Showing
3 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
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
30 changes: 30 additions & 0 deletions
30
...ionLike/AddDefaultValueForUndefinedVariableRector/Fixture/skip_catch_use_variable.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,30 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector\Fixture; | ||
|
||
class SkipCatchUseVariable | ||
{ | ||
public function run() | ||
{ | ||
try { | ||
} catch (\Exception $e) { | ||
var_dump($e); | ||
} | ||
} | ||
|
||
public function run2() | ||
{ | ||
try { | ||
} catch (\Exception $e) { | ||
$e; | ||
} | ||
} | ||
|
||
public function run3() | ||
{ | ||
try { | ||
} catch (\Exception $e) { | ||
echo $e::class; | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...aultValueForUndefinedVariableRector/Fixture/skip_multiple_catch_use_same_variable.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,36 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector\Fixture; | ||
|
||
class SkipMultipleCatchWithUseSameVariable | ||
{ | ||
public function run() | ||
{ | ||
try { | ||
} catch (\Exception $e) { | ||
var_dump($e); | ||
} catch (\Throwable $e) { | ||
var_dump($e); | ||
} | ||
} | ||
|
||
public function run2() | ||
{ | ||
try { | ||
} catch (\Exception $e) { | ||
$e; | ||
} catch (\Throwable $e) { | ||
$e; | ||
} | ||
} | ||
|
||
public function run3() | ||
{ | ||
try { | ||
} catch (\Exception $e) { | ||
echo $e::class; | ||
} catch (\Throwable $e) { | ||
echo $e::class; | ||
} | ||
} | ||
} |