@@ -29,7 +29,8 @@ discard block |
||
29 | 29 | $targets = \iterator_to_array($this->parseAttributes($listener)); |
30 | 30 | |
31 | 31 | // If there are no targets, then listener can't be cached. |
32 | - if ($targets === []) { |
|
32 | + if ($targets === []) |
|
33 | + { |
|
33 | 34 | return false; |
34 | 35 | } |
35 | 36 | |
@@ -38,11 +39,13 @@ discard block |
||
38 | 39 | // We decided to load classes/enums/interfaces for each target separately. |
39 | 40 | // It allows us to cache classes/enums/interfaces for each target separately and if we reuse the |
40 | 41 | // same target in multiple listeners, we will not have to load classes/enums/interfaces for the same target. |
41 | - foreach ($targets as $target) { |
|
42 | + foreach ($targets as $target) |
|
43 | + { |
|
42 | 44 | $cacheKey = $this->cacheKeyPrefix . $target; |
43 | 45 | |
44 | 46 | $classes = $this->readCache ? $this->memory->loadData($cacheKey) : null; |
45 | - if ($classes === null) { |
|
47 | + if ($classes === null) |
|
48 | + { |
|
46 | 49 | $this->memory->saveData($cacheKey, $classes = call_user_func($locator, $target)); |
47 | 50 | } |
48 | 51 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | protected readonly MemoryInterface $memory, |
19 | 19 | protected readonly ListenerInvoker $invoker, |
20 | 20 | protected readonly bool $readCache = true, |
21 | - ) { |
|
21 | + ){ |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | protected function doLoad( |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $targets = \iterator_to_array($this->parseAttributes($listener)); |
30 | 30 | |
31 | 31 | // If there are no targets, then listener can't be cached. |
32 | - if ($targets === []) { |
|
32 | + if ($targets === []){ |
|
33 | 33 | return false; |
34 | 34 | } |
35 | 35 | |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | // We decided to load classes/enums/interfaces for each target separately. |
39 | 39 | // It allows us to cache classes/enums/interfaces for each target separately and if we reuse the |
40 | 40 | // same target in multiple listeners, we will not have to load classes/enums/interfaces for the same target. |
41 | - foreach ($targets as $target) { |
|
42 | - $cacheKey = $this->cacheKeyPrefix . $target; |
|
41 | + foreach ($targets as $target){ |
|
42 | + $cacheKey = $this->cacheKeyPrefix.$target; |
|
43 | 43 | |
44 | 44 | $classes = $this->readCache ? $this->memory->loadData($cacheKey) : null; |
45 | - if ($classes === null) { |
|
45 | + if ($classes === null){ |
|
46 | 46 | $this->memory->saveData($cacheKey, $classes = call_user_func($locator, $target)); |
47 | 47 | } |
48 | 48 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | private readonly ClassLocatorByTarget $locator, |
17 | 17 | ListenerInvoker $invoker, |
18 | 18 | bool $readCache = true, |
19 | - ) { |
|
19 | + ){ |
|
20 | 20 | parent::__construct($reader, $memory, $invoker, $readCache); |
21 | 21 | } |
22 | 22 |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | use MockeryPHPUnitIntegration; |
23 | 23 | |
24 | 24 | private EnumLocatorByTarget $locator; |
25 | - private EnumsInterface|m\LegacyMockInterface|m\MockInterface $classes; |
|
26 | - private ScopedEnumsInterface|m\LegacyMockInterface|m\MockInterface $scopedClasses; |
|
25 | + private EnumsInterface | m\LegacyMockInterface | m\MockInterface $classes; |
|
26 | + private ScopedEnumsInterface | m\LegacyMockInterface | m\MockInterface $scopedClasses; |
|
27 | 27 | |
28 | 28 | protected function setUp(): void |
29 | 29 | { |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | $attr = $attr->getAttributes()[0]; |
80 | 80 | $attribute = $attr->newInstance(); |
81 | 81 | |
82 | - if ($attribute->getScope() === null) { |
|
82 | + if ($attribute->getScope() === null){ |
|
83 | 83 | $this->classes |
84 | 84 | ->shouldReceive('getEnums') |
85 | 85 | ->andReturn($enums); |
86 | - } else { |
|
86 | + }else{ |
|
87 | 87 | $this->scopedClasses |
88 | 88 | ->shouldReceive('getScopedEnums') |
89 | 89 | ->with($attribute->getScope()) |
@@ -79,11 +79,14 @@ |
||
79 | 79 | $attr = $attr->getAttributes()[0]; |
80 | 80 | $attribute = $attr->newInstance(); |
81 | 81 | |
82 | - if ($attribute->getScope() === null) { |
|
82 | + if ($attribute->getScope() === null) |
|
83 | + { |
|
83 | 84 | $this->classes |
84 | 85 | ->shouldReceive('getEnums') |
85 | 86 | ->andReturn($enums); |
86 | - } else { |
|
87 | + } |
|
88 | + else |
|
89 | + { |
|
87 | 90 | $this->scopedClasses |
88 | 91 | ->shouldReceive('getScopedEnums') |
89 | 92 | ->with($attribute->getScope()) |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | use MockeryPHPUnitIntegration; |
26 | 26 | |
27 | 27 | private InterfaceLocatorByTarget $locator; |
28 | - private InterfacesInterface|m\LegacyMockInterface|m\MockInterface $interfaces; |
|
29 | - private ScopedInterfacesInterface|m\LegacyMockInterface|m\MockInterface $scopedInterfaces; |
|
28 | + private InterfacesInterface | m\LegacyMockInterface | m\MockInterface $interfaces; |
|
29 | + private ScopedInterfacesInterface | m\LegacyMockInterface | m\MockInterface $scopedInterfaces; |
|
30 | 30 | |
31 | 31 | protected function setUp(): void |
32 | 32 | { |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | $attr = $attr->getAttributes()[0]; |
106 | 106 | $attribute = $attr->newInstance(); |
107 | 107 | |
108 | - if ($attribute->getScope() === null) { |
|
108 | + if ($attribute->getScope() === null){ |
|
109 | 109 | $this->interfaces |
110 | 110 | ->shouldReceive('getInterfaces') |
111 | 111 | ->andReturn($interfaces); |
112 | - } else { |
|
112 | + }else{ |
|
113 | 113 | $this->scopedInterfaces |
114 | 114 | ->shouldReceive('getScopedInterfaces') |
115 | 115 | ->with($attribute->getScope()) |
@@ -105,11 +105,14 @@ |
||
105 | 105 | $attr = $attr->getAttributes()[0]; |
106 | 106 | $attribute = $attr->newInstance(); |
107 | 107 | |
108 | - if ($attribute->getScope() === null) { |
|
108 | + if ($attribute->getScope() === null) |
|
109 | + { |
|
109 | 110 | $this->interfaces |
110 | 111 | ->shouldReceive('getInterfaces') |
111 | 112 | ->andReturn($interfaces); |
112 | - } else { |
|
113 | + } |
|
114 | + else |
|
115 | + { |
|
113 | 116 | $this->scopedInterfaces |
114 | 117 | ->shouldReceive('getScopedInterfaces') |
115 | 118 | ->with($attribute->getScope()) |
@@ -13,7 +13,7 @@ |
||
13 | 13 | protected function someFunction() |
14 | 14 | { |
15 | 15 | $result = $this->sampleMethod('hello world'); |
16 | - print_r(self::sampleMethod($result . 'plus')); |
|
16 | + print_r(self::sampleMethod($result.'plus')); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | public function testInstance(): void |
@@ -26,7 +26,7 @@ |
||
26 | 26 | |
27 | 27 | protected function mapDirectories(array $directories): array |
28 | 28 | { |
29 | - $dir = \dirname(__DIR__) . '/Fixtures'; |
|
29 | + $dir = \dirname(__DIR__).'/Fixtures'; |
|
30 | 30 | |
31 | 31 | return $directories + ['config' => $dir, 'app' => $dir, 'resources' => $dir, 'runtime' => $dir]; |
32 | 32 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | |
27 | 27 | protected function mapDirectories(array $directories): array |
28 | 28 | { |
29 | - $dir = \dirname(__DIR__) . '/Fixtures'; |
|
29 | + $dir = \dirname(__DIR__).'/Fixtures'; |
|
30 | 30 | |
31 | 31 | return $directories + ['config' => $dir, 'app' => $dir, 'resources' => $dir, 'runtime' => $dir]; |
32 | 32 | } |
@@ -11,6 +11,6 @@ |
||
11 | 11 | { |
12 | 12 | public function init(TokenizerBootloader $tokenizer): void |
13 | 13 | { |
14 | - $tokenizer->addDirectory(\dirname(__DIR__, 2) . '/Fixtures/Bootloader'); |
|
14 | + $tokenizer->addDirectory(\dirname(__DIR__, 2).'/Fixtures/Bootloader'); |
|
15 | 15 | } |
16 | 16 | } |
@@ -34,7 +34,8 @@ discard block |
||
34 | 34 | $filter = $this->createFilterInstance($name); |
35 | 35 | [$mappingSchema, $errors, $setters, $optionalFilters] = $attributeMapper->map($filter, $input); |
36 | 36 | |
37 | - if ($filter instanceof HasFilterDefinition) { |
|
37 | + if ($filter instanceof HasFilterDefinition) |
|
38 | + { |
|
38 | 39 | $mappingSchema = \array_merge( |
39 | 40 | $mappingSchema, |
40 | 41 | $filter->filterDefinition()->mappingSchema() |
@@ -48,7 +49,8 @@ discard block |
||
48 | 49 | \assert($schemaBuilder instanceof Builder); |
49 | 50 | |
50 | 51 | $schema = $schemaBuilder->makeSchema($name, $mappingSchema); |
51 | - foreach ($optionalFilters as $optionalFilter) { |
|
52 | + foreach ($optionalFilters as $optionalFilter) |
|
53 | + { |
|
52 | 54 | $schema[$optionalFilter][Builder::SCHEMA_OPTIONAL] = true; |
53 | 55 | } |
54 | 56 | |
@@ -66,7 +68,8 @@ discard block |
||
66 | 68 | $class = new \ReflectionClass($name); |
67 | 69 | |
68 | 70 | $args = []; |
69 | - if ($constructor = $class->getConstructor()) { |
|
71 | + if ($constructor = $class->getConstructor()) |
|
72 | + { |
|
70 | 73 | $args = $this->resolver->resolveArguments($constructor); |
71 | 74 | } |
72 | 75 |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | public function __construct( |
27 | 27 | private readonly ContainerInterface $container, |
28 | 28 | private readonly ResolverInterface $resolver, |
29 | - private readonly HandlerInterface|CoreInterface $core |
|
30 | - ) { |
|
29 | + private readonly HandlerInterface | CoreInterface $core |
|
30 | + ){ |
|
31 | 31 | $this->isLegacy = !$core instanceof HandlerInterface; |
32 | 32 | } |
33 | 33 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $filter = $this->createFilterInstance($name); |
40 | 40 | [$mappingSchema, $errors, $setters, $optionalFilters] = $attributeMapper->map($filter, $input); |
41 | 41 | |
42 | - if ($filter instanceof HasFilterDefinition) { |
|
42 | + if ($filter instanceof HasFilterDefinition){ |
|
43 | 43 | $mappingSchema = \array_merge( |
44 | 44 | $mappingSchema, |
45 | 45 | $filter->filterDefinition()->mappingSchema() |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | \assert($schemaBuilder instanceof Builder); |
54 | 54 | |
55 | 55 | $schema = $schemaBuilder->makeSchema($name, $mappingSchema); |
56 | - foreach ($optionalFilters as $optionalFilter) { |
|
56 | + foreach ($optionalFilters as $optionalFilter){ |
|
57 | 57 | $schema[$optionalFilter][Builder::SCHEMA_OPTIONAL] = true; |
58 | 58 | } |
59 | 59 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $class = new \ReflectionClass($name); |
75 | 75 | |
76 | 76 | $args = []; |
77 | - if ($constructor = $class->getConstructor()) { |
|
77 | + if ($constructor = $class->getConstructor()){ |
|
78 | 78 | $args = $this->resolver->resolveArguments($constructor); |
79 | 79 | } |
80 | 80 |