Skip to content

Add ReturnTypeWillChange attribute for offsetGet to suppress notice#1607

Merged
westonruter merged 1 commit into
trunkfrom
fix/deprecated-notice
Oct 20, 2024
Merged

Add ReturnTypeWillChange attribute for offsetGet to suppress notice#1607
westonruter merged 1 commit into
trunkfrom
fix/deprecated-notice

Conversation

@westonruter
Copy link
Copy Markdown
Member

I noticed a deprecation warning after #1585:

Return type of OD_Element::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

This adds #[ReturnTypeWillChange] attribute as suggested.

This is also used in core, for example: https://github.com/WordPress/wordpress-develop/blob/de51a4412dc3fa4d2591c59492fa76227cdddd29/src/wp-includes/class-wp-block-list.php#L81-L92

@westonruter westonruter added [Plugin] Optimization Detective Issues for the Optimization Detective plugin skip changelog PRs that should not be mentioned in changelogs labels Oct 20, 2024
@westonruter westonruter added the [Type] Bug An existing feature is broken label Oct 20, 2024
@github-actions
Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: westonruter <westonruter@git.wordpress.org>
Co-authored-by: swissspidy <swissspidy@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@westonruter westonruter merged commit 7eccb23 into trunk Oct 20, 2024
@westonruter westonruter deleted the fix/deprecated-notice branch October 20, 2024 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Plugin] Optimization Detective Issues for the Optimization Detective plugin skip changelog PRs that should not be mentioned in changelogs [Type] Bug An existing feature is broken

2 participants