php-lint [<option>...] [<file>...]
--silence-vendor[=ARG] Silence warnings on vendor directory
-x, --exclude-tests=ARG List of tests to exclude
-t, --show-tests Show list of tests which will be included
--working-directory=ARG Set the initial working directory
-h, --help Display this help
-v, --version Show version
As this program is still under development there are several cases where it can't reliably or usefully detect what PHP would actually do. Because of this, the following tests should be disabled for routine use in order to reduce noise:
- BadDoc - for documentation mismatching practical types. For simple cases the practical types can be inferred, but there are many edge cases - in particular, this will be improved once there's support for recognising generic patterns.
- SingleCharacterVariable - for unnecessarily cryptic variable names. This
warrants refinement to cover extremely short scopes and overwhelming
convention (eg. if
$p
is virtually always an object of classParameter
).
You may also want to disable the following tests as they are fairly common violations:
- BadCoreType - for cases where a type is documented as "integer" or "boolean", neither of which are valid PHP type keywords but both of which are accepted by phpDocumentor (which also accepts their real keywords "int" and "bool").
- NoDoc - for undocumented properties/functions
- PSR1.S43MethodName - for method names not following the Java case convention
Since you usually don't want to see problems in autogenerated or vendor files,
you would typically want to include the --silence-vendor
option, with a list
of directories if necessary.
A full recommended command line might look like:
php-lint --silence-vendor -x BadCoreType,BadDoc,NoDoc,PSR1.S43MethodName,SingleCharacterVariable
See LICENSE
in the same directory as this file