PHP code example of sylarele / php-cs-fixer-config

1. Go to this page and download the library: Download sylarele/php-cs-fixer-config 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/ */

    

sylarele / php-cs-fixer-config example snippets




declare(strict_types=1);

use PhpCsFixer\Finder;
use PhpCsFixer\Runner\Parallel\ParallelConfig;
use Sylarele\PhpCsFixerConfig\Config;

$finder = Finder::create()
    ->exclude('storage')
    ->in(__DIR__)
    ->append([
        __FILE__,
    ]);

$config = new Config();

return $config
    ->setCacheFile(__DIR__.'/storage/tmp/php-cs-fixer/.php-cs-fixer.cache')
    ->setFinder($finder)
    ->setUsingCache(true)
    ->setParallelConfig(new ParallelConfig(6, 80));



declare(strict_types=1);

use PhpCsFixer\Finder;
use PhpCsFixer\Runner\Parallel\ParallelConfig;

$finder = Finder::create()
    ->exclude('storage')
    ->in(__DIR__)
    ->append([
        __FILE__,
    ]);

$config = new class() extends PhpCsFixer\Config {
    public function __construct()
    {
        parent::__construct('Customized Sylarele');
        
        $this->setRiskyAllowed(true);
    }
    
    public function getRules(): array
    {
        $rules = (new Sylarele\PhpCsFixerConfig\Config())->getRules();
        
        // Update the rules table here
        
        return $rules;
    }
};

$config->setFinder($finder);

return $config;