-
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.
- Loading branch information
1 parent
1e80aca
commit 3a19197
Showing
17 changed files
with
309 additions
and
170 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
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
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
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
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,38 @@ | ||
<?php | ||
|
||
namespace Imanghafoori\LaravelMicroscope\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter; | ||
use Imanghafoori\LaravelMicroscope\Traits\LogsErrors; | ||
|
||
class EnforceArrowFunctions extends Command | ||
{ | ||
use LogsErrors; | ||
use PatternApply; | ||
|
||
protected $signature = 'check:arrow_functions {--f|file=} {--d|folder=} {--nofix}'; | ||
|
||
protected $description = 'Converts anonymous functions into arrow functions.'; | ||
|
||
protected $customMsg = 'All the function are already converted into the arrow version. \(^_^)/'; | ||
|
||
public function handle(ErrorPrinter $errorPrinter) | ||
{ | ||
event('microscope.start.command'); | ||
$this->info('Soaring like an eagle...'); | ||
|
||
return $this->patternCommand($errorPrinter); | ||
} | ||
|
||
private function getPatterns(): array | ||
{ | ||
return [ | ||
'arrow_functions' => [ | ||
'cacheKey' => 'arrow_fn-v1', | ||
'search' => 'function (<in_between>)<until>{return <statement>;}', | ||
'replace' => 'fn (<1>) => <3>', | ||
], | ||
]; | ||
} | ||
} |
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
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
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
Oops, something went wrong.