C.65 PhpCSTask

This task runs PHP_CodeSniffer Version 3+ to detect violations of a defined set of coding standards.

Table C.85: Attributes

NameTypeDescriptionDefaultRequired
fileStringFile or directory to check.n/aYes
binStringPath to phpcs binary.phpcsNo
standardStringThe list of coding standards to test against. Separated by space, comma or semicolon. No
formatStringThe output format. (ex checkstyle, full, summary, ...) No
outfileStringFilename to write output/report to. If not set output will be sent to STDOUT.n/aNo
cacheBooleanCache results between runs.falseNo
ignoreAnnotationsBooleanIgnore all phpcs annotations in code comments.falseNo
checkreturnBooleanWhether to check the return code.falseNo
levelStringSet the log level of generated messages. Change this to verbose, if you only want output in verbose mode for example. Valid log levels are one of debug, info, verbose, warning or errorinfoNo

C.65.1 Supported Nested Tags

  • FileSet

  • Formatter

    The results of the tests can be printed in different formats. Output will always be sent to a file, unless you set the usefile attribute to false.

    Table C.86: Attributes

    NameTypeDescriptionDefaultRequired
    typeStringThe output format. Accepts the same values as the format attribute (default, xml, checkstyle, csv, report, summary & doc).n/aYes
    outfileStringPath to write output file to.n/aYes

C.65.2 Examples

<phpcs bin="bin/phpcs" file="classes" checkreturn="true"/>