PHP code example of slam / php-cs-fixer-extensions

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

    

slam / php-cs-fixer-extensions example snippets




$config = new PhpCsFixer\Config();

$config->setRiskyAllowed(true);

$config->registerCustomFixers([
    new SlamCsFixer\FinalAbstractPublicFixer(),
    new SlamCsFixer\FinalInternalClassFixer(),
    new SlamCsFixer\FunctionReferenceSpaceFixer(),
    new SlamCsFixer\InlineCommentSpacerFixer(),
    new SlamCsFixer\PhpFileOnlyProxyFixer(new PhpCsFixer\Fixer\Basic\BracesFixer()),
    new SlamCsFixer\Utf8Fixer(),
]);

$this->setRules([
    'Slam/final_abstract_public' => true,
    'Slam/final_internal_class' => true,
    'Slam/function_reference_space' => true,
    'Slam/inline_comment_spacer' => true,
    'Slam/php_only_braces' => true,
    'Slam/utf8' => true,
]);

$config->getFinder()
    ->in(__DIR__ . '/app')
    ->in(__DIR__ . '/tests')
    ->name('*.phtml')
;

return $config;