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
The sniff overrides the token content of PHPCS ignore annotations to allow for fixing these but doesn't revert that change correctly once the sniff is done, which means that this change will affect all sniffs and breaks the PHPCS native ignore annotation handling.
@jrfnl Nice catch, thanks. I was looking into it, and I cannot find a solution. Looks like from the very beginning this sniff was not working properly. As I see all errors are cleared in the File class when ignoreFile annotation is found, and I guess it is not possible to report just error from this sniff and ignore everything else?
I bet I would need to deprecate this sniff and kill it, or... just keep as is with the warning about this unexpected behaviour.
Will you have a second to advise what you think? Thanks 🙏
@michalbundyra Just by looking at this sniff alone, all I can think of is to undo the token override after the if block within the while loop.
Should probably be done by storing the original value and restoring it (and getting rid of the overrideToken method).
But if that doesn't work or doesn't work reliably enough, then yes, killing this sniff would be better as this hacking of the PHPCS native File object is problematic.
The sniff overrides the token content of PHPCS ignore annotations to allow for fixing these but doesn't revert that change correctly once the sniff is done, which means that this change will affect all sniffs and breaks the PHPCS native ignore annotation handling.
The issue is straight-forward to reproduce.
Given the below file:
When running this command:
I'd expect to see no errors. Instead I get 6.
The text was updated successfully, but these errors were encountered: