-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add remove extra semi colons command
- Loading branch information
1 parent
048143d
commit 1e80aca
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace Imanghafoori\LaravelMicroscope\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter; | ||
use Imanghafoori\LaravelMicroscope\Traits\LogsErrors; | ||
use JetBrains\PhpStorm\ExpectedValues; | ||
|
||
class CheckExtraSemiColons extends Command | ||
{ | ||
use LogsErrors; | ||
use PatternApply; | ||
|
||
protected $signature = 'check:extra_semi_colons | ||
{--f|file=} | ||
{--d|folder=} | ||
{--nofix}'; | ||
|
||
protected $description = 'Removes extra semi-colons.'; | ||
|
||
protected $customMsg = 'No extra semi-colons were found. \(^_^)/'; | ||
|
||
#[ExpectedValues(values: [0, 1])] | ||
public function handle(ErrorPrinter $errorPrinter) | ||
{ | ||
event('microscope.start.command'); | ||
$this->info('Soaring like an eagle...'); | ||
|
||
return $this->patternCommand($errorPrinter); | ||
} | ||
|
||
public function getPatterns() | ||
{ | ||
return [ | ||
'remove_extra_semi_colons' => [ | ||
'cacheKey' => 'extra_semi_colons-v1', | ||
'search' => ';;', | ||
'replace' => $this->option('nofix') ? null : ';', | ||
], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters