-
Notifications
You must be signed in to change notification settings - Fork 457
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Last elseif can be exhaustive and no else branch is not needed
- Loading branch information
1 parent
a42b35c
commit 94e6e46
Showing
3 changed files
with
30 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
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,28 @@ | ||
<?php | ||
|
||
namespace AlwaysTrueElseif; | ||
|
||
use PHPStan\TrinaryLogic; | ||
use function PHPStan\Testing\assertVariableCertainty; | ||
|
||
class Foo | ||
{ | ||
|
||
/** | ||
* @param 'a'|'b'|'c' $s | ||
* @return void | ||
*/ | ||
public function doFoo(string $s): void | ||
{ | ||
if ($s === 'a') { | ||
$a = true; | ||
} elseif ($s === 'b') { | ||
$a = false; | ||
} elseif ($s === 'c') { | ||
$a = true; | ||
} | ||
|
||
assertVariableCertainty(TrinaryLogic::createYes(), $a); | ||
} | ||
|
||
} |