Skip to content

Commit 9946938

Browse files
committed
feat: #4 fix style
1 parent fce3fab commit 9946938

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

src/LintFixCommand.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
}

src/LintServiceProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public function boot()
1616
if ($this->app->runningInConsole()) {
1717
$this->commands([
1818
LintCheckCommand::class,
19+
LintFixCommand::class,
1920
LintPublishCommand::class,
2021
LintRouteCommand::class,
2122
LintStagedCommand::class,

0 commit comments

Comments
 (0)