-
Notifications
You must be signed in to change notification settings - Fork 483
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TypeSpecifier - handle AlwaysRememberedExpr in handling Identical
- Loading branch information
1 parent
987fb32
commit a769a1c
Showing
5 changed files
with
169 additions
and
44 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,52 @@ | ||
<?php // lint >= 8.1 | ||
|
||
namespace Bug9499; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
enum FooEnum | ||
{ | ||
case A; | ||
case B; | ||
case C; | ||
case D; | ||
} | ||
|
||
class Foo | ||
{ | ||
public function __construct(public readonly FooEnum $f) | ||
{ | ||
} | ||
} | ||
|
||
function test(FooEnum $f, Foo $foo): void | ||
{ | ||
$arr = ['f' => $f]; | ||
match ($arr['f']) { | ||
FooEnum::A, FooEnum::B => match ($arr['f']) { | ||
FooEnum::A => 'a', | ||
FooEnum::B => 'b', | ||
}, | ||
default => '', | ||
}; | ||
match ($foo->f) { | ||
FooEnum::A, FooEnum::B => match ($foo->f) { | ||
FooEnum::A => 'a', | ||
FooEnum::B => 'b', | ||
}, | ||
default => '', | ||
}; | ||
} | ||
|
||
function test2(FooEnum $f, Foo $foo): void | ||
{ | ||
$arr = ['f' => $f]; | ||
match ($arr['f']) { | ||
FooEnum::A, FooEnum::B => assertType(FooEnum::class . '::A|' . FooEnum::class . '::B', $arr['f']), | ||
default => '', | ||
}; | ||
match ($foo->f) { | ||
FooEnum::A, FooEnum::B => assertType(FooEnum::class . '::A|' . FooEnum::class . '::B', $foo->f), | ||
default => '', | ||
}; | ||
} |