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

IfStatementAssignment error message have switched lines and columns. #683

Closed
pawelkg opened this issue Oct 18, 2019 · 3 comments
Closed

Comments

@pawelkg
Copy link

pawelkg commented Oct 18, 2019

  • PHPMD version: 2.7.0
  • PHP Version: 7.3.6
  • Installation type: composer
  • Operating System / Distribution & Version: Windows 10

Current Behavior

I get errors:
C:\Projects\sitemap\src\Helpers\Url.php:31 Avoid assigning values to variables in if clauses and the like (line '17', column '90').
C:\Projects\sitemap\src\Helpers\Url.php:31 Avoid assigning values to variables in if clauses and the like (line '17', column '91').

On this lines (2nd and 3rd line):

array_walk($query, function (&$val, &$var) {
            $var = rawurlencode($var);
            $val = rawurlencode($val);
        });

Expected Behavior

If this line should be error indeed then line and column are switched. Same behavior when output is html or xml. Other thing is if this should produce this error? I'm think not, but not sure if this is intended to work like this.

@kylekatarnls
Copy link
Member

Hi @pawelkg, it will be fixed in 2.7.1 thanks to @Jir4:
https://github.com/phpmd/phpmd/pull/657/files

@pawelkg
Copy link
Author

pawelkg commented Oct 19, 2019

Great. Please tell me also should this code produce such a message?

@kylekatarnls
Copy link
Member

Sorry, no it should not throw it, that is an other already fixed bug: #661

@ravage84 ravage84 added this to the 2.x (unspecific) milestone May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants