Skip to content

Conversation

@Pross
Copy link
Contributor

@Pross Pross commented Aug 22, 2025

Since PHP 8.1, calling the Reflection*::setAccessible() methods is no longer necessary as reflected properties/methods/etc will always be accessible. However, the method calls are still needed for PHP < 8.1.

As of PHP 8.5, calling the Reflection*::setAccessible() methods is now formally deprecated and will yield a deprecation notice, which will fail test runs. As of PHP 9.0, the setAccessible() method(s) will be removed.

Silencing the deprecation would mean, this would need to be "fixed" again come PHP 9.0, while the current solution should be stable, including for PHP 9.0.

Ref: https://wiki.php.net/rfc/deprecations_php_8_5#extreflection_deprecations

Fixes #1025

Pross added 2 commits August 22, 2025 13:09
Since PHP 8.1, calling the Reflection*::setAccessible() methods is no longer necessary as reflected properties/methods/etc will always be accessible. However, the method calls are still needed for PHP < 8.1.

As of PHP 8.5, calling the Reflection*::setAccessible() methods is now formally deprecated and will yield a deprecation notice, which will fail test runs. As of PHP 9.0, the setAccessible() method(s) will be removed.

Silencing the deprecation would mean, this would need to be "fixed" again come PHP 9.0, while the current solution should be stable, including for PHP 9.0.

Ref: https://wiki.php.net/rfc/deprecations_php_8_5#extreflection_deprecations

Fixes johnbillion#1025
@johnbillion johnbillion added this to the 3.20.0 milestone Aug 22, 2025
@johnbillion
Copy link
Owner

Thanks for the PR!

@Pross
Copy link
Contributor Author

Pross commented Aug 22, 2025

Thanks for the PR!

Props to composer which is where I stole it ;)

@johnbillion johnbillion merged commit 44db394 into johnbillion:develop Aug 24, 2025
50 of 55 checks passed
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.

Deprecation Notice: Method ReflectionProperty::setAccessible() is deprecated since 8.5

2 participants