no-new-through-reflection.phpt 248 B

12345678910111213141516
  1. --TEST--
  2. Enum no new through reflection
  3. --FILE--
  4. <?php
  5. enum Foo {}
  6. try {
  7. (new \ReflectionClass(Foo::class))->newInstanceWithoutConstructor();
  8. } catch (Error $e) {
  9. echo $e->getMessage() . "\n";
  10. }
  11. ?>
  12. --EXPECT--
  13. Cannot instantiate enum Foo