-
Notifications
You must be signed in to change notification settings - Fork 478
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dependent types - understand truthy BooleanOr and falsey BooleanAnd s…
…cope
- Loading branch information
1 parent
5d37113
commit 2c42ef1
Showing
5 changed files
with
139 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace Bug4733; | ||
|
||
use function PHPStan\Analyser\assertType; | ||
|
||
class HelloWorld | ||
{ | ||
public function getDescription(?\DateTimeImmutable $start, ?string $someObject): void | ||
{ | ||
if ($start === null && $someObject === null) { | ||
return; | ||
} | ||
|
||
// $start !== null || $someObject !== null | ||
|
||
if ($start !== null) { | ||
return; | ||
} | ||
|
||
// $start === null therefore $someObject !== null | ||
|
||
assertType('string', $someObject); | ||
} | ||
|
||
public function getDescription2(?\DateTimeImmutable $start, ?string $someObject): void | ||
{ | ||
if ($start !== null || $someObject !== null) { | ||
if ($start !== null) { | ||
return; | ||
} | ||
|
||
// $start === null therefore $someObject !== null | ||
|
||
assertType('string', $someObject); | ||
} | ||
} | ||
} |