PHP code example of drupol / phpcsfixer-configs-drupal

1. Go to this page and download the library: Download drupol/phpcsfixer-configs-drupal library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

drupol / phpcsfixer-configs-drupal example snippets




use drupol\PhpCsFixerConfigsDrupal\Config\Drupal8;

$finder = PhpCsFixer\Finder::create()
  ->in(['web/modules/custom'])
  ->name('*.module')
  ->name('*.inc')
  ->name('*.install')
  ->name('*.test')
  ->name('*.profile')
  ->name('*.theme')
  ->notPath('*.md')
  ->notPath('*.info.yml')
;

$config = new Drupal8();
$config->setFinder($finder);

$rules = $config->getRules();

$config->setRules($rules);
return $config;
bash
touch .php-cs-fixer.php
bash
tools/php-cs-fixer/vendor/bin/php-cs-fixer fix