PHP code example of pierophp / php-cs-fixer-extra
1. Go to this page and download the library: Download pierophp/php-cs-fixer-extra 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/ */
pierophp / php-cs-fixer-extra example snippets
$finder = Symfony\Component\Finder\Finder::create()
->files()
->in(__DIR__)
->exclude('vendor')
->exclude('resources/views')
->exclude('storage')
->exclude('public')
->ignoreDotFiles(true)
->ignoreVCS(true);
return Symfony\CS\Config::create()
->addCustomFixer(new \PhpCsFixerExtra\Fixer\PhpdocFullNamespaceFixer())
->finder($finder)
->setUsingCache(true);
bash
$ ./vendor/bin/php-cs-fixer --config-file=./.php_cs fix my_file.php
bash
#!/bin/bash
while read -r file;
do
file=`echo ${file:1}`
if [[ $file = *.php && -e $file && $file != *migrations* ]]; then
./vendor/bin/php-cs-fixer --config-file=./.php_cs fix $file
git add $file
fi
done < <(git diff --cached --name-status --diff-filter=ACM)