diff --git a/language/oop5/traits.xml b/language/oop5/traits.xml index 20c4bbcfcf04..def5f124b25a 100644 --- a/language/oop5/traits.xml +++ b/language/oop5/traits.xml @@ -466,8 +466,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. + the same name unless it is compatible (same visibility and type, + readonly modifier, and initial value), otherwise a fatal error is issued. Conflict Resolution @@ -476,13 +476,17 @@ $example->x; ]]> @@ -490,6 +494,56 @@ class PropertiesExample { + + &Constants; + + Traits can, as of PHP 8.2.0, also define constants. + + + Defining Constants + + +]]> + + + + If a trait defines a constants then a class can not define a constants with + the same name unless it is compatible (same visibility, initial value, and + finality), otherwise a fatal error is issued. + + + Conflict Resolution + + +]]> + + + +