From cc8ca605308635ac8d660b5be8c7edcd5fcf4ccc Mon Sep 17 00:00:00 2001 From: Christoph Michael Becker Date: Fri, 17 Mar 2017 13:36:48 +0000 Subject: [PATCH] PHP 5 behaved slightly different r342129 only documented the PHP 7 behavior, but the manual is supposed to describe PHP 5, too. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@342154 c90b9560-bf6c-de11-be94-00142212c4b1 --- language/oop5/traits.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 } ?>