Skip to content

Commit 9cc36be

Browse files
committed
Leverage new symfony command name and description definition
1 parent 5dbe03b commit 9cc36be

File tree

7 files changed

+14
-71
lines changed

7 files changed

+14
-71
lines changed

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"phpstan/phpstan-phpunit": "^1.3.10",
4040
"phpstan/phpstan-symfony": "^1.2.23",
4141
"phpunit/php-code-coverage": "^9.2.26",
42-
"rector/rector": "^0.17.1",
4342
"symfony/doctrine-bridge": "^5.4 || ^6.0",
4443
"symfony/http-client": "^5.4 || ^6.0",
4544
"symfony/phpunit-bridge": "^5.4 || ^6.0",

rector.php

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/Command/IndexCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Symfony\Component\Console\Output\OutputInterface;
1212

1313
/**
14-
* Class IndexCommand.
14+
* Base command class all commands extends.
1515
*/
1616
abstract class IndexCommand extends Command
1717
{

src/Command/MeilisearchClearCommand.php

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,14 @@
99
use Symfony\Component\Console\Input\InputOption;
1010
use Symfony\Component\Console\Output\OutputInterface;
1111

12-
/**
13-
* Class MeilisearchClearCommand.
14-
*/
1512
final class MeilisearchClearCommand extends IndexCommand
1613
{
17-
public static function getDefaultName(): string
18-
{
19-
return 'meili:clear';
20-
}
21-
22-
public static function getDefaultDescription(): string
23-
{
24-
return 'Clear the index documents';
25-
}
14+
protected static $defaultName = 'meili:clear';
15+
protected static $defaultDescription = 'Clear the index documents';
2616

2717
protected function configure(): void
2818
{
29-
$this
30-
->addOption('indices', 'i', InputOption::VALUE_OPTIONAL, 'Comma-separated list of index names');
19+
$this->addOption('indices', 'i', InputOption::VALUE_OPTIONAL, 'Comma-separated list of index names');
3120
}
3221

3322
protected function execute(InputInterface $input, OutputInterface $output): int

src/Command/MeilisearchCreateCommand.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,19 @@ final class MeilisearchCreateCommand extends IndexCommand
2020
{
2121
private Client $searchClient;
2222

23+
protected static $defaultName = 'meili:create';
24+
protected static $defaultDescription = 'Create indexes';
25+
2326
public function __construct(SearchService $searchService, Client $searchClient)
2427
{
2528
parent::__construct($searchService);
2629

2730
$this->searchClient = $searchClient;
2831
}
2932

30-
public static function getDefaultName(): string
31-
{
32-
return 'meili:create';
33-
}
34-
35-
public static function getDefaultDescription(): string
36-
{
37-
return 'Create indexes';
38-
}
39-
4033
protected function configure(): void
4134
{
42-
$this
43-
->addOption('indices', 'i', InputOption::VALUE_OPTIONAL, 'Comma-separated list of index names');
35+
$this->addOption('indices', 'i', InputOption::VALUE_OPTIONAL, 'Comma-separated list of index names');
4436
}
4537

4638
private function entitiesToIndex($indexes): array

src/Command/MeilisearchDeleteCommand.php

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,15 @@
1111
use Symfony\Component\Console\Input\InputOption;
1212
use Symfony\Component\Console\Output\OutputInterface;
1313

14-
/**
15-
* Class MeilisearchDeleteCommand.
16-
*/
1714
final class MeilisearchDeleteCommand extends IndexCommand
1815
{
19-
public static function getDefaultName(): string
20-
{
21-
return 'meili:delete';
22-
}
2316

24-
public static function getDefaultDescription(): string
25-
{
26-
return 'Delete the indexes';
27-
}
17+
protected static $defaultName = 'meili:delete';
18+
protected static $defaultDescription = 'Delete the indexes';
2819

2920
protected function configure(): void
3021
{
31-
$this
32-
->addOption('indices', 'i', InputOption::VALUE_OPTIONAL, 'Comma-separated list of index names');
22+
$this->addOption('indices', 'i', InputOption::VALUE_OPTIONAL, 'Comma-separated list of index names');
3323
}
3424

3525
protected function execute(InputInterface $input, OutputInterface $output): int

src/Command/MeilisearchImportCommand.php

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
use Symfony\Component\Console\Input\InputOption;
1919
use Symfony\Component\Console\Output\OutputInterface;
2020

21-
/**
22-
* Class MeilisearchImportCommand.
23-
*/
2421
final class MeilisearchImportCommand extends IndexCommand
2522
{
2623
private const DEFAULT_RESPONSE_TIMEOUT = 5000;
2724

25+
protected static $defaultName = 'meili:import';
26+
protected static $defaultDescription = 'Import given entity into search engine';
27+
2828
protected Client $searchClient;
2929
protected ManagerRegistry $managerRegistry;
3030

@@ -36,16 +36,6 @@ public function __construct(SearchService $searchService, ManagerRegistry $manag
3636
$this->searchClient = $searchClient;
3737
}
3838

39-
public static function getDefaultName(): string
40-
{
41-
return 'meili:import';
42-
}
43-
44-
public static function getDefaultDescription(): string
45-
{
46-
return 'Import given entity into search engine';
47-
}
48-
4939
protected function configure(): void
5040
{
5141
$this

0 commit comments

Comments
 (0)