php-src/Zend/tests/enum/traits-no-properties.phpt
Ilija Tovilo 269c8dac1d
Implement enums
RFC: https://wiki.php.net/rfc/enumerations

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>

Closes GH-6489.
2021-03-17 19:08:03 +01:00

25 lines
396 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" may not include properties in %s on line %d