Skip to content

Commit 03eba5e

Browse files
committed
perf: #13 argument files optional
1 parent aec612f commit 03eba5e

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,21 @@ composer require --dev laravel-fans/lint
1616
php artisan lint:publish
1717
```
1818

19-
## use
19+
## usage
2020

21-
lint code:
21+
### lint code
2222

2323
```shell
24-
php artisan lint:check .
25-
php artisan lint:check app/ tests/
26-
php artisan lint:check --standard=Squiz app/
24+
php artisan lint:code
25+
php artisan lint:code --fix
26+
php artisan lint:code app/ tests/
27+
php artisan lint:code --standard=Squiz app/
2728
php artisan lint:staged
2829
```
2930

30-
The default standard is PSR-12, feel free to change the `phpcs.xml`.
31+
The default standard is `phpcs.xml`, feel free to change it.
3132

32-
lint route URL:
33+
### lint route URI
3334

3435
```shell
3536
php artisan lint:route

src/LintCodeCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class LintCodeCommand extends Command
1414
* @var string
1515
*/
1616
protected $signature = 'lint:code
17-
{files*}
17+
{files?*}
1818
{--fix : automatic fix}
1919
{--standard=phpcs.xml : coding standards}';
2020

@@ -33,9 +33,11 @@ class LintCodeCommand extends Command
3333
public function handle()
3434
{
3535
$bin = $this->option('fix') ? 'phpcbf' : 'phpcs';
36+
$files = empty($this->argument('files')) ? [ '.' ] : $this->argument('files');
37+
3638
exec(
3739
"vendor/bin/$bin --standard=" . $this->option('standard')
38-
. ' ' . implode(' ', $this->argument('files')),
40+
. ' ' . implode(' ', $files),
3941
$output,
4042
$code
4143
);

0 commit comments

Comments
 (0)