-
-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove removeNode() from MultiExceptionCatchRector (#4063)
- Loading branch information
1 parent
2d99c8b
commit 141923f
Showing
5 changed files
with
119 additions
and
88 deletions.
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
41 changes: 41 additions & 0 deletions
41
...ests/Php71/Rector/TryCatch/MultiExceptionCatchRector/Fixture/merge_commented_same.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,41 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php71\Rector\TryCatch\MultiExceptionCatchRector\Fixture; | ||
|
||
final class MergeCommentedSame | ||
{ | ||
public function run() | ||
{ | ||
try { | ||
// Some code... | ||
} catch (ExceptionType1 $e) { | ||
// Code to handle the exception | ||
} catch (ExceptionType2 $e) { | ||
// Code to handle the exception | ||
} catch (Exception $e) { | ||
// ... | ||
} | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php71\Rector\TryCatch\MultiExceptionCatchRector\Fixture; | ||
|
||
final class MergeCommentedSame | ||
{ | ||
public function run() | ||
{ | ||
try { | ||
// Some code... | ||
} catch (ExceptionType1|ExceptionType2 $e) { | ||
// Code to handle the exception | ||
} catch (Exception $e) { | ||
// ... | ||
} | ||
} | ||
} | ||
|
||
?> |
43 changes: 43 additions & 0 deletions
43
rules-tests/Php71/Rector/TryCatch/MultiExceptionCatchRector/Fixture/multiple_items.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,43 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php71\Rector\TryCatch\MultiExceptionCatchRector\Fixture; | ||
|
||
final class MultipleItems | ||
{ | ||
public function run() | ||
{ | ||
try { | ||
// Some code... | ||
} catch (ExceptionType1 $e) { | ||
// Code to handle the exception | ||
} catch (ExceptionType2 $e) { | ||
// Code to handle the exception | ||
} catch (ExceptionType3 $e) { | ||
// Code to handle the exception | ||
} finally { | ||
// nothing | ||
} | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php71\Rector\TryCatch\MultiExceptionCatchRector\Fixture; | ||
|
||
final class MultipleItems | ||
{ | ||
public function run() | ||
{ | ||
try { | ||
// Some code... | ||
} catch (ExceptionType1|ExceptionType2|ExceptionType3 $e) { | ||
// Code to handle the exception | ||
} finally { | ||
// nothing | ||
} | ||
} | ||
} | ||
|
||
?> |
17 changes: 17 additions & 0 deletions
17
...s/Php71/Rector/TryCatch/MultiExceptionCatchRector/Fixture/skip_different_contents.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,17 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php71\Rector\TryCatch\MultiExceptionCatchRector\Fixture; | ||
|
||
final class SkipDifferentContents | ||
{ | ||
public function run() | ||
{ | ||
try { | ||
// Some code... | ||
} catch (ExceptionType1 $e) { | ||
// Code to handle the exception | ||
} catch (ExceptionType2 $e) { | ||
$differentContent = 'hey'; | ||
} | ||
} | ||
} |
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