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

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

    

aysnc / wordpress-php-cs-fixer example snippets




use Aysnc\WordPress\PHPCSFixer\Config;
use PhpCsFixer\Finder;

 ->in( [ __DIR__ . '/src', __DIR__ . '/tests' ] )
	->name( '*.php' )
	->ignoreVCS( true )
	->exclude( 'vendor' );

return Config::create()
	->setFinder( $finder );

return Config::create()
	->setFinder( $finder )
	->setRules(
		[
			...Config::getRules(),
			'array_syntax' => [
				'syntax' => 'long',
			],
		],
	);
bash
# Check without fixing (dry-run)
vendor/bin/php-cs-fixer fix --dry-run --diff

# Fix files
vendor/bin/php-cs-fixer fix