Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Modernization: Silence the deprecation warning for missing return type in src/wp-includes/Requests/Cookie/Jar.php. #1798

Closed
wants to merge 1 commit into from

Conversation

anomiex
Copy link

@anomiex anomiex commented Nov 2, 2021

This fixes the "Deprecated: Return type of Requests_Cookie_Jar::offsetExists() should be compatible with ArrayAccess::offsetExists(): bool" and similar warnings on PHP 8.1.

PHP native interfaces now have declared return types and methods in classes implementing these interfaces need to either have the return type declared (in a covariant compatible manner with the PHP native interface method declaration), or need to silence the deprecation warning using the #[ReturnTypeWillChange] attribute.

Trac ticket: https://core.trac.wordpress.org/ticket/53635


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

…n type in `src/wp-includes/Requests/Cookie/Jar.php`.

This fixes the "Deprecated: Return type of
`Requests_Cookie_Jar::offsetExists()` should be compatible with
`ArrayAccess::offsetExists(): bool`" and similar warnings on PHP 8.1.

PHP native interfaces now have declared return types and methods in
classes implementing these interfaces need to either have the return
type declared (in a covariant compatible manner with the PHP native
interface method declaration), or need to silence the deprecation
warning using the `#[ReturnTypeWillChange]` attribute.

See https://core.trac.wordpress.org/ticket/53635
@hellofromtonya
Copy link
Contributor

Hello @anomiex and thank you for your contribution. The fixes in this PR are for an external library, i.e. Requests. Fixes for this library should be made in its repo https://github.com/wordpress/requests and not in Core itself. Once Requests releases a new version, then Core will be updated.

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