Skip to content
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

[DowngradePhp72] Fix downgrade json null as true for DowngradeJsonDecodeNullAssociativeArgRector #1724

Merged
merged 2 commits into from
Jan 25, 2022

Conversation

samsonasik
Copy link
Member

@TomasVotruba this PR try to fix json_decode null arg, which it should be replaced to true instead of false as null and true means return associative array.

@samsonasik samsonasik enabled auto-merge (squash) January 25, 2022 10:23
@samsonasik
Copy link
Member Author

For possibly null, it seems needs to be handled with add if null check before use it:

+    if ($associative === null) {
+          $associative = true;        
+    }

    $value = json_decode($json, $associative);

@samsonasik samsonasik enabled auto-merge (squash) January 25, 2022 10:38
@samsonasik samsonasik merged commit 420dc93 into main Jan 25, 2022
@samsonasik samsonasik deleted the fix-downgrade-json-null branch January 25, 2022 10:42
@samsonasik
Copy link
Member Author

@TomasVotruba it works 🎉

Screen Shot 2022-01-25 at 17 52 30

@TomasVotruba
Copy link
Member

Awesome work, thank you 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants