Enum %s cannot include properties¶
Description¶
Enumeration cannot define a property. They can only define constants and methods.
Enum can use a trait, and import several methods. Traits can also define properties, which are mixed with the host. On the other hand, enum cannot define properties: when a trait is used by an enumeration, it should not have any properties. It is also the case for traits of traits.
Example¶
<?php
enum D {
private $p = 1;
}
trait T {
private int $property;
}
enum E {
use T;
}
?>
Solutions¶
Remove the property from the trait.
Split the trait in two traits, and include the new trait that has no property.