diff --git a/language/oop5/traits.xml b/language/oop5/traits.xml index 0737cd95ee..2d4b587974 100644 --- a/language/oop5/traits.xml +++ b/language/oop5/traits.xml @@ -444,6 +444,8 @@ $example->x; If a trait defines a property then a class can not define a property with the same name unless it is compatible (same visibility and initial value), otherwise a fatal error is issued. + Before PHP 7.0.0, defining a property in the class with the same visibility + and initial value as in the trait, raised an E_STRICT notice. Conflict Resolution @@ -457,7 +459,7 @@ trait PropertiesTrait { class PropertiesExample { use PropertiesTrait; - public $same = true; // Allowed + public $same = true; // Allowed as of PHP 7.0.0; E_STRICT notice formerly public $different = true; // Fatal error } ?>