traits-no-properties.phpt 396 B

12345678910111213141516171819202122232425
  1. --TEST--
  2. Enum cannot have properties, even via traits
  3. --FILE--
  4. <?php
  5. trait Rectangle {
  6. protected string $shape = "Rectangle";
  7. public function shape(): string {
  8. return $this->shape;
  9. }
  10. }
  11. enum Suit {
  12. use Rectangle;
  13. case Hearts;
  14. case Diamonds;
  15. case Clubs;
  16. case Spades;
  17. }
  18. ?>
  19. --EXPECTF--
  20. Fatal error: Enum "Suit" may not include properties in %s on line %d