Merged
Conversation
…json_validate - json_validate() does not have associative parameter that json_decode() has - Remove associative arg by position (1) or name before converting - Updated fixture files to reflect correct expected output
samsonasik
approved these changes
Jan 29, 2026
Member
|
LGTM, thank you 👍 |
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.
When the JsonValidateRector rule converts the json_decode function call to a json_validate function call, it incorrectly preserves the "associative" parameter if it is present. This is wrong because json_validate does not have an "associative" argument (it does not create json output, so this argument would be useless). This results in code which is either incorrect (passing the associative parameter to the flags argument) or an error if named arguments are used.
See https://getrector.com/demo/99b22fb6-f24a-485d-a5fe-e402ed53f886
This PR fixes this problem by removing the "associative" parameter if present. It also updates existing fixtures so that they show the new, correct, output
Fixes rectorphp/rector#9623