[php-src] Issue #9072: Reflection : getReflectionConstants() returns ReflectionClassConstant for enum cases (in addition to `const`)
| From: | bkdotcom | Date: | Wed, 20 Jul 2022 18:37:12 +0000 |
| Subject: | [php-src] Issue #9072: Reflection : getReflectionConstants() returns ReflectionClassConstant for enum cases (in addition to `const`) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-241961@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9072
Author: bkdotcom
### Description
```php
<?php
enum Status
{
const BORING_CONSTANT = 'test';
const ENUM_VALUE = Status::PUBLISHED;
case DRAFT;
case PUBLISHED;
case ARCHIVED;
}
$reflection = new ReflectionEnum('Status');
$reflection->getReflectionConstants(); // returns ReflectionClassConstant[] - length = 5
(includes the 3 cases)
// I would expect reflection returned only for the two
const
$reflection->getCases(); // returns ReflectionEnumUnitCase[] - length 3 (the 3 cases) AS
EXPECTED
$reflection = new ReflectionClass('Status');
$reflection->getReflectionConstants(); // returns ReflectionClassConstant[] - length = 5
(includes the 3 cases)
// I would expect reflection returned only for the two const
```
### PHP Version
PHP 8.0.0
### Operating System
OSX