mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00

RFC: https://wiki.php.net/rfc/enumerations Co-authored-by: Nikita Popov <nikita.ppv@gmail.com> Closes GH-6489.
25 lines
396 B
PHP
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
|