1 | <?php |
||
10 | class PhpCsFixerOld extends ActionAbstract |
||
11 | { |
||
12 | /** |
||
13 | * @var FileList |
||
14 | */ |
||
15 | protected $files; |
||
16 | |||
17 | /** |
||
18 | * @var string|null |
||
19 | */ |
||
20 | protected $binFile; |
||
21 | |||
22 | /** |
||
23 | * @var string|null |
||
24 | */ |
||
25 | protected $configFile; |
||
26 | |||
27 | /** |
||
28 | * @var bool |
||
29 | */ |
||
30 | protected $addAutomatically; |
||
31 | |||
32 | /** |
||
33 | * Runs all the provided files through PHP-CS-Fixer, fixing any code style issues. |
||
34 | * |
||
35 | * @param FileList $files The files to check |
||
36 | * @param string|null $binFile (Optional, default is from vendor) File path to PHP-CS-Fixer binary |
||
37 | * @param string|null $configFile (Optional, default is project root) File path to PHP-CS-Fixer config |
||
38 | * @param bool $addAutomatically (Optional, default is true) Whether to add modified files to commit or not |
||
39 | */ |
||
40 | 3 | public function __construct(FileList $files, $binFile = null, $configFile = null, $addAutomatically = true) |
|
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | */ |
||
51 | public function getName() |
||
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | 3 | public function isSupported() |
|
60 | { |
||
61 | 3 | if (!file_exists($this->binFile)) { |
|
62 | $this->logger->warning( |
||
63 | sprintf( |
||
64 | 'PHP-CS-Fixer could not be found in: %s', |
||
65 | $this->binFile |
||
66 | ) |
||
67 | ); |
||
68 | |||
69 | return false; |
||
70 | } |
||
71 | |||
72 | 3 | return true; |
|
73 | } |
||
74 | |||
75 | /** |
||
76 | * {@inheritdoc} |
||
77 | */ |
||
78 | 3 | public function execute(InputInterface $input, OutputInterface $output) |
|
135 | |||
136 | /** |
||
137 | * @return string |
||
138 | */ |
||
139 | protected function getBinFile() |
||
146 | } |
||
147 |