Skip to content

Commit b4eef8f

Browse files
committed
run codestyle fix
1 parent 3478f7b commit b4eef8f

File tree

148 files changed

+693
-1463
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+693
-1463
lines changed

config/module.config.php

+20-18
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
return [
46
'service_manager' => [
5-
'factories' => [
6-
\Reinfi\DependencyInjection\Config\ModuleConfig::class => \Reinfi\DependencyInjection\Config\Factory\ModuleConfigFactory::class,
7-
\Reinfi\DependencyInjection\Service\Extractor\AnnotationExtractor::class => \Reinfi\DependencyInjection\Service\Extractor\Factory\AnnotationExtractorFactory::class,
8-
\Reinfi\DependencyInjection\Service\Extractor\AttributeExtractor::class => \Laminas\ServiceManager\Factory\InvokableFactory::class,
9-
\Reinfi\DependencyInjection\Service\Extractor\YamlExtractor::class => \Reinfi\DependencyInjection\Service\Extractor\Factory\YamlExtractorFactory::class,
10-
\Reinfi\DependencyInjection\Service\InjectionService::class => \Reinfi\DependencyInjection\Service\Factory\InjectionServiceFactory::class,
11-
\Reinfi\DependencyInjection\Service\CacheService::class => \Reinfi\DependencyInjection\Service\Factory\CacheServiceFactory::class,
12-
\Reinfi\DependencyInjection\Service\ConfigService::class => \Reinfi\DependencyInjection\Service\Factory\ConfigServiceFactory::class,
13-
\Reinfi\DependencyInjection\Service\AutoWiringService::class => \Reinfi\DependencyInjection\Service\Factory\AutoWiringServiceFactory::class,
14-
\Reinfi\DependencyInjection\Service\Extractor\ExtractorInterface::class => \Reinfi\DependencyInjection\Service\Extractor\Factory\ExtractorFactory::class,
15-
\Reinfi\DependencyInjection\Service\AutoWiring\ResolverService::class => \Reinfi\DependencyInjection\Service\AutoWiring\Factory\ResolverServiceFactory::class,
16-
\Reinfi\DependencyInjection\Service\AutoWiring\LazyResolverService::class => \Reinfi\DependencyInjection\Service\AutoWiring\Factory\LazyResolverServiceFactory::class,
17-
\Reinfi\DependencyInjection\Service\AutoWiring\Resolver\ContainerResolver::class => \Reinfi\DependencyInjection\Service\AutoWiring\Resolver\Factory\ContainerResolverFactory::class,
18-
\Reinfi\DependencyInjection\Service\AutoWiring\Resolver\ContainerInterfaceResolver::class => \Laminas\ServiceManager\Factory\InvokableFactory::class,
19-
\Reinfi\DependencyInjection\Service\AutoWiring\Resolver\PluginManagerResolver::class => \Reinfi\DependencyInjection\Service\AutoWiring\Resolver\Factory\PluginManagerResolverFactory::class,
20-
\Reinfi\DependencyInjection\Service\AutoWiring\Resolver\RequestResolver::class => \Laminas\ServiceManager\Factory\InvokableFactory::class,
21-
\Reinfi\DependencyInjection\Service\AutoWiring\Resolver\ResponseResolver::class => \Laminas\ServiceManager\Factory\InvokableFactory::class,
22-
\Reinfi\DependencyInjection\Service\AutoWiring\Resolver\TranslatorResolver::class => \Reinfi\DependencyInjection\Service\AutoWiring\Resolver\Factory\TranslatorResolverFactory::class,
7+
'factories' => [
8+
\Reinfi\DependencyInjection\Config\ModuleConfig::class => \Reinfi\DependencyInjection\Config\Factory\ModuleConfigFactory::class,
9+
\Reinfi\DependencyInjection\Service\Extractor\AnnotationExtractor::class => \Reinfi\DependencyInjection\Service\Extractor\Factory\AnnotationExtractorFactory::class,
10+
\Reinfi\DependencyInjection\Service\Extractor\AttributeExtractor::class => \Laminas\ServiceManager\Factory\InvokableFactory::class,
11+
\Reinfi\DependencyInjection\Service\Extractor\YamlExtractor::class => \Reinfi\DependencyInjection\Service\Extractor\Factory\YamlExtractorFactory::class,
12+
\Reinfi\DependencyInjection\Service\InjectionService::class => \Reinfi\DependencyInjection\Service\Factory\InjectionServiceFactory::class,
13+
\Reinfi\DependencyInjection\Service\CacheService::class => \Reinfi\DependencyInjection\Service\Factory\CacheServiceFactory::class,
14+
\Reinfi\DependencyInjection\Service\ConfigService::class => \Reinfi\DependencyInjection\Service\Factory\ConfigServiceFactory::class,
15+
\Reinfi\DependencyInjection\Service\AutoWiringService::class => \Reinfi\DependencyInjection\Service\Factory\AutoWiringServiceFactory::class,
16+
\Reinfi\DependencyInjection\Service\Extractor\ExtractorInterface::class => \Reinfi\DependencyInjection\Service\Extractor\Factory\ExtractorFactory::class,
17+
\Reinfi\DependencyInjection\Service\AutoWiring\ResolverService::class => \Reinfi\DependencyInjection\Service\AutoWiring\Factory\ResolverServiceFactory::class,
18+
\Reinfi\DependencyInjection\Service\AutoWiring\LazyResolverService::class => \Reinfi\DependencyInjection\Service\AutoWiring\Factory\LazyResolverServiceFactory::class,
19+
\Reinfi\DependencyInjection\Service\AutoWiring\Resolver\ContainerResolver::class => \Reinfi\DependencyInjection\Service\AutoWiring\Resolver\Factory\ContainerResolverFactory::class,
20+
\Reinfi\DependencyInjection\Service\AutoWiring\Resolver\ContainerInterfaceResolver::class => \Laminas\ServiceManager\Factory\InvokableFactory::class,
21+
\Reinfi\DependencyInjection\Service\AutoWiring\Resolver\PluginManagerResolver::class => \Reinfi\DependencyInjection\Service\AutoWiring\Resolver\Factory\PluginManagerResolverFactory::class,
22+
\Reinfi\DependencyInjection\Service\AutoWiring\Resolver\RequestResolver::class => \Laminas\ServiceManager\Factory\InvokableFactory::class,
23+
\Reinfi\DependencyInjection\Service\AutoWiring\Resolver\ResponseResolver::class => \Laminas\ServiceManager\Factory\InvokableFactory::class,
24+
\Reinfi\DependencyInjection\Service\AutoWiring\Resolver\TranslatorResolver::class => \Reinfi\DependencyInjection\Service\AutoWiring\Resolver\Factory\TranslatorResolverFactory::class,
2325
\Reinfi\DependencyInjection\Service\AutoWiring\Resolver\BuildInTypeWithDefaultResolver::class => \Laminas\ServiceManager\Factory\InvokableFactory::class,
2426

2527
\Reinfi\DependencyInjection\Command\CacheWarmupCommand::class => \Laminas\ServiceManager\Factory\InvokableFactory::class,

src/AbstractFactory/Config/InjectConfigAbstractFactory.php

+11-19
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,10 @@ class InjectConfigAbstractFactory implements AbstractFactoryInterface
1515
{
1616
private const MATCH_PATTERN = '/^Config\.(.*)$/';
1717

18-
/**
19-
* @var array
20-
*/
2118
private array $matches = [];
2219

2320
/**
24-
* @inheritDoc
25-
*/
26-
public function canCreate(
27-
ContainerInterface $container,
28-
$requestedName
29-
): bool {
30-
return preg_match(
31-
self::MATCH_PATTERN,
32-
$requestedName,
33-
$this->matches
34-
) === 1;
35-
}
36-
37-
/**
38-
* @param ContainerInterface $container
3921
* @param string $requestedName
40-
* @param array|null $options
4122
*
4223
* @return mixed|object|null
4324
*/
@@ -51,4 +32,15 @@ public function __invoke(
5132

5233
return $configService->resolve($this->matches[1]);
5334
}
35+
36+
public function canCreate(
37+
ContainerInterface $container,
38+
$requestedName
39+
): bool {
40+
return preg_match(
41+
self::MATCH_PATTERN,
42+
$requestedName,
43+
$this->matches
44+
) === 1;
45+
}
5446
}

src/AbstractFactory/FallbackAutoWiringFactory.php

+10-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace Reinfi\DependencyInjection\AbstractFactory;
@@ -19,23 +20,8 @@
1920
class FallbackAutoWiringFactory implements AbstractFactoryInterface
2021
{
2122
/**
22-
* @param ContainerInterface $container
2323
* @param class-string $requestedName
2424
*
25-
* @return bool
26-
*/
27-
public function canCreate(
28-
ContainerInterface $container,
29-
$requestedName
30-
): bool {
31-
return class_exists($requestedName);
32-
}
33-
34-
/**
35-
* @param ContainerInterface $container
36-
* @param class-string $requestedName
37-
* @param array|null $options
38-
*
3925
* @return mixed
4026
*/
4127
public function __invoke(
@@ -46,4 +32,13 @@ public function __invoke(
4632
return (new AutoWiringFactory())($container, $requestedName, $options);
4733
}
4834

35+
/**
36+
* @param class-string $requestedName
37+
*/
38+
public function canCreate(
39+
ContainerInterface $container,
40+
$requestedName
41+
): bool {
42+
return class_exists($requestedName);
43+
}
4944
}

src/Annotation/AbstractInjectPluginManager.php

+2-11
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,11 @@ abstract class AbstractInjectPluginManager extends AbstractAnnotation
1717

1818
private string $name;
1919

20-
/**
21-
* @var array|null
22-
*/
2320
private ?array $options = null;
2421

25-
/**
26-
* @param array $values
27-
*/
2822
public function __construct(array $values)
2923
{
30-
if (!isset($values['value'])) {
24+
if (! isset($values['value'])) {
3125
if (isset($values['options'])) {
3226
$this->options = $values['options'];
3327
}
@@ -40,15 +34,12 @@ public function __construct(array $values)
4034
$this->name = $values['value'];
4135
}
4236

43-
/**
44-
* @inheritDoc
45-
*/
4637
public function __invoke(ContainerInterface $container)
4738
{
4839
$container = $this->determineContainer($container);
4940
$pluginManagerImplementation = $container->get(static::PLUGIN_MANAGER);
5041

51-
if (!$pluginManagerImplementation instanceof AbstractPluginManager) {
42+
if (! $pluginManagerImplementation instanceof AbstractPluginManager) {
5243
throw InjectionNotPossibleException::fromUnknownPluginManager(static::PLUGIN_MANAGER);
5344
}
5445

src/Annotation/Inject.php

-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ final class Inject implements AnnotationInterface
1919
*/
2020
public $value;
2121

22-
/**
23-
* @inheritDoc
24-
*/
2522
public function __invoke(ContainerInterface $container)
2623
{
2724
return $container->get($this->value);

src/Annotation/InjectConfig.php

+1-12
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,10 @@
1616
*/
1717
final class InjectConfig extends AbstractAnnotation
1818
{
19-
/**
20-
* @var string
21-
*/
2219
private string $configPath;
2320

24-
/**
25-
* @var bool
26-
*/
2721
private bool $asArray = false;
2822

29-
/**
30-
* @param array $values
31-
*/
3223
public function __construct(array $values)
3324
{
3425
if (isset($values['asArray'])) {
@@ -37,9 +28,7 @@ public function __construct(array $values)
3728

3829
$this->configPath = $values['value'];
3930
}
40-
/**
41-
* @inheritDoc
42-
*/
31+
4332
public function __invoke(ContainerInterface $container)
4433
{
4534
$container = $this->determineContainer($container);

src/Annotation/InjectConstant.php

-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ final class InjectConstant implements AnnotationInterface
1919
*/
2020
public $value;
2121

22-
/**
23-
* @inheritDoc
24-
*/
2522
public function __invoke(ContainerInterface $container)
2623
{
2724
return constant($this->value);

src/Annotation/InjectContainer.php

-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
*/
1515
final class InjectContainer implements AnnotationInterface
1616
{
17-
/**
18-
* @inheritDoc
19-
*/
2017
public function __invoke(ContainerInterface $container)
2118
{
2219
return $container;

src/Annotation/InjectControllerPlugin.php

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
namespace Reinfi\DependencyInjection\Annotation;
66

7-
use Attribute;
8-
97
/**
108
* @package Reinfi\DependencyInjection\Annotation
119
*

src/Annotation/InjectDoctrineRepository.php

+3-10
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,9 @@ final class InjectDoctrineRepository extends AbstractAnnotation
1919

2020
private string $entity;
2121

22-
/**
23-
* @param array $values
24-
*/
2522
public function __construct(array $values)
2623
{
27-
if (!isset($values['value'])) {
24+
if (! isset($values['value'])) {
2825
if (isset($values['em']) || isset($values['entityManager'])) {
2926
$this->entityManager = $values['entityManager'] ?? $values['em'];
3027
}
@@ -34,22 +31,18 @@ public function __construct(array $values)
3431
return;
3532
}
3633

37-
3834
$this->entity = $values['value'];
3935
}
4036

41-
/**
42-
* @inheritDoc
43-
*/
4437
public function __invoke(ContainerInterface $container)
4538
{
4639
$container = $this->determineContainer($container);
4740

4841
$entityManager = $container->get($this->entityManager);
4942

5043
if (
51-
!is_object($entityManager)
52-
|| !method_exists($entityManager, 'getRepository')
44+
! is_object($entityManager)
45+
|| ! method_exists($entityManager, 'getRepository')
5346
) {
5447
throw new AutoWiringNotPossibleException($this->entity);
5548
}

src/Annotation/InjectParent.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
namespace Reinfi\DependencyInjection\Annotation;
66

7-
use Psr\Container\ContainerInterface;
87
use Laminas\ServiceManager\AbstractPluginManager;
8+
use Psr\Container\ContainerInterface;
99

1010
/**
1111
* @package Reinfi\DependencyInjection\Annotation
@@ -20,9 +20,6 @@ final class InjectParent implements AnnotationInterface
2020
*/
2121
public $value;
2222

23-
/**
24-
* @inheritDoc
25-
*/
2623
public function __invoke(ContainerInterface $container)
2724
{
2825
if ($container instanceof AbstractPluginManager) {

src/Attribute/AbstractInjectPluginManager.php

+1-7
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ abstract class AbstractInjectPluginManager extends AbstractAttribute
1717

1818
private string $name;
1919

20-
/**
21-
* @var array|null
22-
*/
2320
private ?array $options;
2421

2522
public function __construct(string $name, ?array $options = null)
@@ -28,15 +25,12 @@ public function __construct(string $name, ?array $options = null)
2825
$this->options = $options;
2926
}
3027

31-
/**
32-
* @inheritDoc
33-
*/
3428
public function __invoke(ContainerInterface $container)
3529
{
3630
$container = $this->determineContainer($container);
3731
$pluginManagerImplementation = $container->get(static::PLUGIN_MANAGER);
3832

39-
if (!$pluginManagerImplementation instanceof AbstractPluginManager) {
33+
if (! $pluginManagerImplementation instanceof AbstractPluginManager) {
4034
throw InjectionNotPossibleException::fromUnknownPluginManager(static::PLUGIN_MANAGER);
4135
}
4236

src/Attribute/Inject.php

-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ public function __construct(string $value)
2121
$this->value = $value;
2222
}
2323

24-
/**
25-
* @inheritDoc
26-
*/
2724
public function __invoke(ContainerInterface $container)
2825
{
2926
return $container->get($this->value);

src/Attribute/InjectConfig.php

-9
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,8 @@
1515
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)]
1616
final class InjectConfig extends AbstractAttribute
1717
{
18-
/**
19-
* @var string
20-
*/
2118
private string $configPath;
2219

23-
/**
24-
* @var bool
25-
*/
2620
private bool $asArray;
2721

2822
public function __construct(string $configPath, bool $asArray = false)
@@ -31,9 +25,6 @@ public function __construct(string $configPath, bool $asArray = false)
3125
$this->asArray = $asArray;
3226
}
3327

34-
/**
35-
* @inheritDoc
36-
*/
3728
public function __invoke(ContainerInterface $container)
3829
{
3930
$container = $this->determineContainer($container);

src/Attribute/InjectConstant.php

-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ public function __construct(string $value)
2121
$this->value = $value;
2222
}
2323

24-
/**
25-
* @inheritDoc
26-
*/
2724
public function __invoke(ContainerInterface $container)
2825
{
2926
return constant($this->value);

src/Attribute/InjectContainer.php

-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)]
1515
final class InjectContainer implements InjectionInterface
1616
{
17-
/**
18-
* @inheritDoc
19-
*/
2017
public function __invoke(ContainerInterface $container)
2118
{
2219
return $container;

0 commit comments

Comments
 (0)