Passed
Pull Request — master (#961)
by Maxim
18:51
created
src/Filters/tests/Model/Schema/InputMapperTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@
 block discarded – undo
20 20
 
21 21
 final class InputMapperTest extends BaseTestCase
22 22
 {
23
-    private m\LegacyMockInterface|m\MockInterface|FilterProviderInterface $provider;
23
+    private m\LegacyMockInterface | m\MockInterface | FilterProviderInterface $provider;
24 24
     private InputMapper $mapper;
25
-    private m\LegacyMockInterface|m\MockInterface|SchemaProviderInterface $schemaProvider;
25
+    private m\LegacyMockInterface | m\MockInterface | SchemaProviderInterface $schemaProvider;
26 26
 
27 27
     public function setUp(): void
28 28
     {
Please login to merge, or discard this patch.
src/Filters/tests/Model/FilterProviderTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
         parent::setUp();
38 38
 
39 39
         $this->container->bindSingleton(ReaderInterface::class, (new Factory())->create());
40
-        $this->container->bindSingleton(SchemaProviderInterface::class, static function (FactoryInterface $factory) {
40
+        $this->container->bindSingleton(SchemaProviderInterface::class, static function (FactoryInterface $factory){
41 41
             return $factory->make(SchemaProvider::class, [
42 42
                 'readers' => [
43 43
                     $factory->make(AttributeReader::class),
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,8 @@
 block discarded – undo
37 37
         parent::setUp();
38 38
 
39 39
         $this->container->bindSingleton(ReaderInterface::class, (new Factory())->create());
40
-        $this->container->bindSingleton(SchemaProviderInterface::class, static function (FactoryInterface $factory) {
40
+        $this->container->bindSingleton(SchemaProviderInterface::class, static function (FactoryInterface $factory)
41
+        {
41 42
             return $factory->make(SchemaProvider::class, [
42 43
                 'readers' => [
43 44
                     $factory->make(AttributeReader::class),
Please login to merge, or discard this patch.
src/Filters/src/Model/Interceptor/Validation/ValidateFilterInterceptor.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
         $errors = array_merge($core->callAction($controller, $action, $parameters), $parameters['errors'] ?? []);
19 19
         $errorMapper = new ErrorMapper($parameters['schema']);
20 20
 
21
-        if ($errors !== []) {
21
+        if ($errors !== []){
22 22
             throw new ValidationException(
23 23
                 $errorMapper->mapErrors($errors),
24 24
                 $parameters['context'] ?? null
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@
 block discarded – undo
18 18
         $errors = array_merge($core->callAction($controller, $action, $parameters), $parameters['errors'] ?? []);
19 19
         $errorMapper = new ErrorMapper($parameters['schema']);
20 20
 
21
-        if ($errors !== []) {
21
+        if ($errors !== [])
22
+        {
22 23
             throw new ValidationException(
23 24
                 $errorMapper->mapErrors($errors),
24 25
                 $parameters['context'] ?? null
Please login to merge, or discard this patch.
src/Filters/src/Model/Interceptor/Validation/Core.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 {
16 16
     public function __construct(
17 17
         private readonly ContainerInterface $container
18
-    ) {
18
+    ){
19 19
     }
20 20
 
21 21
     public function callAction(string $controller, string $action, array $parameters = []): array
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 
30 30
     private function validateFilter(FilterInterface $filter, array $data, mixed $context = null): array
31 31
     {
32
-        if ($filter instanceof HasFilterDefinition) {
32
+        if ($filter instanceof HasFilterDefinition){
33 33
             $definition = $filter->filterDefinition();
34
-            if ($definition instanceof ShouldBeValidated) {
34
+            if ($definition instanceof ShouldBeValidated){
35 35
                 /** @var ValidationProviderInterface $validationProvider */
36 36
                 $validationProvider = $this->container->get(ValidationProviderInterface::class);
37 37
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,9 +29,11 @@
 block discarded – undo
29 29
 
30 30
     private function validateFilter(FilterInterface $filter, array $data, mixed $context = null): array
31 31
     {
32
-        if ($filter instanceof HasFilterDefinition) {
32
+        if ($filter instanceof HasFilterDefinition)
33
+        {
33 34
             $definition = $filter->filterDefinition();
34
-            if ($definition instanceof ShouldBeValidated) {
35
+            if ($definition instanceof ShouldBeValidated)
36
+            {
35 37
                 /** @var ValidationProviderInterface $validationProvider */
36 38
                 $validationProvider = $this->container->get(ValidationProviderInterface::class);
37 39
 
Please login to merge, or discard this patch.
src/Filters/src/Model/Schema/AttributeReader.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 {
20 20
     public function __construct(
21 21
         private readonly AttributesReader $reader
22
-    ) {
22
+    ){
23 23
     }
24 24
 
25 25
     /**
@@ -33,15 +33,15 @@  discard block
 block discarded – undo
33 33
         $setters = [];
34 34
         $class = new \ReflectionClass($filter);
35 35
 
36
-        foreach ($class->getProperties() as $property) {
36
+        foreach ($class->getProperties() as $property){
37 37
             /** @var object $attribute */
38
-            foreach ($this->reader->getPropertyMetadata($property) as $attribute) {
39
-                if ($attribute instanceof AbstractInput || $attribute instanceof NestedFilter) {
38
+            foreach ($this->reader->getPropertyMetadata($property) as $attribute){
39
+                if ($attribute instanceof AbstractInput || $attribute instanceof NestedFilter){
40 40
                     $schema[$property->getName()] = $attribute->getSchema($property);
41
-                } elseif ($attribute instanceof NestedArray) {
41
+                } elseif ($attribute instanceof NestedArray){
42 42
                     $prefix = $attribute->input->key ?? $attribute->prefix ?? $property->getName();
43
-                    $schema[$property->getName()] = [$attribute->class, $prefix . '.*'];
44
-                } elseif ($attribute instanceof Setter) {
43
+                    $schema[$property->getName()] = [$attribute->class, $prefix.'.*'];
44
+                } elseif ($attribute instanceof Setter){
45 45
                     $setters[$property->getName()][] = $attribute;
46 46
                 }
47 47
             }
Please login to merge, or discard this patch.
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,15 +33,22 @@
 block discarded – undo
33 33
         $setters = [];
34 34
         $class = new \ReflectionClass($filter);
35 35
 
36
-        foreach ($class->getProperties() as $property) {
36
+        foreach ($class->getProperties() as $property)
37
+        {
37 38
             /** @var object $attribute */
38
-            foreach ($this->reader->getPropertyMetadata($property) as $attribute) {
39
-                if ($attribute instanceof AbstractInput || $attribute instanceof NestedFilter) {
39
+            foreach ($this->reader->getPropertyMetadata($property) as $attribute)
40
+            {
41
+                if ($attribute instanceof AbstractInput || $attribute instanceof NestedFilter)
42
+                {
40 43
                     $schema[$property->getName()] = $attribute->getSchema($property);
41
-                } elseif ($attribute instanceof NestedArray) {
44
+                }
45
+                elseif ($attribute instanceof NestedArray)
46
+                {
42 47
                     $prefix = $attribute->input->key ?? $attribute->prefix ?? $property->getName();
43 48
                     $schema[$property->getName()] = [$attribute->class, $prefix . '.*'];
44
-                } elseif ($attribute instanceof Setter) {
49
+                }
50
+                elseif ($attribute instanceof Setter)
51
+                {
45 52
                     $setters[$property->getName()][] = $attribute;
46 53
                 }
47 54
             }
Please login to merge, or discard this patch.
src/Filters/src/Model/Mapper/SetterRegistry.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 
12 12
     public function __construct(array $setters = [])
13 13
     {
14
-        foreach ($setters as $setter) {
14
+        foreach ($setters as $setter){
15 15
             $this->register($setter);
16 16
         }
17 17
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,8 @@
 block discarded – undo
11 11
 
12 12
     public function __construct(array $setters = [])
13 13
     {
14
-        foreach ($setters as $setter) {
14
+        foreach ($setters as $setter)
15
+        {
15 16
             $this->register($setter);
16 17
         }
17 18
     }
Please login to merge, or discard this patch.
src/Filters/src/Model/Mapper/Uuid.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
     public function supports(\ReflectionNamedType $type): bool
15 15
     {
16
-        if ($this->interfaceExists === null) {
16
+        if ($this->interfaceExists === null){
17 17
             $this->interfaceExists = \interface_exists(UuidInterface::class);
18 18
         }
19 19
 
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
27 27
 
28 28
     private function implements(string $haystack, string $interface): bool
29 29
     {
30
-        if ($haystack === $interface) {
30
+        if ($haystack === $interface){
31 31
             return true;
32 32
         }
33 33
 
34
-        foreach ((array)\class_implements($haystack) as $implements) {
35
-            if ($implements === $interface) {
34
+        foreach ((array)\class_implements($haystack) as $implements){
35
+            if ($implements === $interface){
36 36
                 return true;
37 37
             }
38 38
 
39
-            if (self::implements($implements, $interface)) {
39
+            if (self::implements($implements, $interface)){
40 40
                 return true;
41 41
             }
42 42
         }
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,7 +13,8 @@  discard block
 block discarded – undo
13 13
 
14 14
     public function supports(\ReflectionNamedType $type): bool
15 15
     {
16
-        if ($this->interfaceExists === null) {
16
+        if ($this->interfaceExists === null)
17
+        {
17 18
             $this->interfaceExists = \interface_exists(UuidInterface::class);
18 19
         }
19 20
 
@@ -27,16 +28,20 @@  discard block
 block discarded – undo
27 28
 
28 29
     private function implements(string $haystack, string $interface): bool
29 30
     {
30
-        if ($haystack === $interface) {
31
+        if ($haystack === $interface)
32
+        {
31 33
             return true;
32 34
         }
33 35
 
34
-        foreach ((array)\class_implements($haystack) as $implements) {
35
-            if ($implements === $interface) {
36
+        foreach ((array)\class_implements($haystack) as $implements)
37
+        {
38
+            if ($implements === $interface)
39
+            {
36 40
                 return true;
37 41
             }
38 42
 
39
-            if (self::implements($implements, $interface)) {
43
+            if (self::implements($implements, $interface))
44
+            {
40 45
                 return true;
41 46
             }
42 47
         }
Please login to merge, or discard this patch.
src/Filters/src/Model/FilterProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
         private readonly CoreInterface $validationCore,
26 26
         private readonly FilterFactory $filterFactory,
27 27
         private readonly SchemaProviderInterface $schemaProvider
28
-    ) {
28
+    ){
29 29
     }
30 30
 
31 31
     public function createFilter(string $name, InputInterface $input): FilterInterface
Please login to merge, or discard this patch.
src/Filters/src/Model/Factory/FilterFactory.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 {
15 15
     public function __construct(
16 16
         private readonly ResolverInterface $resolver,
17
-    ) {
17
+    ){
18 18
     }
19 19
 
20 20
     public function createFilterInstance(string $name): FilterInterface
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         $class = new \ReflectionClass($name);
23 23
 
24 24
         $args = [];
25
-        if ($constructor = $class->getConstructor()) {
25
+        if ($constructor = $class->getConstructor()){
26 26
             $args = $this->resolver->resolveArguments($constructor);
27 27
         }
28 28
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,8 @@
 block discarded – undo
22 22
         $class = new \ReflectionClass($name);
23 23
 
24 24
         $args = [];
25
-        if ($constructor = $class->getConstructor()) {
25
+        if ($constructor = $class->getConstructor())
26
+        {
26 27
             $args = $this->resolver->resolveArguments($constructor);
27 28
         }
28 29
 
Please login to merge, or discard this patch.