Skip to content

Commit 76db059

Browse files
author
ityaozm@gmail.com
committed
perf(app): improve handle method performance
- Removed unnecessary return statement in handle method - Removed commented out code
1 parent 3aedbee commit 76db059

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

app/Commands/CommitCommand.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,9 @@ public function __construct(GeneratorManager $generatorManager)
5858
}
5959

6060
/**
61-
* @noinspection DebugFunctionUsageInspection
62-
*
6361
* @psalm-suppress InvalidArgument
6462
*/
65-
public function handle(): int
63+
public function handle(): void
6664
{
6765
$this->task('1. Generating commit message', function () use (&$message): void {
6866
// Ensure git is installed and the current directory is a git repository.
@@ -138,8 +136,6 @@ function ($attempts) use ($cachedDiff, $type): string {
138136
}, 'committing...'.PHP_EOL);
139137

140138
$this->output->success('Successfully generated and committed message.');
141-
142-
return self::SUCCESS;
143139
}
144140

145141
/**

app/Commands/ThanksCommand.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ final class ThanksCommand extends Command
3131
*/
3232
protected $description = 'Thanks for using this tool.';
3333

34-
public function handle(): int
34+
public function handle(): void
3535
{
3636
$wantsToSupport = $this->ask('Can you quickly <options=bold>star our GitHub repository</>? 🙏🏻', 'yes');
3737

@@ -46,8 +46,6 @@ public function handle(): int
4646
sprintf(' - Star or contribute to <comment>%s</comment>:', config('app.name')),
4747
' <options=bold>https://github.com/guanguans/ai-commit</>',
4848
]);
49-
50-
return self::SUCCESS;
5149
}
5250

5351
public function schedule(Schedule $schedule): void

0 commit comments

Comments
 (0)