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

PHP 8.3 | Tests: fix uses of ReflectionProperty::setValue() for static properties #5105

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Aug 28, 2023

The single parameter signature, which was used for setting the value on a static property, is deprecated since PHP 8.3. A cross-version solution is to pass null as the first parameter.

This fixes all instances of the use of the deprecated signature in WP Core.

https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures#reflectionpropertysetvalue

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


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.

…c properties

The single parameter signature, which was used for setting the value on a static property, is deprecated since PHP 8.3.
A cross-version solution is to pass `null` as the first parameter.

This fixes all instances of the use of the deprecated signature in WP Core.

https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures#reflectionpropertysetvalue
@jrfnl jrfnl force-pushed the trac-59231/fix-reflectionproperty-setvalue-for-static-properties branch from 6fee03f to 4207b5d Compare August 28, 2023 23:40
Copy link
Contributor

@costdev costdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @jrfnl!

This uses the backward-compatible approach recommended in the RFC, implements it correctly in each instance, and is good to go. 🚀

@SergeyBiryukov
Copy link
Member

Thanks for the PR! Merged in r56492.

@jrfnl jrfnl deleted the trac-59231/fix-reflectionproperty-setvalue-for-static-properties branch August 30, 2023 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants