-
-
Notifications
You must be signed in to change notification settings - Fork 868
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(metadata): class IdentifiersExtractor now handles enums (#5411)
- Loading branch information
Showing
3 changed files
with
82 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
37 changes: 37 additions & 0 deletions
37
tests/Fixtures/TestBundle/Entity/DummyWithEnumIdentifier.php
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,37 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the API Platform project. | ||
* | ||
* (c) Kévin Dunglas <dunglas@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ApiPlatform\Tests\Fixtures\TestBundle\Entity; | ||
|
||
class DummyWithEnumIdentifier | ||
{ | ||
public $id; | ||
|
||
public function __construct( | ||
public StringEnumAsIdentifier $stringEnumAsIdentifier = StringEnumAsIdentifier::FOO, | ||
public IntEnumAsIdentifier $intEnumAsIdentifier = IntEnumAsIdentifier::FOO, | ||
) { | ||
} | ||
} | ||
|
||
enum IntEnumAsIdentifier: int | ||
{ | ||
case FOO = 1; | ||
case BAR = 2; | ||
} | ||
|
||
enum StringEnumAsIdentifier: string | ||
{ | ||
case FOO = 'foo'; | ||
case BAR = 'bar'; | ||
} |