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

"JSON encoding API usage" inspection works wrong when using PHP 8 named arguments feature #1845

Open
Stalinko opened this issue Aug 10, 2022 · 1 comment

Comments

@Stalinko
Copy link

Subject Details
Plugin Php Inspections (EA Extended) v.4.0.7.1
Language level PHP 8.0+

Current behaviour

$decoded = json_decode('{"this is": "json"}', true, flags: JSON_THROW_ON_ERROR);

Shows a warning Please consider taking advantage of JSON_THROW_ON_ERROR flag for this call options.
If I click this warning then it will turn the code into:

$decoded = json_decode('{"this is": "json"}', true, JSON_THROW_ON_ERROR, JSON_THROW_ON_ERROR);

Expected behaviour

It shouldn't show a warning because this argument is already set.

Environment details

PHP 8 Named Arguments feature: https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments

@jdreesen
Copy link
Contributor

Duplicate of #1725, #1639 and #1807

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

No branches or pull requests

2 participants