PHP code example of wayofdev / cs-fixer-config

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

    

wayofdev / cs-fixer-config example snippets


    

    declare(strict_types=1);

    use WayOfDev\PhpCsFixer\Config\ConfigBuilder;
    use WayOfDev\PhpCsFixer\Config\RuleSets\DefaultSet;

    les([__FILE__])
        ->getConfig()
    ;

    $config->setCacheFile(__DIR__ . '/.build/php-cs-fixer/php-cs-fixer.cache');

    return $config;
   
diff
  {
      "scripts": {
  +       "cs:diff": "php vendor/bin/php-cs-fixer fix --dry-run -v --diff",
  +       "cs:fix": "php vendor/bin/php-cs-fixer fix -v"
      }
  }
  
diff
  +APP_RUNNER ?= php
  +APP_COMPOSER ?= $(APP_RUNNER) composer
  +
  +prepare:
  +  mkdir -p .build/php-cs-fixer
  +.PHONY: prepare

  +lint-php: prepare ## Fixes code to follow coding standards using php-cs-fixer
  +  $(APP_COMPOSER) cs:fix
  +.PHONY: lint-php

  +lint-diff: prepare ## Runs php-cs-fixer in dry-run mode and shows diff which will by applied
  +  $(APP_COMPOSER) cs:diff
  +.PHONY: lint-diff
  
bash
vendor/bin/php-cs-fixer fix -v
bash
  make lint-php