diff --git a/language/predefined/attributes/returntypewillchange.xml b/language/predefined/attributes/returntypewillchange.xml index 12f7f83961c6..f5f54acea897 100644 --- a/language/predefined/attributes/returntypewillchange.xml +++ b/language/predefined/attributes/returntypewillchange.xml @@ -7,15 +7,28 @@
&reftitle.intro; - + Most non-final internal methods now require overriding methods to declare a compatible return type, otherwise a deprecated notice is emitted during - inheritance validation. + inheritance validation. This introduces a tentative return type phase: + the engine emits a deprecation notice instead of a fatal error when return + types are incompatible, before they become enforced in a future version. In case the return type cannot be declared for an overriding method due to PHP cross-version compatibility concerns, a #[\ReturnTypeWillChange] attribute can be added to silence the deprecation notice. - + + + + + The ReturnTypeWillChange attribute suppresses + deprecation warnings during the tentative return type phase only. + It has no effect when overriding methods defined in user-defined classes. + Once internal methods adopt strict types, mismatches in overriding method + signatures will cause a fatal error and this attribute will no longer have any effect. + + +