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
If an error was ignored with a baseline, and then the file containing the error, phpstan doesn't notice that the error is not matched anymore because it doesn't analyze deleted files (obviously).
When cache is deleted, the error about unmatched error is shown.
Code snippet that reproduces the problem
$ echo '<?php print "abc";' > ok.php
$ echo '<?php print "abc" + 1;' > notok.php
$ /path/to/phpstan/bin/phpstan analyze --error-format=baselineNeon --level 8 . | tee phpstan-baseline.neon
2/2 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
parameters:
ignoreErrors:
-
message: "#^Binary operation \"\\+\" between 'abc' and 1 results in an error\\.$#"
count: 1
path: notok.php
$ echo -e "includes:\n - phpstan-baseline.neon" > phpstan.neon
$ /path/to/phpstan/bin/phpstan analyze -c phpstan.neon --level 8 .
2/2 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
[OK] No errors
$ rm notok.php
$ /path/to/phpstan/bin/phpstan analyze -c phpstan.neon --level 8 .
1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
[OK] No errors
$ rm -rf /tmp/phpstan/
$ /path/to/phpstan/bin/phpstan analyze -c phpstan.neon --level 8 .
1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
-- ---------------------------------------------------------------------------------------------------
Error
-- ---------------------------------------------------------------------------------------------------
Ignored error pattern #^Binary operation "\+" between 'abc' and 1 results in an error\.$# in path
/home/teemu/phpstantest/ignored_error/notok.php was not matched in reported errors.
-- ---------------------------------------------------------------------------------------------------
[ERROR] Found 1 error
Expected output
Error about ignored error not matched should be shown when running phpstan after deleting a file with an ignored error.
The text was updated successfully, but these errors were encountered:
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
BTW: Did you know that PHPStan now has a brand new website with a user guide, guide to writing analyser-friendly PHP code, and a guide to developing PHPStan extensions? Visit phpstan.org today!
lockbot
locked as resolved and limited conversation to collaborators
Apr 17, 2020
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Bug report
If an error was ignored with a baseline, and then the file containing the error, phpstan doesn't notice that the error is not matched anymore because it doesn't analyze deleted files (obviously).
When cache is deleted, the error about unmatched error is shown.
Code snippet that reproduces the problem
Expected output
Error about ignored error not matched should be shown when running phpstan after deleting a file with an ignored error.
The text was updated successfully, but these errors were encountered: