forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Report dead types even in multi-exception catch
[closes phpstan/phpstan#7312] Co-authored-by: Jan Nedbal <janedbal@gmail.com>
- Loading branch information
1 parent
b206ea8
commit 7bb15fa
Showing
12 changed files
with
357 additions
and
19 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
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
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
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
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
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
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
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
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
42 changes: 42 additions & 0 deletions
42
tests/PHPStan/Rules/Exceptions/CatchWithUnthrownExceptionRuleWithDisabledMultiCatchTest.php
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,42 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Rules\Exceptions; | ||
|
||
use PHPStan\Rules\Rule; | ||
use PHPStan\Testing\RuleTestCase; | ||
use function array_merge; | ||
|
||
/** | ||
* @extends RuleTestCase<CatchWithUnthrownExceptionRule> | ||
*/ | ||
class CatchWithUnthrownExceptionRuleWithDisabledMultiCatchTest extends RuleTestCase | ||
{ | ||
|
||
protected function getRule(): Rule | ||
{ | ||
return new CatchWithUnthrownExceptionRule(); | ||
} | ||
|
||
public static function getAdditionalConfigFiles(): array | ||
{ | ||
return array_merge( | ||
parent::getAdditionalConfigFiles(), | ||
[__DIR__ . '/disable-detect-multi-catch.neon'], | ||
); | ||
} | ||
|
||
public function testMultiCatchBackwardCompatible(): void | ||
{ | ||
$this->analyse([__DIR__ . '/data/unthrown-exception-multi.php'], [ | ||
[ | ||
'Dead catch - InvalidArgumentException is already caught above.', | ||
145, | ||
], | ||
[ | ||
'Dead catch - InvalidArgumentException is already caught above.', | ||
156, | ||
], | ||
]); | ||
} | ||
|
||
} |
Oops, something went wrong.