1 | <?php |
||
11 | class PhpCsFixer extends ActionAbstract |
||
12 | { |
||
13 | const NONE_LEVEL = 0; |
||
14 | const PSR0_LEVEL = 1; |
||
15 | const PSR1_LEVEL = 3; |
||
16 | const PSR2_LEVEL = 7; |
||
17 | const SYMFONY_LEVEL = 15; |
||
18 | const CONTRIB_LEVEL = 32; |
||
19 | |||
20 | /** |
||
21 | * @var FileList |
||
22 | */ |
||
23 | protected $files; |
||
24 | |||
25 | /** |
||
26 | * @var int|null |
||
27 | */ |
||
28 | protected $level; |
||
29 | |||
30 | /** |
||
31 | * @var string[] |
||
32 | */ |
||
33 | protected $fixers; |
||
34 | |||
35 | /** |
||
36 | * @var bool |
||
37 | */ |
||
38 | protected $addAutomatically; |
||
39 | |||
40 | /** |
||
41 | * Runs all the provided files through PHP-CS-Fixer, fixing any code style issues. |
||
42 | * |
||
43 | * @param FileList $files The files to check |
||
44 | * @param int|null $level (Optional, defaults to NONE_LEVEL) Fixer level to use |
||
45 | * @param string[] $fixers (Optional, default is empty) Set the fixers to use |
||
46 | * @param bool $addAutomatically (Optional, default is true) Whether to add modified files to commit or not |
||
47 | */ |
||
48 | 3 | public function __construct(FileList $files, $level = self::NONE_LEVEL, $fixers = [], $addAutomatically = true) |
|
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | public function getName() |
||
63 | |||
64 | /** |
||
65 | * {@inheritdoc} |
||
66 | */ |
||
67 | public function isSupported() |
||
79 | |||
80 | /** |
||
81 | * {@inheritdoc} |
||
82 | */ |
||
83 | 3 | public function execute(InputInterface $input, OutputInterface $output) |
|
111 | |||
112 | /** |
||
113 | * @return \Symfony\CS\Fixer |
||
114 | */ |
||
115 | 3 | private function getCsFixer() |
|
123 | |||
124 | /** |
||
125 | * @param \Symfony\CS\Fixer $fixer |
||
126 | * @param int $level |
||
127 | * @param string[] $fixers |
||
128 | * |
||
129 | * @return \Symfony\CS\FixerInterface[] |
||
130 | */ |
||
131 | 3 | private function resolveFixers($fixer, $level, $fixers) |
|
145 | } |
||
146 |