Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Duplicate and adapt solution from is_subclass_of for is_a
- Loading branch information
1 parent
2674577
commit 7ff5dfd
Showing
5 changed files
with
79 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Bug6704; | ||
|
||
use DateTimeImmutable; | ||
use stdClass; | ||
use function PHPStan\Testing\assertType; | ||
|
||
/** | ||
* @param class-string<DateTimeImmutable>|class-string<stdClass> $a | ||
* @param DateTimeImmutable|stdClass $b | ||
*/ | ||
function foo(string $a, object $b): void | ||
{ | ||
if (!is_a($a, stdClass::class, true)) { | ||
assertType('class-string<DateTimeImmutable>', $a); | ||
} | ||
|
||
if (!is_a($b, stdClass::class)) { | ||
assertType('DateTimeImmutable', $b); | ||
} | ||
} |
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