How can I suppress PHPCS warnings using comments?

后端 未结 4 1764
没有蜡笔的小新
没有蜡笔的小新 2021-02-01 01:00

My TestMyClass.php has two class definitions in the same file (unit testing class), and PHP Code Sniffer complains about each class must be in a file by itself<

4条回答
  •  花落未央
    2021-02-01 01:19

    Altho I like the top answer though I'd also suggest this one if you don't care about specific files.

    Run this command:

    phpcs --config-set show_warnings 0

    as seen here: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options#hiding-warnings-by-default

    A note about setting configs this way is they will get wiped out if you delete the vendor folder or update the library and you will have to set them again.

提交回复
热议问题