PHP-CS-Fixer 改版了,容许我布个道,发(抄)个配置 
                                                    
                        
                    
                    
  
                    
                    PHP-CS-Fixer,能帮你修正代码规范。
改版后,旧项目的 .php_cs 改为 .php-cs-fixer.php
替换如下:
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
    '@PHP80Migration' => true,
    'not_operator_with_successor_space' => true, // ! 运算带有空格,比如「if (! $var)」
    'ordered_imports' => [ // use 排序
        'sort_algorithm' => 'alpha',
    ],
    'single_line_comment_spacing' => true, // 单行注释,「//」后添加空格
    'class_attributes_separation' => [
        'elements' => [
            'const' => 'one',
            'method' => 'one',
            'property' => 'one',
        ],
    ],
];
$finder = Finder::create()
    ->in([
        __DIR__.'/app',
        __DIR__.'/config',
        __DIR__.'/database',
        __DIR__.'/resources',
        __DIR__.'/routes',
        __DIR__.'/tests',
    ])
    ->name('*.php')
    ->notName('*.blade.php')
    ->ignoreDotFiles(true)
    ->ignoreVCS(true);
return (new Config())
    ->setFinder($finder)
    ->setRules($rules)
    ->setRiskyAllowed(true)
    ->setUsingCache(true);
本作品采用《CC 协议》,转载必须注明作者和本文链接
 
           小李世界 的个人博客
 小李世界 的个人博客
         
             
             
             
                     
                     
             
             
             
             
           
           关于 LearnKu
                关于 LearnKu
               
                     
                     
                     粤公网安备 44030502004330号
 粤公网安备 44030502004330号 
 
推荐文章: