-
-
Notifications
You must be signed in to change notification settings - Fork 51
Fix PHP 8.4 compatibility for getModifiers() method - remove incorrect IS_PRIVATE_SET for readonly properties #152
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: lisachenko <[email protected]>
@copilot review test fail with getModifiers() method on php8.4 and fix it |
- Add conditional handling for new PHP 8.4 asymmetric visibility constants - Support IS_PRIVATE_SET and IS_PROTECTED_SET when available - Maintain backward compatibility with older PHP versions - Add placeholder methods for future parser support of asymmetric visibility - Addresses test failures with getModifiers() method on PHP 8.4 Co-authored-by: lisachenko <[email protected]>
Fixed the |
@copilot switch to the php8.4 as default runtime version. Your last commit doesn't help, still tests are failing on PHP8.4 version. See below errors:
Also please enable for phpunit reporting of deprecation errors in output, so we can fix them as well for php8.4 |
…perties Co-authored-by: lisachenko <[email protected]>
Fixed the Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: lisachenko <[email protected]>
@copilot there are few more new errors during test run on PHP8.4
|
…and prioritize PHP 8.4 in CI Co-authored-by: lisachenko <[email protected]>
... Fixed the getModifiers() method to correctly handle PHP 8.4 compatibility. The issue was that readonly properties were incorrectly getting the IS_PRIVATE_SET flag automatically. The IS_PRIVATE_SET flag should only be added for explicit asymmetric visibility syntax (like |
The inspection completed: No new issues |
This PR fixes PHP 8.4 compatibility issues with the
getModifiers()
method inReflectionProperty
that were causing test failures due to incorrect handling of readonly properties.The Problem
The initial fix incorrectly assumed that readonly properties automatically receive the
IS_PRIVATE_SET
flag in PHP 8.4. This caused test failures where our implementation returned values like 2180 (IS_PUBLIC + IS_READONLY + IS_PRIVATE_SET
) while native PHP reflection returned 132 (IS_PUBLIC + IS_READONLY
).The failing tests included:
name
andvalue
in enums)public readonly int $prop
)The Fix
Corrected the
getModifiers()
method to understand that:IS_PRIVATE_SET
andIS_PROTECTED_SET
flags are only for explicit asymmetric visibility syntax likepublic private(set) $prop
Additional Changes
This resolves all 7 failing
getModifiers()
tests on PHP 8.4 while maintaining backward compatibility with earlier PHP versions.Fixes #151.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.