odan / docblock-checker
A simple tool for checking that your PHP classes and methods use docblocks.
Installs: 4 290
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=7.1
- nikic/php-parser: ^4.0
- symfony/console: ^2.8|^3.0|^4.0
Requires (Dev)
- mikey179/vfsstream: ^1.6
- phpstan/phpstan-shim: ^0.11.1
- phpunit/phpunit: ^6.0|^7.0
README
Check PHP files within a directory for appropriate use of DocBlocks.
Installation
Composer:
composer require odan/docblock-checker --dev
Features
- Check parameters and return types
- Support for 7.1's nullable types
- Exclude pattern
- Ability to check a single file
- Json output (optional)
Usage
Linux
$ vendor/bin/docblock-checker {params}
Windows
> vendor\bin\docblock-checker {params}
Parameters
Shortcut | Name | Description |
---|---|---|
-h | --help | Display help message. |
-d | --directory=DIRECTORY | Directory to scan. [default: "./"] |
-f | --file=filename | Single file to scan. |
-x | --exclude=EXCLUDE | Files and directories to exclude. You can use exclude patterns ex. tests/* |
none | --skip-classes | Don't check classes for docblocks. |
none | --skip-methods | Don't check methods for docblocks. |
none | --skip-signatures | Don't check docblocks against method signatures. |
none | --format=json | json = Output JSON instead of a log. |
-l | --files-per-line=FILES-PER-LINE | Number of files per line in progress [default: 50] |
-w | --fail-on-warnings | Consider the check failed if any warnings are produced. |
-i | --info-only | Information-only mode, just show summary. |
-q | --quiet | Do not output any message. |
-V | --version | Display this application version. |
none | --ansi | Force ANSI output. |
none | --no-ansi | Disable ANSI output. |
-n | --no-interaction | Do not ask any interactive question. |
-v -vv -vvv | --verbose | Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug. |
Similar libraries
You could achieve the same affect using squizlabs/php_codesniffer with the following sniff rules:
<rule ref="Squiz.Commenting.ClassComment"> <type>warning</type> </rule> <rule ref="Squiz.Commenting.ClassComment.TagNotAllowed"> <type>warning</type> <exclude-pattern>*/tests/</exclude-pattern> </rule> <rule ref="Squiz.Commenting.ClassComment.Missing"> <type>warning</type> </rule> <rule ref="Squiz.Commenting.FunctionComment.Missing"> <type>warning</type> </rule> <rule ref="Squiz.Commenting.FunctionComment.MissingParamTag"> <type>warning</type> </rule> <rule ref="Squiz.Commenting.FunctionComment.MissingParamComment"> <type>warning</type> </rule> <rule ref="Squiz.Commenting.FunctionComment.ParamCommentNotCapital"> <type>warning</type> </rule>
Credits
This library is a fork from block8/php-docblock-checker.
Thanks to:
- @Block8
- @dancryer