-
Notifications
You must be signed in to change notification settings - Fork 462
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bleeding edge - consider implicit throw points when the only explicit…
… one is Throw_
- Loading branch information
1 parent
1fcae1c
commit 22eef6d
Showing
10 changed files
with
80 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace ExplicitThrows; | ||
|
||
use PHPStan\TrinaryLogic; | ||
use function PHPStan\Testing\assertVariableCertainty; | ||
|
||
class Foo | ||
{ | ||
|
||
public function doFoo(): void | ||
{ | ||
try { | ||
doFoo(); | ||
$a = 1; | ||
throw new \InvalidArgumentException(); | ||
} catch (\InvalidArgumentException $e) { | ||
assertVariableCertainty(TrinaryLogic::createMaybe(), $a); | ||
} | ||
} | ||
|
||
public function doBar(): void | ||
{ | ||
try { | ||
doFoo(); | ||
$a = 1; | ||
$this->throwInvalidArgument(); | ||
} catch (\InvalidArgumentException $e) { | ||
assertVariableCertainty(TrinaryLogic::createYes(), $a); | ||
} | ||
} | ||
|
||
public function doBaz(): void | ||
{ | ||
try { | ||
doFoo(); | ||
$a = 1; | ||
$this->throwInvalidArgument(); | ||
throw new \InvalidArgumentException(); | ||
} catch (\InvalidArgumentException $e) { | ||
assertVariableCertainty(TrinaryLogic::createYes(), $a); | ||
} | ||
} | ||
|
||
/** | ||
* @throws \InvalidArgumentException | ||
*/ | ||
private function throwInvalidArgument(): void | ||
{ | ||
|
||
} | ||
|
||
} |
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