-
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.
Fix missing properties on UnitEnum and BackedEnum
- Loading branch information
1 parent
a712907
commit 67d3a88
Showing
4 changed files
with
81 additions
and
8 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,53 @@ | ||
<?php // lint >= 8.1 | ||
|
||
namespace Bug6385; | ||
|
||
use BackedEnum; | ||
use UnitEnum; | ||
|
||
final class EnumValue | ||
{ | ||
public readonly string $name; | ||
public readonly string $value; | ||
|
||
public function __construct( | ||
BackedEnum | string $name, | ||
BackedEnum | string $value | ||
) { | ||
$this->name = $name instanceof BackedEnum ? $name->name : $name; | ||
$this->value = $value instanceof BackedEnum ? $value->name : $value; | ||
} | ||
} | ||
|
||
enum ActualUnitEnum | ||
{ | ||
|
||
} | ||
|
||
enum ActualBackedEnum: int | ||
{ | ||
|
||
} | ||
|
||
class Foo | ||
{ | ||
|
||
public function doFoo( | ||
UnitEnum $unitEnum, | ||
BackedEnum $backedEnum, | ||
ActualUnitEnum $actualUnitEnum, | ||
ActualBackedEnum $actualBackedEnum | ||
) | ||
{ | ||
echo $unitEnum->name; | ||
echo $unitEnum->value; | ||
echo $backedEnum->name; | ||
echo $backedEnum->value; | ||
echo $actualUnitEnum->name; | ||
echo $actualUnitEnum->value; | ||
echo $actualBackedEnum->name; | ||
echo $actualBackedEnum->value; | ||
|
||
} | ||
|
||
} |