PHPackages                             johnbillion/php-docs-standards - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. johnbillion/php-docs-standards

AbandonedArchivedLibrary

johnbillion/php-docs-standards
==============================

PHPUnit tests for documentation standards of PHP functions and methods.

3.0.0(4y ago)238.4k↓100%4[3 issues](https://github.com/johnbillion/php-docs-standards/issues)[1 PRs](https://github.com/johnbillion/php-docs-standards/pulls)1GPL-2.0+PHPPHP &gt;=7

Since Dec 21Pushed 4y ago4 watchersCompare

[ Source](https://github.com/johnbillion/php-docs-standards)[ Packagist](https://packagist.org/packages/johnbillion/php-docs-standards)[ RSS](/packages/johnbillion-php-docs-standards/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (12)Used By (1)

[![License](https://camo.githubusercontent.com/d12c5217d1ac8d4bc974dd17ba1b6846a40f6485c78dad9b0e5f2cd2bb3dacc8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d47504c5f76322532422d626c75652e7376673f7374796c653d666c61742d737175617265)](http://opensource.org/licenses/GPL-2.0)[![Build Status](https://camo.githubusercontent.com/d263ab07e6edaa0bfec45da9a737030d667342d20886a1c6bd0d367fa708c24e/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6a6f686e62696c6c696f6e2f7068702d646f63732d7374616e64617264732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/johnbillion/php-docs-standards)

PHP Documentation Standards Tests
=================================

[](#php-documentation-standards-tests)

This abstract PHPUnit test case tests the standards and correctness of the inline documentation of your PHP functions and methods.

What's tested?
--------------

[](#whats-tested)

- The docblock should not be missing.
- The docblock description should not be empty.
- The number of `@param` docs should match the actual number of parameters.
- The `@param` description for each parameter should not be empty.
- The `@param` name for each parameter should be correct.
- The `@param` type hint for each parameter should be correct.
- The `@param` description for optional parameters should state that it is optional.
- The `@param` description for required parameters should not state that it is optional.
- The `@param` description for each parameter should state its default value, where appropriate.

Class-level docblocks are not tested.

Installation
------------

[](#installation)

Requirements:

- PHP 7 or 8
- PHPUnit 7 or higher

Add the package to your project's dev dependencies using Composer:

```
composer require johnbillion/php-docs-standards --dev
```

In your unit test bootstrap file, include the Composer autoloader. This will look something like this:

```
require dirname( dirname( __DIR__ ) ) . '/vendor/autoload.php';
```

Usage
-----

[](#usage)

Add a new test class to your test suite that extends the docs standards test case. The two abstract methods that need to be implemented are `getTestFunctions()` and `getTestClasses()`. These methods return an array of function names and class names, respectively, which are to be run through the test suite to test their documentation standards.

The functions and classes must be loaded (or available for autoloading) in the current request.

```
