You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when running ./vendor/bin/phpmd tests/Something.php ansi phpmd.xml I get Found 0 violations and 0 errors in 101ms
when I add the --strict option (./vendor/bin/phpmd tests/Something.php ansi phpmd.xml --strict) the output shows:
FILE: ***********/Something.php
------------------------------------------------------------------
20 | VIOLATION | Avoid unused local variables such as '$y'.
20 | VIOLATION | Avoid using undefined variables such as '$y' which will lead to PHP notices.
Expected Behavior
I would expect the CountInLoopExpression violation to be found as well when running in strict mode.
FILE: ***********/Something.php
------------------------------------------------------------------
11 | VIOLATION | Avoid using Test\Bas\TradeWebsite\count() function in while loops.
15 | VIOLATION | Avoid unused local variables such as '$y'.
15 | VIOLATION | Avoid using undefined variables such as '$y' which will lead to PHP notices.
I can see in the XML output the priority of CountInLoopExpression is set to 2 and the others are priority 3. This could explain why it doesn't show in strict mode. However as a user of PHMD on the CLI and visitor of the website this behaviour isn't documented. So in my eyes the expected behaviour could also be as is but some clarification in the tool or website is missing.
Steps To Reproduce:
Take the above code snippet and run it with ./vendor/bin/phpmd tests/Something.php ansi phpmd.xml --strict
Checks before submitting
Be sure that there isn't already an issue about this. See: Issues list
Be sure that there isn't already a pull request about this. See: Pull requests
I have added every step to reproduce the bug.
If possible I added relevant code examples.
This issue is about 1 bug and nothing more.
The issue has a descriptive title. For example: "JSON rendering failed on Windows for filenames with space".
The text was updated successfully, but these errors were encountered:
Current Behavior
Using the following code snippet
when running
./vendor/bin/phpmd tests/Something.php ansi phpmd.xml
I getFound 0 violations and 0 errors in 101ms
when I add the
--strict
option (./vendor/bin/phpmd tests/Something.php ansi phpmd.xml --strict
) the output shows:Expected Behavior
I would expect the
CountInLoopExpression
violation to be found as well when running in strict mode.I can see in the XML output the priority of
CountInLoopExpression
is set to 2 and the others are priority 3. This could explain why it doesn't show in strict mode. However as a user of PHMD on the CLI and visitor of the website this behaviour isn't documented. So in my eyes the expected behaviour could also be as is but some clarification in the tool or website is missing.Steps To Reproduce:
Take the above code snippet and run it with
./vendor/bin/phpmd tests/Something.php ansi phpmd.xml --strict
Checks before submitting
The text was updated successfully, but these errors were encountered: