-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix overriding throw point with void
- Loading branch information
1 parent
dca48f3
commit da3790e
Showing
4 changed files
with
70 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
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,38 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Rules\Exceptions; | ||
|
||
use PHPStan\Testing\RuleTestCase; | ||
|
||
/** | ||
* @extends RuleTestCase<MissingCheckedExceptionInMethodThrowsRule> | ||
*/ | ||
class Bug5364Test extends RuleTestCase | ||
{ | ||
|
||
protected function getRule(): \PHPStan\Rules\Rule | ||
{ | ||
return new MissingCheckedExceptionInMethodThrowsRule( | ||
new MissingCheckedExceptionInThrowsCheck(new DefaultExceptionTypeResolver( | ||
$this->createReflectionProvider(), | ||
[], | ||
[], | ||
[], | ||
[] | ||
)) | ||
); | ||
} | ||
|
||
public function testRule(): void | ||
{ | ||
$this->analyse([__DIR__ . '/data/bug-5364.php'], []); | ||
} | ||
|
||
public static function getAdditionalConfigFiles(): array | ||
{ | ||
return [ | ||
__DIR__ . '/bug-5364.neon', | ||
]; | ||
} | ||
|
||
} |
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,6 @@ | ||
parameters: | ||
implicitThrows: false | ||
exceptions: | ||
check: | ||
missingCheckedExceptionInThrows: true | ||
tooWideThrowType: true |
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,20 @@ | ||
<?php | ||
|
||
namespace Bug5364; | ||
|
||
class Foo | ||
{ | ||
|
||
/** | ||
* @throws \Exception | ||
*/ | ||
function test(): void { | ||
throw new \Exception(); | ||
} | ||
|
||
function call_test(): void { | ||
/** @throws void */ | ||
$this->test(); | ||
} | ||
|
||
} |