sinsquare/phpdoc-formatter

A tool to automatically fix phpDocumentor tags and annotations

Installs: 10 623

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 3

Forks: 0

Open Issues: 0

Type:application

0.1.3 2021-03-21 15:37 UTC

This package is auto-updated.

Last update: 2024-04-21 22:14:07 UTC


README

Build Status

A simple tool for formatting PHPDoc

The tool currently fixes:

  • Idention through multiline comments
  • Removing more than 2 empty lines
  • Fixing PHPDoc format

Usage:

phpdoc-formatter [--option value] [/path/to/project ...]

Options:

  --exclude (-e)    Exclude path(s)
                    ex: --exclude vendor,library
  --version (-v)    Displays the version

  --ident (-i)      Sets the ident character(s)
                    ex: --ident "    "
  --newline (-n)    Sets the newline character(s)
                    ex: --ident "\r\n"
  --help (-h)       Displays this message

Example:

Before:

/**
 * @SWG\Info(
* title="API",
 *    version="1.0"
 * )
 * 
 *    @SWG\Swagger(
 *   host=API_HOST,
 * basePath=API_BASE_PATH
 *   )
 * 
 *   @SWG\SecurityScheme(
 *  securityDefinition="JWTTokenAuth",
 *    type="apiKey",
 *  in="header",
 *     name="Authorization",
 *   description=API_DEFAULT_TOKEN,
 *   )
 */

After:

/**
 * @SWG\Info(
 *     title="API",
 *     version="1.0"
 * )
 * 
 * @SWG\Swagger(
 *     host=API_HOST,
 *     basePath=API_BASE_PATH
 * )
 * 
 * @SWG\SecurityScheme(
 *     securityDefinition="JWTTokenAuth",
 *     type="apiKey",
 *     in="header",
 *     name="Authorization",
 *     description=API_DEFAULT_TOKEN,
 * )
 */