ReturnTypeWillChange
Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.
ReturnTypeWillChange
Референца за `class.returntypewillchange.php` со подобрена типографија и навигација.
Атрибутот ReturnTypeWillChange
(PHP 8 >= 8.1.0)
Вовед
Most non-final internal methods now require overriding methods to declare a compatible return type, otherwise a deprecated notice is emitted during 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] Ако типот на враќање не може да се декларира за надредена метода поради проблеми со компатибилноста на PHP верзиите, може да се додаде
На 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.
Синопсис на класата
Види Исто така
Содржина
- ReturnTypeWillChange::__construct — Конструирај нова инстанца на атрибутот ReturnTypeWillChange