File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace LaravelFans \Lint ;
4
+
5
+ use FilesystemIterator ;
6
+ use Illuminate \Console \Command ;
7
+ use Illuminate \Support \Facades \File ;
8
+
9
+ class LintFixCommand extends Command
10
+ {
11
+ /**
12
+ * The name and signature of the console command.
13
+ *
14
+ * @var string
15
+ */
16
+ protected $ signature = 'lint:fix
17
+ {files*}
18
+ {--standard=phpcs.xml : coding standards} ' ;
19
+
20
+ /**
21
+ * The console command description.
22
+ *
23
+ * @var string
24
+ */
25
+ protected $ description = 'Fix files ' ;
26
+
27
+ /**
28
+ * Execute the console command.
29
+ *
30
+ * @return void
31
+ */
32
+ public function handle ()
33
+ {
34
+ exec (
35
+ 'vendor/bin/phpcbf --standard= ' . $ this ->option ('standard ' )
36
+ . ' ' . implode (' ' , $ this ->argument ('files ' )),
37
+ $ output ,
38
+ $ code
39
+ );
40
+ foreach ($ output as $ line ) {
41
+ $ this ->line ($ line );
42
+ }
43
+ return $ code ;
44
+ }
45
+ }
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ public function boot()
16
16
if ($ this ->app ->runningInConsole ()) {
17
17
$ this ->commands ([
18
18
LintCheckCommand::class,
19
+ LintFixCommand::class,
19
20
LintPublishCommand::class,
20
21
LintRouteCommand::class,
21
22
LintStagedCommand::class,
You can’t perform that action at this time.
0 commit comments