PHP code example of antipodes / php-cs-fixer-config-antipodes
1. Go to this page and download the library: Download antipodes/php-cs-fixer-config-antipodes 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/ */
antipodes / php-cs-fixer-config-antipodes example snippets
use PhpCsFixer\Finder;
use Antipodes\PhpCsFixer\Config\Factory;
use Antipodes\PhpCsFixer\Config\RuleSet\Php74;
$config = Factory::fromRuleSet(new Php74());
$finder = Finder::create()
->in([
__DIR__,
])
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true);
return $config
->setFinder($finder)
->setRiskyAllowed(true)
->setUsingCache(true);
diff
use PhpCsFixer\Finder;
use Antipodes\PhpCsFixer\Config\Factory;
use Antipodes\PhpCsFixer\Config\RuleSet\Php74;
-$config = Factory::fromRuleSet(new Php74());
+$config = Factory::fromRuleSet(new Php74(), [
+ 'mb_str_functions' => false,
+ 'strict_comparison' => false,
+]);
$finder = Finder::create()
->in([
__DIR__,
])
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true);
return $config
->setFinder($finder)
->setRiskyAllowed(true)
->setUsingCache(true);
yml
name: "🚨 PHP Linter"
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
php:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
fail-fast: false
matrix:
php: [ "7.4", "8.0" ]
steps:
- name: Checkout the project
uses: actions/checkout@v2
- name: Setup the PHP ${{ matrix.php }} environment on ${{ runner.os }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Add HTTP basic auth credentials
run: echo '${{ secrets.COMPOSER_AUTH_JSON }}' > $GITHUB_WORKSPACE/auth.json
- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader --no-suggest
- name: Execute the lint script
run: composer run-script lint