php-src/Zend/tests/enum/traits-no-properties.phpt
2022-08-23 13:32:34 +02:00

25 lines
393 B
PHP

--TEST--
Enum cannot have properties, even via traits
--FILE--
<?php
trait Rectangle {
protected string $shape = "Rectangle";
public function shape(): string {
return $this->shape;
}
}
enum Suit {
use Rectangle;
case Hearts;
case Diamonds;
case Clubs;
case Spades;
}
?>
--EXPECTF--
Fatal error: Enum Suit cannot include properties in %s on line %d