PHP code example of vena / php-cs-fixer-wordpress

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

    

vena / php-cs-fixer-wordpress example snippets


// In case of not using autoload...

$RuleSet = new vena\WordPress\PhpCsFixer\WordPressRuleSet();

return $config
	->registerCustomFixers( $RuleSet->getCustomFixers() )
	// OPTIONAL. See below.
	->registerCustomFixers( array(
		new vena\WordPress\PhpCsFixer\Fixer\WordPressCapitalPDangitFixer(),
	) )
	->setRiskyAllowed( $RuleSet->isRisky() )
	->setIndent( "\t" )
	->setRules( array_merge(
		$RuleSet->getRules(),
		array(
			// OPTIONAL. See below.
			'Vena/wp_capital_p_dangit' => true,
		)
	) )
	->setFinder(
		PhpCsFixer\Finder::create()
			->exclude( 'vendor' )
			->in( __DIR__ )
	)
;