Don't emit warnings for circular values#56
Open
martinstuecklschwaiger wants to merge 3 commits into
Open
Conversation
* Tests for circular references * Tests for `[…, null]` values
If the second value entry is null, we should still print the object error message. `isset()` doesn't match it though.
print_r() handles circular references nicely, but var_export() emits a warning.
mnapoli
reviewed
Apr 14, 2026
|
|
||
| $exception = NotCallableException::fromInvalidCallable($a); | ||
|
|
||
| $this->assertStringContainsString('is not a callable', $exception->getMessage()); |
Member
There was a problem hiding this comment.
Why not assert on the entire message? (that we we know what the exception message will be, here I'm not sure what it will be)
mnapoli
reviewed
Apr 14, 2026
|
|
||
| $exception = NotCallableException::fromInvalidCallable($a, true); | ||
|
|
||
| $this->assertStringContainsString('is neither a callable nor a valid container entry', $exception->getMessage()); |
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.
This fixes warnings for edge cases in
NotCallableException::fromInvalidCallable():$valuecontains a circular reference,var_export()would emit a warning. This fixes it by usingprint_r()instead.[SomeObject, null]would not be treated in the "object" if-branch, becausenullwouldn't be treated as a value byisset().The problem is documented with tests that previously would emit a warning, but not anymore.