-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php declare(strict_types=1); // lint >= 8.1 | ||
|
||
namespace Bug7162; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
class HelloWorld | ||
{ | ||
|
||
/** | ||
* @param class-string<\BackedEnum> $enumClassString | ||
*/ | ||
public static function casesWithLabel(string $enumClassString): void | ||
{ | ||
foreach ($enumClassString::cases() as $unitEnum) { | ||
assertType('BackedEnum', $unitEnum); | ||
} | ||
} | ||
} | ||
|
||
enum Test{ | ||
case ONE; | ||
} | ||
|
||
/** | ||
* @phpstan-template TEnum of \UnitEnum | ||
* @phpstan-param TEnum $case | ||
*/ | ||
function dumpCases(\UnitEnum $case) : void{ | ||
assertType('array<TEnum of UnitEnum (function Bug7162\\dumpCases(), argument)>', $case::cases()); | ||
} | ||
|
||
function dumpCases2(Test $case) : void{ | ||
assertType('array{Bug7162\\Test::ONE}', $case::cases()); | ||
} |