Skip to content

ext/reflection: improve error messages - #22813

Merged
DanielEScherzer merged 4 commits into
php:masterfrom
DanielEScherzer:reflection-cleanup-202607-errors
Jul 27, 2026
Merged

ext/reflection: improve error messages#22813
DanielEScherzer merged 4 commits into
php:masterfrom
DanielEScherzer:reflection-cleanup-202607-errors

Conversation

@DanielEScherzer

Copy link
Copy Markdown
Member

No description provided.

Comment thread ext/reflection/php_reflection.c
@DanielEScherzer
DanielEScherzer force-pushed the reflection-cleanup-202607-errors branch from 50f10a5 to 3654d2b Compare July 27, 2026 16:42
@DanielEScherzer

Copy link
Copy Markdown
Member Author

Rebased, will merge locally so that commits stay signed once CI passes

Add tests for the four error cases in
`reflection_property_check_lazy_compatible()`, as triggered by both
`ReflectionProperty::setRawValueWithoutLazyInitialization()` and
`ReflectionProperty::skipLazyInitialization()`. While some of these errors are
covered by existing tests, having all of the errors in one place will make it
easier to see the changes when the error messages are improved.
Improve error messages from `reflection_property_check_lazy_compatible()`, as
triggered by both `ReflectionProperty::setRawValueWithoutLazyInitialization()`
and `ReflectionProperty::skipLazyInitialization()`. Say "cannot" instead of
"can not", and include parentheses after the method name.
…error

Align with other Reflection exceptions for missing class properties (and
methods, constants, etc.) by changing the message to
"Property %s::$%s does not exist".
@DanielEScherzer
DanielEScherzer force-pushed the reflection-cleanup-202607-errors branch from 3654d2b to a5e34c6 Compare July 27, 2026 17:37
@DanielEScherzer
DanielEScherzer merged commit a5e34c6 into php:master Jul 27, 2026
2 of 3 checks passed
@DanielEScherzer
DanielEScherzer deleted the reflection-cleanup-202607-errors branch July 27, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants