Skip to content

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Aug 10, 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.

With the latter in mind, this commit prevents the deprecation notice by making the calls to setAccessible() conditional.

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

…setAccessible()

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.

With the latter in mind, this commit prevents the deprecation notice by making the calls to `setAccessible()` conditional.

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
@jrfnl jrfnl force-pushed the feature/fix-runtime-deprecations-php-8.5 branch from 00e20e4 to 5f0c012 Compare August 10, 2025 03:34
@antecedent antecedent merged commit 87d042e into master Aug 11, 2025
20 checks passed
@jrfnl jrfnl deleted the feature/fix-runtime-deprecations-php-8.5 branch August 11, 2025 13:43
@jrfnl jrfnl added this to the 2.2 Next milestone Aug 11, 2025
@jrfnl
Copy link
Collaborator Author

jrfnl commented Aug 13, 2025

@antecedent No rush, but it might be a good idea to get this fix released sooner rather than later as the deprecation notice may block other projects from testing their PHP 8.5 readiness...

@jrfnl
Copy link
Collaborator Author

jrfnl commented Aug 13, 2025

Having said that, not all PHP 8.5 deprecation have been merged yet, so there may be more fixes needed soon enough. Then again, no harm in having some small incremental releases to get through them all.

@antecedent
Copy link
Owner

Makes sense. I'll push a new tag in a bit.

@antecedent
Copy link
Owner

The GH Action for running tests fails with PHP 7.3 and 8.5 now. The 7.3 thing seems completely accidental and has happened before. It fails at the Setup PHP step; rerunning the Action "fixes" this. The 8.5 thing, on the other hand, seems to be due to something depending on an outdated version of reactphp/promise, which produces a deprecation notice under PHP 8.5. I cannot look into this further at the present moment, but will be able to tomorrow.

@jrfnl
Copy link
Collaborator Author

jrfnl commented Aug 18, 2025

@antecedent Ah, yes, the composer install fails on PHP 8.5 are related to reactphp/promise#264 - I've been monitoring that situation for the past week, but so far no new release.

Let me pull a quick work-around, which should allow the tests to run on PHP 8.5 again. Once Promise + Composer have released new versions, that work-around can be reverted again.

@jrfnl
Copy link
Collaborator Author

jrfnl commented Aug 18, 2025

@antecedent See PR #177

@antecedent
Copy link
Owner

@jrfnl This is great, thanks!

I moved the 2.2.2 release out of draft status.

@jrfnl
Copy link
Collaborator Author

jrfnl commented Aug 19, 2025

Thanks @antecedent !

@jrfnl jrfnl modified the milestones: 2.2 Next, 2.2.2 Sep 17, 2025
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