-
-
Notifications
You must be signed in to change notification settings - Fork 1
fix(foxy): Fix PHP 8.5 deprecation of setAccessible() in ReflectionProperty class.
#114
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
Conversation
terabytesoftw
commented
Jan 22, 2026
| Q | A |
|---|---|
| Is bugfix? | ✔️ |
| New feature? | ❌ |
| Breaks BC? | ❌ |
…Property` class.
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR modernizes PHP 8.5 compatibility by conditionally gating ReflectionProperty::setAccessible() calls to PHP versions below 8.5, updates CI workflow configuration and references, and documents associated bug fixes in the changelog. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #114 +/- ##
===========================================
Coverage 100.00% 100.00%
- Complexity 347 348 +1
===========================================
Files 26 26
Lines 802 803 +1
===========================================
+ Hits 802 803 +1 ☔ View full report in Codecov by Sentry. |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@CHANGELOG.md`:
- Line 17: Update the changelog entry text to include the missing preposition
"of": replace the line reading "Fix PHP `8.5` deprecation `setAccessible()` in
`ReflectionProperty` class" with "Fix PHP `8.5` deprecation of `setAccessible()`
in `ReflectionProperty` class" so the phrase is grammatically correct; locate
and edit the exact string in CHANGELOG.md.
In `@tests/FoxyTest.php`:
- Around line 150-152: Replace the fully-qualified constant usage
\PHP_VERSION_ID with the unqualified PHP_VERSION_ID for consistency across the
test (e.g., where it's used in the conditional around
assetFallbackProperty->setAccessible(true) and the other occurrences noted),
ensuring all checks use the imported PHP_VERSION_ID constant uniformly; update
the occurrences at the shown conditional and the similar block at 159-161 to the
unqualified form.
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
.github/workflows/build.ymlCHANGELOG.mdsrc/Util/ConsoleUtil.phptests/FoxyTest.php
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: terabytesoftw
Repo: php-forge/support PR: 11
File: tests/AssertTest.php:82-89
Timestamp: 2025-08-18T15:47:45.406Z
Learning: In PHP 8.1+, the RFC "Make Reflection setAccessible() a no-op" was implemented. This means ReflectionProperty and ReflectionMethod can access private and protected members automatically without requiring setAccessible(true) calls. The setAccessible() method still exists for backward compatibility but has no effect.
Learnt from: terabytesoftw
Repo: php-forge/support PR: 12
File: src/TestSupport.php:0-0
Timestamp: 2025-08-18T20:13:33.518Z
Learning: User terabytesoftw prefers clean trait-based designs over maintaining backward compatibility wrappers when refactoring utility classes in the php-forge/support project.
Learnt from: terabytesoftw
Repo: php-forge/actions PR: 65
File: .github/workflows/composer-require-checker.yml:80-83
Timestamp: 2025-09-28T15:12:48.345Z
Learning: The user terabytesoftw prefers using floating tags like v1 for third-party actions in GitHub workflows instead of pinning to specific commit SHAs, even when it's a security best practice to pin to immutable commits.
📚 Learning: 2025-08-18T15:47:45.406Z
Learnt from: terabytesoftw
Repo: php-forge/support PR: 11
File: tests/AssertTest.php:82-89
Timestamp: 2025-08-18T15:47:45.406Z
Learning: In PHP 8.1+, the RFC "Make Reflection setAccessible() a no-op" was implemented. This means ReflectionProperty and ReflectionMethod can access private and protected members automatically without requiring setAccessible(true) calls. The setAccessible() method still exists for backward compatibility but has no effect.
Applied to files:
src/Util/ConsoleUtil.phptests/FoxyTest.php
📚 Learning: 2026-01-22T11:42:32.878Z
Learnt from: terabytesoftw
Repo: php-forge/foxy PR: 111
File: tests/Fallback/AssetFallbackTest.php:98-98
Timestamp: 2026-01-22T11:42:32.878Z
Learning: When using xepozz/internal-mocker in PHP tests, the library's namespaced wrapper records and matches function calls with all default parameters filled in. To ensure proper matching, always specify every parameter in MockerState::addCondition(), including defaults. For example, a call to file_get_contents($path) is observed as file_get_contents($path, false, null, 0, null). Use the same complete argument list (including default values) when adding conditions for mocks in tests like tests/Fallback/AssetFallbackTest.php.
Applied to files:
tests/FoxyTest.php
🔇 Additional comments (6)
src/Util/ConsoleUtil.php (1)
21-22: LGTM! Clean implementation of the PHP 8.5 deprecation fix.The version-gated
setAccessible()call correctly avoids the deprecation warning in PHP 8.5+ while maintaining backward compatibility. Based on learnings, since PHP 8.1+setAccessible()is a no-op anyway, so the functional behavior is preserved across all supported versions.Also applies to: 41-45
.github/workflows/build.yml (3)
15-16: Good addition of explicit permissions.Adding
permissions: contents: readfollows the principle of least privilege for GitHub Actions workflows, reducing the attack surface.
3-11: Clean refactor using YAML anchors.The use of YAML anchor (
&ignore-paths) and alias (*ignore-paths) eliminates duplication betweenpull_requestandpushtriggers effectively.
20-20: Change phpunit workflow reference to usephp-forge/actionsfor consistency.The phpunit workflow references
yii2-framework/actions, but the other workflows in this repository (dependency-check.yml and ecs.yml) both usephp-forge/actions. This should beuses: php-forge/actions/.github/workflows/phpunit.yml@mainto maintain consistency with the repository's action references.Likely an incorrect or invalid review comment.
tests/FoxyTest.php (2)
31-32: LGTM! Correct import for PHP_VERSION_ID constant.
182-206: LGTM! Version-gated setAccessible() calls are correctly implemented.The conditional checks properly guard against calling the deprecated
setAccessible()method on PHP 8.5+, maintaining backward compatibility for older versions.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
8.5 deprecation setAccessible() in ReflectionProperty class.8.5 deprecation of setAccessible() in ReflectionProperty class.