Skip to content

Conversation

abouvier
Copy link
Contributor

@abouvier abouvier commented Feb 3, 2022

Migrating from PHP 8.0.x to PHP 8.1.x

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.

Another solution (but incompatible with PHP < 8.0) is to add the mixed return type to CachingGenerator::current().

Also see: https://wiki.php.net/rfc/internal_method_return_types.

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.
@lunkkun
Copy link
Owner

lunkkun commented Feb 18, 2022

Thanks, I appreciate this!

@lunkkun lunkkun merged commit cd066db into lunkkun:master Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants