adamwojs/php-cs-fixer-phpdoc-force-fqcn

v2.0 2021-08-23 07:54 UTC

This package is not auto-updated.

Last update: 2024-09-22 22:45:43 UTC


README

php-cs-fixer rule to force using FQCN (Fully-Qualified Class Name) in DocBlock comments.

Installation

You can install the package via composer:

composer require --dev adamwojs/php-cs-fixer-phpdoc-force-fqcn

Usage

In your .php_cs file:

<?php

// PHP-CS-Fixer 2.x syntax
return PhpCsFixer\Config::create()
    // (1) Register \AdamWojs\PhpCsFixerPhpdocForceFQCN\Fixer\Phpdoc\ForceFQCNFixer fixer
    ->registerCustomFixers([
        new \AdamWojs\PhpCsFixerPhpdocForceFQCN\Fixer\Phpdoc\ForceFQCNFixer()
    ])
    ->setRules([
        // ... 
        // (2) Enable AdamWojs/phpdoc_force_fqcn_fixer rule
        'AdamWojs/phpdoc_force_fqcn_fixer' => true,
    ])
    // ...
    ;