The ReturnTypeWillChange attribute

- « Override::__construct

- ReturnTypeWillChange::__construct »

- PHP Manual
- Predefined Attributes
- The ReturnTypeWillChange attribute

# The ReturnTypeWillChange attribute

(PHP 8 >= 8.1.0)

## Introduction

Most non-final internal methods now require overriding methods to declare a compatible return type, otherwise a deprecated notice is emitted during inheritance validation. 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.

## Class synopsis

final class ReturnTypeWillChange {
/* Methods */
public __construct()
}

## See Also

Attributes overview

## Table of Contents

- ReturnTypeWillChange::__construct — Construct a new ReturnTypeWillChange attribute instance