Skip to content

Commit bc466e4

Browse files
authored
Optimize console commands (#186)
* Optimize console commands
1 parent 0041b81 commit bc466e4

File tree

9 files changed

+27
-13
lines changed

9 files changed

+27
-13
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to `laravel-love` will be documented in this file.
44

55
## [Unreleased]
66

7+
## [8.7.1] - 2020-12-06
8+
9+
### Fixed
10+
11+
- ([#186]) Improve CLI application performance by replacing `$name` with `$defaultName` static property in commands
12+
- ([#187]) Fixed inconsistency in method parameter names
13+
714
## [8.7.0] - 2020-12-06
815

916
### Added
@@ -462,7 +469,8 @@ Follow [upgrade instructions](UPGRADING.md#from-v5-to-v6) to migrate database to
462469

463470
- Initial release
464471

465-
[Unreleased]: https://github.com/cybercog/laravel-love/compare/8.7.0...master
472+
[Unreleased]: https://github.com/cybercog/laravel-love/compare/8.7.1...master
473+
[8.7.1]: https://github.com/cybercog/laravel-love/compare/8.7.0...8.7.1
466474
[8.7.0]: https://github.com/cybercog/laravel-love/compare/8.6.1...8.7.0
467475
[8.6.1]: https://github.com/cybercog/laravel-love/compare/8.6.0...8.6.1
468476
[8.6.0]: https://github.com/cybercog/laravel-love/compare/8.5.0...8.6.0
@@ -507,6 +515,8 @@ Follow [upgrade instructions](UPGRADING.md#from-v5-to-v6) to migrate database to
507515
[1.1.1]: https://github.com/cybercog/laravel-love/compare/1.1.0...1.1.1
508516
[1.1.0]: https://github.com/cybercog/laravel-love/compare/1.0.0...1.1.0
509517

518+
[#187]: https://github.com/cybercog/laravel-love/pull/187
519+
[#186]: https://github.com/cybercog/laravel-love/pull/186
510520
[#185]: https://github.com/cybercog/laravel-love/pull/185
511521
[#178]: https://github.com/cybercog/laravel-love/pull/178
512522
[#177]: https://github.com/cybercog/laravel-love/pull/177

src/Console/Commands/ReactionTypeAdd.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ final class ReactionTypeAdd extends Command
2525
*
2626
* @var string
2727
*/
28-
protected $name = 'love:reaction-type-add';
28+
protected static $defaultName = 'love:reaction-type-add';
2929

3030
/**
3131
* The console command description.

src/Console/Commands/Recount.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ final class Recount extends Command
3030
*
3131
* @var string
3232
*/
33-
protected $name = 'love:recount';
33+
protected static $defaultName = 'love:recount';
3434

3535
/**
3636
* The console command description.

src/Console/Commands/RegisterReactants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ final class RegisterReactants extends Command
2727
*
2828
* @var string
2929
*/
30-
protected $name = 'love:register-reactants';
30+
protected static $defaultName = 'love:register-reactants';
3131

3232
/**
3333
* The console command description.

src/Console/Commands/RegisterReacters.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ final class RegisterReacters extends Command
2727
*
2828
* @var string
2929
*/
30-
protected $name = 'love:register-reacters';
30+
protected static $defaultName = 'love:register-reacters';
3131

3232
/**
3333
* The console command description.

src/Console/Commands/SetupReactable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ final class SetupReactable extends Command
3333
*
3434
* @var string
3535
*/
36-
protected $name = 'love:setup-reactable';
36+
protected static $defaultName = 'love:setup-reactable';
3737

3838
/**
3939
* The console command description.

src/Console/Commands/SetupReacterable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ final class SetupReacterable extends Command
3333
*
3434
* @var string
3535
*/
36-
protected $name = 'love:setup-reacterable';
36+
protected static $defaultName = 'love:setup-reacterable';
3737

3838
/**
3939
* The console command description.

src/Console/Commands/UpgradeV5ToV6.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ final class UpgradeV5ToV6 extends Command
3333
*
3434
* @var string
3535
*/
36-
protected $name = 'love:upgrade-v5-to-v6';
36+
protected static $defaultName = 'love:upgrade-v5-to-v6';
3737

3838
/**
3939
* The console command description.
@@ -57,9 +57,9 @@ public function __construct(Builder $queryBuilder)
5757
/**
5858
* Execute the console command.
5959
*
60-
* @return void
60+
* @return int
6161
*/
62-
public function handle(): void
62+
public function handle(): int
6363
{
6464
$this->dbMigrate();
6565
$this->populateReactionTypes();
@@ -68,6 +68,8 @@ public function handle(): void
6868
$this->populateReactions();
6969
$this->dbCleanup();
7070
$this->filesystemCleanup();
71+
72+
return 0;
7173
}
7274

7375
private function dbMigrate(): void

src/Console/Commands/UpgradeV7ToV8.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class UpgradeV7ToV8 extends Command
2929
*
3030
* @var string
3131
*/
32-
protected $name = 'love:upgrade-v7-to-v8';
32+
protected static $defaultName = 'love:upgrade-v7-to-v8';
3333

3434
/**
3535
* The console command description.
@@ -41,9 +41,9 @@ final class UpgradeV7ToV8 extends Command
4141
/**
4242
* Execute the console command.
4343
*
44-
* @return void
44+
* @return int
4545
*/
46-
public function handle(): void
46+
public function handle(): int
4747
{
4848
$this->assertRequirements();
4949
$this->warn('Started Laravel Love v7 to v8 upgrade process.');
@@ -52,6 +52,8 @@ public function handle(): void
5252
$this->dbChangeReactantReactionCounters();
5353
$this->dbChangeReactantReactionTotals();
5454
$this->info('Completed Laravel Love v7 to v8 upgrade process.');
55+
56+
return 0;
5557
}
5658

5759
private function assertRequirements(): void

0 commit comments

Comments
 (0)