odan/docblock-checker

This package is abandoned and no longer maintained. The author suggests using the https://github.com/squizlabs/PHP_CodeSniffer package instead.

A simple tool for checking that your PHP classes and methods use docblocks.

1.3.0 2019-04-14 12:51 UTC

This package is auto-updated.

Last update: 2020-05-09 22:08:21 UTC


README

Check PHP files within a directory for appropriate use of DocBlocks.

Latest Version on Packagist Build Status Code Coverage Scrutinizer Code Quality Total Downloads

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