Skip to content

Commit edde102

Browse files
authored
Using autowiring in all services (#61)
1 parent c9a6dc0 commit edde102

29 files changed

+2688
-2416
lines changed

.circleci/config.yml

+4-20
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,17 @@
11
version: 2
22
jobs:
3-
test-php72:
3+
test-php73:
44
docker:
5-
- image: circleci/php:7.2-cli
5+
- image: circleci/php:7.4-cli
66

77
working_directory: ~/project
88
steps:
99
- checkout
1010

11-
- run:
12-
name: Install PHPUnit
13-
command: |
14-
composer require phpunit/phpunit:7.5.17 --prefer-dist --prefer-stable --prefer-lowest --no-suggest
15-
16-
- run:
17-
name: Run tests / Symfony 3^3
18-
command: |
19-
php vendor/bin/phpunit
20-
2111
- run:
2212
name: Run tests / Symfony 4^3
2313
command: |
24-
composer update -n --prefer-dist --prefer-stable --no-suggest
14+
composer update -n --prefer-dist --prefer-lowest --no-suggest
2515
php vendor/bin/phpunit
2616
2717
- run:
@@ -38,21 +28,15 @@ jobs:
3828
steps:
3929
- checkout
4030

41-
- run:
42-
name: Install PHPUnit
43-
command: |
44-
composer require phpunit/phpunit:7.5.17 --prefer-dist --prefer-stable --prefer-lowest --no-suggest
45-
4631
- run:
4732
name: Run tests / Symfony 5^0
4833
command: |
4934
composer update -n --prefer-dist --no-suggest
5035
php vendor/bin/phpunit
5136
52-
5337
workflows:
5438
version: 2
5539
test:
5640
jobs:
57-
- test-php72
41+
- test-php73
5842
- test-php74

ApisearchBundle.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Apisearch\DependencyInjection\CompilerPass\RepositoryCompilerPass;
2222
use Apisearch\DependencyInjection\CompilerPass\WriteTransformerCompilerPass;
2323
use Mmoreram\BaseBundle\BaseBundle;
24+
use Mmoreram\SymfonyBundleDependencies\DependentBundleInterface;
2425
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
2526
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
2627
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
@@ -29,7 +30,7 @@
2930
/**
3031
* Class ApisearchBundle.
3132
*/
32-
class ApisearchBundle extends BaseBundle
33+
class ApisearchBundle extends BaseBundle implements DependentBundleInterface
3334
{
3435
/**
3536
* Return a CompilerPass instance array.

Command/AddTokenCommand.php

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
*/
2929
class AddTokenCommand extends WithAppRepositoryBucketCommand
3030
{
31+
/**
32+
* @var string
33+
*/
34+
protected static $defaultName = 'apisearch:add-token';
35+
3136
/**
3237
* Configures the current command.
3338
*/

Command/ConfigureIndexCommand.php

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
*/
2727
class ConfigureIndexCommand extends IndexBasedCommand
2828
{
29+
/**
30+
* @var string
31+
*/
32+
protected static $defaultName = 'apisearch:configure-index';
33+
2934
/**
3035
* Dispatch domain event.
3136
*

Command/CreateIndexCommand.php

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
*/
2727
class CreateIndexCommand extends IndexBasedCommand
2828
{
29+
/**
30+
* @var string
31+
*/
32+
protected static $defaultName = 'apisearch:create-index';
33+
2934
/**
3035
* Dispatch domain event.
3136
*

Command/DeleteIndexCommand.php

+5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
*/
2626
class DeleteIndexCommand extends WithAppRepositoryBucketCommand
2727
{
28+
/**
29+
* @var string
30+
*/
31+
protected static $defaultName = 'apisearch:delete-index';
32+
2833
/**
2934
* Configures the current command.
3035
*/

Command/DeleteTokenCommand.php

+5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
*/
2626
class DeleteTokenCommand extends WithAppRepositoryBucketCommand
2727
{
28+
/**
29+
* @var string
30+
*/
31+
protected static $defaultName = 'apisearch:delete-token';
32+
2833
/**
2934
* Configures the current command.
3035
*/

Command/DeleteTokensCommand.php

+5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
*/
2525
class DeleteTokensCommand extends WithAppRepositoryBucketCommand
2626
{
27+
/**
28+
* @var string
29+
*/
30+
protected static $defaultName = 'apisearch:delete-tokens';
31+
2732
/**
2833
* Configures the current command.
2934
*/

Command/ExportIndexCommand.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,17 @@
2727
*/
2828
class ExportIndexCommand extends WithRepositoryBucketCommand
2929
{
30+
/**
31+
* @var string
32+
*/
33+
protected static $defaultName = 'apisearch:export-index';
34+
3035
/**
3136
* Configures the current command.
3237
*/
3338
protected function configure()
3439
{
3540
$this
36-
->setName('apisearch:export-index')
3741
->setDescription('Export your index')
3842
->addArgument(
3943
'app-name',

Command/ImportIndexCommand.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,17 @@
2525
*/
2626
class ImportIndexCommand extends WithRepositoryBucketCommand
2727
{
28+
/**
29+
* @var string
30+
*/
31+
protected static $defaultName = 'apisearch:import-index';
32+
2833
/**
2934
* Configures the current command.
3035
*/
3136
protected function configure()
3237
{
3338
$this
34-
->setName('apisearch:import-index')
3539
->setDescription('Import your index')
3640
->addArgument(
3741
'app-name',

Command/PrintIndicesCommand.php

+5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
*/
2828
class PrintIndicesCommand extends WithAppRepositoryBucketCommand
2929
{
30+
/**
31+
* @var string
32+
*/
33+
protected static $defaultName = 'apisearch:print-indices';
34+
3035
/**
3136
* Configures the current command.
3237
*/

Command/PrintTokensCommand.php

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
*/
2929
class PrintTokensCommand extends WithAppRepositoryBucketCommand
3030
{
31+
/**
32+
* @var string
33+
*/
34+
protected static $defaultName = 'apisearch:print-tokens';
35+
3136
/**
3237
* Configures the current command.
3338
*/

Command/QueryCommand.php

+5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
*/
3030
class QueryCommand extends WithRepositoryBucketCommand
3131
{
32+
/**
33+
* @var string
34+
*/
35+
protected static $defaultName = 'apisearch:query';
36+
3237
/**
3338
* Configures the current command.
3439
*/

Command/ResetIndexCommand.php

+5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
*/
2525
class ResetIndexCommand extends WithAppRepositoryBucketCommand
2626
{
27+
/**
28+
* @var string
29+
*/
30+
protected static $defaultName = 'apisearch:reset-index';
31+
2732
/**
2833
* Configures the current command.
2934
*/

DependencyInjection/ApisearchConfiguration.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515

1616
namespace Apisearch\DependencyInjection;
1717

18+
use Apisearch\App\MockAppRepository;
1819
use Apisearch\Http\Retry;
20+
use Apisearch\Repository\MockRepository;
21+
use Apisearch\User\MockUserRepository;
1922
use Mmoreram\BaseBundle\DependencyInjection\BaseConfiguration;
2023
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
2124

@@ -93,23 +96,23 @@ protected function setupTree(ArrayNodeDefinition $rootNode)
9396
->addDefaultsIfNotSet()
9497
->children()
9598
->scalarNode('repository_service')
96-
->defaultValue('apisearch.repository_mock')
99+
->defaultValue(MockRepository::class)
97100
->end()
98101
->end()
99102
->end()
100103
->arrayNode('app')
101104
->addDefaultsIfNotSet()
102105
->children()
103106
->scalarNode('repository_service')
104-
->defaultValue('apisearch.app_repository_mock')
107+
->defaultValue(MockAppRepository::class)
105108
->end()
106109
->end()
107110
->end()
108111
->arrayNode('user')
109112
->addDefaultsIfNotSet()
110113
->children()
111114
->scalarNode('repository_service')
112-
->defaultValue('apisearch.user_repository_mock')
115+
->defaultValue(MockUserRepository::class)
113116
->end()
114117
->end()
115118
->end();

DependencyInjection/CompilerPass/ExporterCompilerPass.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
namespace Apisearch\DependencyInjection\CompilerPass;
1717

18+
use Apisearch\Exporter\ExporterCollection;
19+
1820
/**
1921
* Class ExporterCompilerPass.
2022
*/
@@ -27,7 +29,7 @@ class ExporterCompilerPass extends TagCompilerPass
2729
*/
2830
public function getCollectorServiceName(): string
2931
{
30-
return 'apisearch.exporter_collection';
32+
return ExporterCollection::class;
3133
}
3234

3335
/**

DependencyInjection/CompilerPass/ReadTransformerCompilerPass.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
namespace Apisearch\DependencyInjection\CompilerPass;
1717

18+
use Apisearch\Transformer\Transformer;
19+
1820
/**
1921
* Class ReadTransformerCompilerPass.
2022
*/
@@ -27,7 +29,7 @@ class ReadTransformerCompilerPass extends TagCompilerPass
2729
*/
2830
public function getCollectorServiceName(): string
2931
{
30-
return 'apisearch.transformer';
32+
return Transformer::class;
3133
}
3234

3335
/**

0 commit comments

Comments
 (0)