php-src icon indicating copy to clipboard operation
php-src copied to clipboard

ReflectionEnum::isInstantiable() returns true

Open Crell opened this issue 4 years ago • 1 comments

Description

The following code:

<?php
enum A {
    case B;
}

$e = new ReflectionEnum(A::class);
var_dump($e->isInstantiable());

Resulted in this output:

bool(true)

But I expected this output instead:

bool(false)

Enums (as of 8.1) are never instantiable, so isInstantiable() should always return false.

PHP Version

8.1.1

Operating System

No response

Crell avatar Jan 05 '22 20:01 Crell

Also bug 81681 and 8.1.2.

damianwadley avatar Jan 05 '22 20:01 damianwadley