Conversation
Contributor
this world is cursed: now 1 function call need to be ai-slopped 🤦 |
…ption isInitialized() built a ReflectionProperty before checking anything, so an object that lacks the property escaped a raw ReflectionException instead of the InvalidArgumentException every assertion promises. Test property_exists first; the accepted set is unchanged since it is true for declared and dynamic properties alike.
lenamonj
force-pushed
the
fix-is-initialized-absent-property
branch
from
September 13, 2026 19:04
9bbcb2a to
f1e828e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Assert::isInitialized(json_decode('{}'), 'name')throwsReflectionException: Property stdClass::$name does not existinstead ofInvalidArgumentException, so a caller catching the documented type does not catch it. Same for any object lacking the property (ArrayObject,'storage').Cause: a
ReflectionPropertyis built before anything is checked.Change: test
property_exists()first. The accepted set is unchanged (property_existsis true for declared and dynamic properties alike); only the exception type on the absent-property path changes. Two rows added to the shared provider.Verified:
composer run test4920 tests green on PHP 8.4 (both rows fail with theReflectionExceptionbefore the fix),cs-checkandstatic-analysisclean.Found by an automated code-review loop I run; the fix and this description were prepared with Claude and verified by hand.