Passed
Pull Request — master (#592)
by Aleksei
06:09
created
src/Bridge/DataGrid/src/Interceptor/GridInterceptor.php 2 patches
Braces   +27 added lines, -13 removed lines patch added patch discarded remove patch
@@ -72,14 +72,17 @@  discard block
 block discarded – undo
72 72
     {
73 73
         $result = $core->callAction($controller, $action, $parameters);
74 74
 
75
-        if (is_iterable($result)) {
75
+        if (is_iterable($result))
76
+        {
76 77
             $schema = $this->getSchema($controller, $action);
77
-            if ($schema !== null) {
78
+            if ($schema !== null)
79
+            {
78 80
                 $grid = $this->makeFactory($schema)
79 81
                     ->withDefaults($schema['defaults'])
80 82
                     ->create($result, $schema['grid']);
81 83
 
82
-                if ($schema['view'] !== null) {
84
+                if ($schema['view'] !== null)
85
+                {
83 86
                     $grid = $grid->withView($schema['view']);
84 87
                 }
85 88
 
@@ -99,20 +102,25 @@  discard block
 block discarded – undo
99 102
     private function getSchema(string $controller, string $action): ?array
100 103
     {
101 104
         $key = sprintf('%s:%s', $controller, $action);
102
-        if (array_key_exists($key, $this->cache)) {
105
+        if (array_key_exists($key, $this->cache))
106
+        {
103 107
             return $this->cache[$key];
104 108
         }
105 109
 
106 110
         $this->cache[$key] = null;
107
-        try {
111
+        try
112
+        {
108 113
             $method = new \ReflectionMethod($controller, $action);
109
-        } catch (\ReflectionException $e) {
114
+        }
115
+        catch (\ReflectionException $e)
116
+        {
110 117
             return null;
111 118
         }
112 119
 
113 120
         /** @var null|DataGrid $dataGrid */
114 121
         $dataGrid = $this->reader->firstFunctionMetadata($method, DataGrid::class);
115
-        if ($dataGrid === null) {
122
+        if ($dataGrid === null)
123
+        {
116 124
             return null;
117 125
         }
118 126
 
@@ -133,19 +141,23 @@  discard block
 block discarded – undo
133 141
             'factory'  => $dataGrid->factory,
134 142
         ];
135 143
 
136
-        if (is_string($schema['view'])) {
144
+        if (is_string($schema['view']))
145
+        {
137 146
             $schema['view'] = $this->container->get($schema['view']);
138 147
         }
139 148
 
140
-        if ($schema['defaults'] === [] && method_exists($schema['grid'], 'getDefaults')) {
149
+        if ($schema['defaults'] === [] && method_exists($schema['grid'], 'getDefaults'))
150
+        {
141 151
             $schema['defaults'] = $schema['grid']->getDefaults();
142 152
         }
143 153
 
144
-        if ($schema['options'] === [] && method_exists($schema['grid'], 'getOptions')) {
154
+        if ($schema['options'] === [] && method_exists($schema['grid'], 'getOptions'))
155
+        {
145 156
             $schema['options'] = $schema['grid']->getOptions();
146 157
         }
147 158
 
148
-        if ($schema['view'] === null && is_callable($schema['grid'])) {
159
+        if ($schema['view'] === null && is_callable($schema['grid']))
160
+        {
149 161
             $schema['view'] = $schema['grid'];
150 162
         }
151 163
 
@@ -154,9 +166,11 @@  discard block
 block discarded – undo
154 166
 
155 167
     private function makeFactory(array $schema): GridFactoryInterface
156 168
     {
157
-        if (!empty($schema['factory']) && $this->container->has($schema['factory'])) {
169
+        if (!empty($schema['factory']) && $this->container->has($schema['factory']))
170
+        {
158 171
             $factory = $this->container->get($schema['factory']);
159
-            if ($factory instanceof GridFactoryInterface) {
172
+            if ($factory instanceof GridFactoryInterface)
173
+            {
160 174
                 return $factory;
161 175
             }
162 176
         }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         ContainerInterface $container,
53 53
         GridFactory $gridFactory,
54 54
         ReaderInterface $reader
55
-    ) {
55
+    ){
56 56
         $this->response = $response;
57 57
         $this->container = $container;
58 58
         $this->gridFactory = $gridFactory;
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
     {
72 72
         $result = $core->callAction($controller, $action, $parameters);
73 73
 
74
-        if (is_iterable($result)) {
74
+        if (is_iterable($result)){
75 75
             $schema = $this->getSchema($controller, $action);
76
-            if ($schema !== null) {
76
+            if ($schema !== null){
77 77
                 $grid = $this->makeFactory($schema)
78 78
                     ->withDefaults($schema['defaults'])
79 79
                     ->create($result, $schema['grid']);
80 80
 
81
-                if ($schema['view'] !== null) {
81
+                if ($schema['view'] !== null){
82 82
                     $grid = $grid->withView($schema['view']);
83 83
                 }
84 84
 
@@ -98,20 +98,20 @@  discard block
 block discarded – undo
98 98
     private function getSchema(string $controller, string $action): ?array
99 99
     {
100 100
         $key = sprintf('%s:%s', $controller, $action);
101
-        if (array_key_exists($key, $this->cache)) {
101
+        if (array_key_exists($key, $this->cache)){
102 102
             return $this->cache[$key];
103 103
         }
104 104
 
105 105
         $this->cache[$key] = null;
106
-        try {
106
+        try{
107 107
             $method = new \ReflectionMethod($controller, $action);
108
-        } catch (\ReflectionException $e) {
108
+        }catch (\ReflectionException $e){
109 109
             return null;
110 110
         }
111 111
 
112 112
         /** @var null|DataGrid $dataGrid */
113 113
         $dataGrid = $this->reader->firstFunctionMetadata($method, DataGrid::class);
114
-        if ($dataGrid === null) {
114
+        if ($dataGrid === null){
115 115
             return null;
116 116
         }
117 117
 
@@ -132,19 +132,19 @@  discard block
 block discarded – undo
132 132
             'factory'  => $dataGrid->factory,
133 133
         ];
134 134
 
135
-        if (is_string($schema['view'])) {
135
+        if (is_string($schema['view'])){
136 136
             $schema['view'] = $this->container->get($schema['view']);
137 137
         }
138 138
 
139
-        if ($schema['defaults'] === [] && method_exists($schema['grid'], 'getDefaults')) {
139
+        if ($schema['defaults'] === [] && method_exists($schema['grid'], 'getDefaults')){
140 140
             $schema['defaults'] = $schema['grid']->getDefaults();
141 141
         }
142 142
 
143
-        if ($schema['options'] === [] && method_exists($schema['grid'], 'getOptions')) {
143
+        if ($schema['options'] === [] && method_exists($schema['grid'], 'getOptions')){
144 144
             $schema['options'] = $schema['grid']->getOptions();
145 145
         }
146 146
 
147
-        if ($schema['view'] === null && is_callable($schema['grid'])) {
147
+        if ($schema['view'] === null && is_callable($schema['grid'])){
148 148
             $schema['view'] = $schema['grid'];
149 149
         }
150 150
 
@@ -153,9 +153,9 @@  discard block
 block discarded – undo
153 153
 
154 154
     private function makeFactory(array $schema): GridFactoryInterface
155 155
     {
156
-        if (!empty($schema['factory']) && $this->container->has($schema['factory'])) {
156
+        if (!empty($schema['factory']) && $this->container->has($schema['factory'])){
157 157
             $factory = $this->container->get($schema['factory']);
158
-            if ($factory instanceof GridFactoryInterface) {
158
+            if ($factory instanceof GridFactoryInterface){
159 159
                 return $factory;
160 160
             }
161 161
         }
Please login to merge, or discard this patch.
src/Bridge/DataGrid/src/Annotation/DataGrid.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
         array $defaults = [],
71 71
         array $options = [],
72 72
         ?string $factory = null
73
-    ) {
73
+    ){
74 74
         $this->grid = $grid;
75 75
         $this->view = $view;
76 76
         $this->defaults = $defaults;
Please login to merge, or discard this patch.
src/Annotations/src/AnnotationLocator.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function findClasses(string $annotation): iterable
69 69
     {
70
-        foreach ($this->getTargets() as $target) {
70
+        foreach ($this->getTargets() as $target){
71 71
             $found = $this->reader->firstClassMetadata($target, $annotation);
72
-            if ($found !== null) {
72
+            if ($found !== null){
73 73
                 yield new AnnotatedClass($target, $found);
74 74
             }
75 75
         }
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public function findMethods(string $annotation): iterable
85 85
     {
86
-        foreach ($this->getTargets() as $target) {
87
-            foreach ($target->getMethods() as $method) {
86
+        foreach ($this->getTargets() as $target){
87
+            foreach ($target->getMethods() as $method){
88 88
                 $found = $this->reader->firstFunctionMetadata($method, $annotation);
89
-                if ($found !== null) {
89
+                if ($found !== null){
90 90
                     yield new AnnotatedMethod($method, $found);
91 91
                 }
92 92
             }
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
      */
102 102
     public function findProperties(string $annotation): iterable
103 103
     {
104
-        foreach ($this->getTargets() as $target) {
105
-            foreach ($target->getProperties() as $property) {
104
+        foreach ($this->getTargets() as $target){
105
+            foreach ($target->getProperties() as $property){
106 106
                 $found = $this->reader->firstPropertyMetadata($property, $annotation);
107
-                if ($found !== null) {
107
+                if ($found !== null){
108 108
                     yield new AnnotatedProperty($property, $found);
109 109
                 }
110 110
             }
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
      */
117 117
     private function getTargets(): iterable
118 118
     {
119
-        if ($this->targets === []) {
119
+        if ($this->targets === []){
120 120
             yield from $this->classLocator->getClasses();
121 121
             return;
122 122
         }
123 123
 
124
-        foreach ($this->targets as $target) {
124
+        foreach ($this->targets as $target){
125 125
             yield from $this->classLocator->getClasses($target);
126 126
         }
127 127
     }
Please login to merge, or discard this patch.
Braces   +20 added lines, -10 removed lines patch added patch discarded remove patch
@@ -67,9 +67,11 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function findClasses(string $annotation): iterable
69 69
     {
70
-        foreach ($this->getTargets() as $target) {
70
+        foreach ($this->getTargets() as $target)
71
+        {
71 72
             $found = $this->reader->firstClassMetadata($target, $annotation);
72
-            if ($found !== null) {
73
+            if ($found !== null)
74
+            {
73 75
                 yield new AnnotatedClass($target, $found);
74 76
             }
75 77
         }
@@ -83,10 +85,13 @@  discard block
 block discarded – undo
83 85
      */
84 86
     public function findMethods(string $annotation): iterable
85 87
     {
86
-        foreach ($this->getTargets() as $target) {
87
-            foreach ($target->getMethods() as $method) {
88
+        foreach ($this->getTargets() as $target)
89
+        {
90
+            foreach ($target->getMethods() as $method)
91
+            {
88 92
                 $found = $this->reader->firstFunctionMetadata($method, $annotation);
89
-                if ($found !== null) {
93
+                if ($found !== null)
94
+                {
90 95
                     yield new AnnotatedMethod($method, $found);
91 96
                 }
92 97
             }
@@ -101,10 +106,13 @@  discard block
 block discarded – undo
101 106
      */
102 107
     public function findProperties(string $annotation): iterable
103 108
     {
104
-        foreach ($this->getTargets() as $target) {
105
-            foreach ($target->getProperties() as $property) {
109
+        foreach ($this->getTargets() as $target)
110
+        {
111
+            foreach ($target->getProperties() as $property)
112
+            {
106 113
                 $found = $this->reader->firstPropertyMetadata($property, $annotation);
107
-                if ($found !== null) {
114
+                if ($found !== null)
115
+                {
108 116
                     yield new AnnotatedProperty($property, $found);
109 117
                 }
110 118
             }
@@ -116,12 +124,14 @@  discard block
 block discarded – undo
116 124
      */
117 125
     private function getTargets(): iterable
118 126
     {
119
-        if ($this->targets === []) {
127
+        if ($this->targets === [])
128
+        {
120 129
             yield from $this->classLocator->getClasses();
121 130
             return;
122 131
         }
123 132
 
124
-        foreach ($this->targets as $target) {
133
+        foreach ($this->targets as $target)
134
+        {
125 135
             yield from $this->classLocator->getClasses($target);
126 136
         }
127 137
     }
Please login to merge, or discard this patch.
src/Annotations/tests/LocatorTest.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -29,23 +29,23 @@  discard block
 block discarded – undo
29 29
     public function testLocateClasses()
30 30
     {
31 31
         // Annotations.
32
-        $classes = $this->getAnnotationsLocator(__DIR__ . '/Fixtures')->findClasses(ClassAnnotation::class);
32
+        $classes = $this->getAnnotationsLocator(__DIR__.'/Fixtures')->findClasses(ClassAnnotation::class);
33 33
         $classes = iterator_to_array($classes);
34 34
 
35 35
         $this->assertCount(1, $classes);
36 36
 
37
-        foreach ($classes as $class) {
37
+        foreach ($classes as $class){
38 38
             $this->assertSame(TestClass::class, $class->getClass()->getName());
39 39
             $this->assertSame('abc', $class->getAnnotation()->value);
40 40
         }
41 41
 
42 42
         // Attributes.
43
-        $classes = $this->getAttributesLocator(__DIR__ . '/Fixtures')->findClasses(ClassAnnotation::class);
43
+        $classes = $this->getAttributesLocator(__DIR__.'/Fixtures')->findClasses(ClassAnnotation::class);
44 44
         $classes = iterator_to_array($classes);
45 45
 
46 46
         $this->assertCount(1, $classes);
47 47
 
48
-        foreach ($classes as $class) {
48
+        foreach ($classes as $class){
49 49
             $this->assertSame(AttributeTestClass::class, $class->getClass()->getName());
50 50
             $this->assertSame('abc', $class->getAnnotation()->value);
51 51
         }
@@ -54,24 +54,24 @@  discard block
 block discarded – undo
54 54
     public function testLocateProperties()
55 55
     {
56 56
         // Annotations.
57
-        $props = $this->getAnnotationsLocator(__DIR__ . '/Fixtures')->findProperties(PropertyAnnotation::class);
57
+        $props = $this->getAnnotationsLocator(__DIR__.'/Fixtures')->findProperties(PropertyAnnotation::class);
58 58
         $props = iterator_to_array($props);
59 59
 
60 60
         $this->assertCount(1, $props);
61 61
 
62
-        foreach ($props as $prop) {
62
+        foreach ($props as $prop){
63 63
             $this->assertSame(TestClass::class, $prop->getClass()->getName());
64 64
             $this->assertSame('name', $prop->getProperty()->getName());
65 65
             $this->assertSame('123', $prop->getAnnotation()->id);
66 66
         }
67 67
 
68 68
         // Attributes.
69
-        $props = $this->getAttributesLocator(__DIR__ . '/Fixtures')->findProperties(PropertyAnnotation::class);
69
+        $props = $this->getAttributesLocator(__DIR__.'/Fixtures')->findProperties(PropertyAnnotation::class);
70 70
         $props = iterator_to_array($props);
71 71
 
72 72
         $this->assertCount(1, $props);
73 73
 
74
-        foreach ($props as $prop) {
74
+        foreach ($props as $prop){
75 75
             $this->assertSame(AttributeTestClass::class, $prop->getClass()->getName());
76 76
             $this->assertSame('name', $prop->getProperty()->getName());
77 77
             $this->assertSame('123', $prop->getAnnotation()->id);
@@ -81,24 +81,24 @@  discard block
 block discarded – undo
81 81
     public function testLocateMethods()
82 82
     {
83 83
         // Annotations.
84
-        $methods = $this->getAnnotationsLocator(__DIR__ . '/Fixtures')->findMethods(MethodAnnotation::class);
84
+        $methods = $this->getAnnotationsLocator(__DIR__.'/Fixtures')->findMethods(MethodAnnotation::class);
85 85
         $methods = iterator_to_array($methods);
86 86
 
87 87
         $this->assertCount(1, $methods);
88 88
 
89
-        foreach ($methods as $m) {
89
+        foreach ($methods as $m){
90 90
             $this->assertSame(TestClass::class, $m->getClass()->getName());
91 91
             $this->assertSame('testMethod', $m->getMethod()->getName());
92 92
             $this->assertSame('/', $m->getAnnotation()->path);
93 93
         }
94 94
 
95 95
         // Attributes.
96
-        $methods = $this->getAttributesLocator(__DIR__ . '/Fixtures')->findMethods(MethodAnnotation::class);
96
+        $methods = $this->getAttributesLocator(__DIR__.'/Fixtures')->findMethods(MethodAnnotation::class);
97 97
         $methods = iterator_to_array($methods);
98 98
 
99 99
         $this->assertCount(1, $methods);
100 100
 
101
-        foreach ($methods as $m) {
101
+        foreach ($methods as $m){
102 102
             $this->assertSame(AttributeTestClass::class, $m->getClass()->getName());
103 103
             $this->assertSame('testMethod', $m->getMethod()->getName());
104 104
             $this->assertSame('/', $m->getAnnotation()->path);
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,7 +34,8 @@  discard block
 block discarded – undo
34 34
 
35 35
         $this->assertCount(1, $classes);
36 36
 
37
-        foreach ($classes as $class) {
37
+        foreach ($classes as $class)
38
+        {
38 39
             $this->assertSame(TestClass::class, $class->getClass()->getName());
39 40
             $this->assertSame('abc', $class->getAnnotation()->value);
40 41
         }
@@ -45,7 +46,8 @@  discard block
 block discarded – undo
45 46
 
46 47
         $this->assertCount(1, $classes);
47 48
 
48
-        foreach ($classes as $class) {
49
+        foreach ($classes as $class)
50
+        {
49 51
             $this->assertSame(AttributeTestClass::class, $class->getClass()->getName());
50 52
             $this->assertSame('abc', $class->getAnnotation()->value);
51 53
         }
@@ -59,7 +61,8 @@  discard block
 block discarded – undo
59 61
 
60 62
         $this->assertCount(1, $props);
61 63
 
62
-        foreach ($props as $prop) {
64
+        foreach ($props as $prop)
65
+        {
63 66
             $this->assertSame(TestClass::class, $prop->getClass()->getName());
64 67
             $this->assertSame('name', $prop->getProperty()->getName());
65 68
             $this->assertSame('123', $prop->getAnnotation()->id);
@@ -71,7 +74,8 @@  discard block
 block discarded – undo
71 74
 
72 75
         $this->assertCount(1, $props);
73 76
 
74
-        foreach ($props as $prop) {
77
+        foreach ($props as $prop)
78
+        {
75 79
             $this->assertSame(AttributeTestClass::class, $prop->getClass()->getName());
76 80
             $this->assertSame('name', $prop->getProperty()->getName());
77 81
             $this->assertSame('123', $prop->getAnnotation()->id);
@@ -86,7 +90,8 @@  discard block
 block discarded – undo
86 90
 
87 91
         $this->assertCount(1, $methods);
88 92
 
89
-        foreach ($methods as $m) {
93
+        foreach ($methods as $m)
94
+        {
90 95
             $this->assertSame(TestClass::class, $m->getClass()->getName());
91 96
             $this->assertSame('testMethod', $m->getMethod()->getName());
92 97
             $this->assertSame('/', $m->getAnnotation()->path);
@@ -98,7 +103,8 @@  discard block
 block discarded – undo
98 103
 
99 104
         $this->assertCount(1, $methods);
100 105
 
101
-        foreach ($methods as $m) {
106
+        foreach ($methods as $m)
107
+        {
102 108
             $this->assertSame(AttributeTestClass::class, $m->getClass()->getName());
103 109
             $this->assertSame('testMethod', $m->getMethod()->getName());
104 110
             $this->assertSame('/', $m->getAnnotation()->path);
Please login to merge, or discard this patch.
tests/app/src/Controller/DemoController.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,10 +49,12 @@
 block discarded – undo
49 49
      * @Guarded("do")
50 50
      * @return string
51 51
      */
52
-    public function do()
52
+    public function do{
53
+        ()
53 54
     {
54 55
         return 'ok';
55 56
     }
57
+    }
56 58
 
57 59
     /**
58 60
      * @return string
Please login to merge, or discard this patch.
src/Validation/src/Checker/ArrayChecker.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,12 +29,12 @@  discard block
 block discarded – undo
29 29
 
30 30
     public function of($value, $checker): bool
31 31
     {
32
-        if (!is_array($value) || empty($value)) {
32
+        if (!is_array($value) || empty($value)){
33 33
             return false;
34 34
         }
35 35
 
36
-        foreach ($value as $item) {
37
-            if (!$this->validation->validate(compact('item'), ['item' => [$checker]])->isValid()) {
36
+        foreach ($value as $item){
37
+            if (!$this->validation->validate(compact('item'), ['item' => [$checker]])->isValid()){
38 38
                 return false;
39 39
             }
40 40
         }
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
     public function count($value, int $length): bool
46 46
     {
47
-        if (!is_array($value) && !$value instanceof \Countable) {
47
+        if (!is_array($value) && !$value instanceof \Countable){
48 48
             return false;
49 49
         }
50 50
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
     public function shorter($value, int $length): bool
55 55
     {
56
-        if (!is_array($value) && !$value instanceof \Countable) {
56
+        if (!is_array($value) && !$value instanceof \Countable){
57 57
             return false;
58 58
         }
59 59
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
     public function longer($value, int $length): bool
64 64
     {
65
-        if (!is_array($value) && !$value instanceof \Countable) {
65
+        if (!is_array($value) && !$value instanceof \Countable){
66 66
             return false;
67 67
         }
68 68
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
     public function range($value, int $min, int $max): bool
73 73
     {
74
-        if (!is_array($value) && !$value instanceof \Countable) {
74
+        if (!is_array($value) && !$value instanceof \Countable){
75 75
             return false;
76 76
         }
77 77
 
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,12 +29,15 @@  discard block
 block discarded – undo
29 29
 
30 30
     public function of($value, $checker): bool
31 31
     {
32
-        if (!is_array($value) || empty($value)) {
32
+        if (!is_array($value) || empty($value))
33
+        {
33 34
             return false;
34 35
         }
35 36
 
36
-        foreach ($value as $item) {
37
-            if (!$this->validation->validate(compact('item'), ['item' => [$checker]])->isValid()) {
37
+        foreach ($value as $item)
38
+        {
39
+            if (!$this->validation->validate(compact('item'), ['item' => [$checker]])->isValid())
40
+            {
38 41
                 return false;
39 42
             }
40 43
         }
@@ -44,7 +47,8 @@  discard block
 block discarded – undo
44 47
 
45 48
     public function count($value, int $length): bool
46 49
     {
47
-        if (!is_array($value) && !$value instanceof \Countable) {
50
+        if (!is_array($value) && !$value instanceof \Countable)
51
+        {
48 52
             return false;
49 53
         }
50 54
 
@@ -53,7 +57,8 @@  discard block
 block discarded – undo
53 57
 
54 58
     public function shorter($value, int $length): bool
55 59
     {
56
-        if (!is_array($value) && !$value instanceof \Countable) {
60
+        if (!is_array($value) && !$value instanceof \Countable)
61
+        {
57 62
             return false;
58 63
         }
59 64
 
@@ -62,7 +67,8 @@  discard block
 block discarded – undo
62 67
 
63 68
     public function longer($value, int $length): bool
64 69
     {
65
-        if (!is_array($value) && !$value instanceof \Countable) {
70
+        if (!is_array($value) && !$value instanceof \Countable)
71
+        {
66 72
             return false;
67 73
         }
68 74
 
@@ -71,7 +77,8 @@  discard block
 block discarded – undo
71 77
 
72 78
     public function range($value, int $min, int $max): bool
73 79
     {
74
-        if (!is_array($value) && !$value instanceof \Countable) {
80
+        if (!is_array($value) && !$value instanceof \Countable)
81
+        {
75 82
             return false;
76 83
         }
77 84
 
Please login to merge, or discard this patch.
src/Validation/tests/Checkers/ArrayTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 block discarded – undo
79 79
 
80 80
     private function createCountable(int $count): \Countable
81 81
     {
82
-        return new class($count) implements \Countable {
82
+        return new class($count) implements \Countable{
83 83
             private $count;
84 84
 
85 85
             public function __construct(int $count)
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,8 @@
 block discarded – undo
79 79
 
80 80
     private function createCountable(int $count): \Countable
81 81
     {
82
-        return new class($count) implements \Countable {
82
+        return new class($count) implements \Countable
83
+        {
83 84
             private $count;
84 85
 
85 86
             public function __construct(int $count)
Please login to merge, or discard this patch.
src/Config/src/Loader/DirectoryLoader.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function has(string $section): bool
39 39
     {
40
-        foreach ($this->loaderExtensions() as $extension) {
40
+        foreach ($this->loaderExtensions() as $extension){
41 41
             $filename = sprintf('%s/%s.%s', $this->directory, $section, $extension);
42
-            if (file_exists($filename)) {
42
+            if (file_exists($filename)){
43 43
                 return true;
44 44
             }
45 45
         }
@@ -52,15 +52,15 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function load(string $section): array
54 54
     {
55
-        foreach ($this->loaderExtensions() as $extension) {
55
+        foreach ($this->loaderExtensions() as $extension){
56 56
             $filename = sprintf('%s/%s.%s', $this->directory, $section, $extension);
57
-            if (!file_exists($filename)) {
57
+            if (!file_exists($filename)){
58 58
                 continue;
59 59
             }
60 60
 
61
-            try {
61
+            try{
62 62
                 return $this->getLoader($extension)->loadFile($section, $filename);
63
-            } catch (LoaderException $e) {
63
+            }catch (LoaderException $e){
64 64
                 throw new LoaderException("Unable to load config `{$section}`: {$e->getMessage()}", $e->getCode(), $e);
65 65
             }
66 66
         }
Please login to merge, or discard this patch.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,9 +37,11 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function has(string $section): bool
39 39
     {
40
-        foreach ($this->loaderExtensions() as $extension) {
40
+        foreach ($this->loaderExtensions() as $extension)
41
+        {
41 42
             $filename = sprintf('%s/%s.%s', $this->directory, $section, $extension);
42
-            if (file_exists($filename)) {
43
+            if (file_exists($filename))
44
+            {
43 45
                 return true;
44 46
             }
45 47
         }
@@ -52,15 +54,20 @@  discard block
 block discarded – undo
52 54
      */
53 55
     public function load(string $section): array
54 56
     {
55
-        foreach ($this->loaderExtensions() as $extension) {
57
+        foreach ($this->loaderExtensions() as $extension)
58
+        {
56 59
             $filename = sprintf('%s/%s.%s', $this->directory, $section, $extension);
57
-            if (!file_exists($filename)) {
60
+            if (!file_exists($filename))
61
+            {
58 62
                 continue;
59 63
             }
60 64
 
61
-            try {
65
+            try
66
+            {
62 67
                 return $this->getLoader($extension)->loadFile($section, $filename);
63
-            } catch (LoaderException $e) {
68
+            }
69
+            catch (LoaderException $e)
70
+            {
64 71
                 throw new LoaderException("Unable to load config `{$section}`: {$e->getMessage()}", $e->getCode(), $e);
65 72
             }
66 73
         }
Please login to merge, or discard this patch.
src/Filters/src/SchemaBuilder.php 3 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -70,18 +70,18 @@  discard block
 block discarded – undo
70 70
     protected function buildMap(ReflectionEntity $filter): array
71 71
     {
72 72
         $schema = $filter->getProperty('schema', true);
73
-        if (empty($schema)) {
73
+        if (empty($schema)){
74 74
             throw new SchemaException("Filter `{$filter->getName()}` does not define any schema");
75 75
         }
76 76
 
77 77
         $result = [];
78
-        foreach ($schema as $field => $definition) {
78
+        foreach ($schema as $field => $definition){
79 79
             $optional = false;
80 80
 
81 81
             // short definition
82
-            if (is_string($definition)) {
82
+            if (is_string($definition)){
83 83
                 // simple scalar field definition
84
-                if (!class_exists($definition)) {
84
+                if (!class_exists($definition)){
85 85
                     [$source, $origin] = $this->parseDefinition($field, $definition);
86 86
                     $result[$field] = [
87 87
                         FilterProvider::SOURCE => $source,
@@ -102,25 +102,25 @@  discard block
 block discarded – undo
102 102
                 continue;
103 103
             }
104 104
 
105
-            if (!is_array($definition) || count($definition) === 0) {
105
+            if (!is_array($definition) || count($definition) === 0){
106 106
                 throw new SchemaException(
107 107
                     "Invalid schema definition at `{$filter->getName()}`->`{$field}`"
108 108
                 );
109 109
             }
110 110
 
111 111
             // complex definition
112
-            if (!empty($definition[self::ORIGIN])) {
112
+            if (!empty($definition[self::ORIGIN])){
113 113
                 $origin = $definition[self::ORIGIN];
114 114
 
115 115
                 // [class, 'data:something.*'] vs [class, 'data:something']
116 116
                 $iterate = strpos($origin, '.*') !== false || !empty($definition[self::ITERATE]);
117 117
                 $origin = rtrim($origin, '.*');
118
-            } else {
118
+            }else{
119 119
                 $origin = $field;
120 120
                 $iterate = true;
121 121
             }
122 122
 
123
-            if (!empty($definition[self::OPTIONAL]) && $definition[self::OPTIONAL]) {
123
+            if (!empty($definition[self::OPTIONAL]) && $definition[self::OPTIONAL]){
124 124
                 $optional = true;
125 125
             }
126 126
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
                 FilterProvider::OPTIONAL => $optional,
134 134
             ];
135 135
 
136
-            if ($iterate) {
136
+            if ($iterate){
137 137
                 [$source, $origin] = $this->parseDefinition($field, $definition[self::ITERATE] ?? $origin);
138 138
 
139 139
                 $map[FilterProvider::ITERATE_SOURCE] = $source;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      */
160 160
     private function parseDefinition(string $field, string $definition): array
161 161
     {
162
-        if (strpos($definition, ':') === false) {
162
+        if (strpos($definition, ':') === false){
163 163
             return ['data', $definition ?? $field];
164 164
         }
165 165
 
Please login to merge, or discard this patch.
Braces   +21 added lines, -10 removed lines patch added patch discarded remove patch
@@ -70,18 +70,22 @@  discard block
 block discarded – undo
70 70
     protected function buildMap(ReflectionEntity $filter): array
71 71
     {
72 72
         $schema = $filter->getProperty('schema', true);
73
-        if (empty($schema)) {
73
+        if (empty($schema))
74
+        {
74 75
             throw new SchemaException("Filter `{$filter->getName()}` does not define any schema");
75 76
         }
76 77
 
77 78
         $result = [];
78
-        foreach ($schema as $field => $definition) {
79
+        foreach ($schema as $field => $definition)
80
+        {
79 81
             $optional = false;
80 82
 
81 83
             // short definition
82
-            if (is_string($definition)) {
84
+            if (is_string($definition))
85
+            {
83 86
                 // simple scalar field definition
84
-                if (!class_exists($definition)) {
87
+                if (!class_exists($definition))
88
+                {
85 89
                     [$source, $origin] = $this->parseDefinition($field, $definition);
86 90
                     $result[$field] = [
87 91
                         FilterProvider::SOURCE => $source,
@@ -102,25 +106,30 @@  discard block
 block discarded – undo
102 106
                 continue;
103 107
             }
104 108
 
105
-            if (!is_array($definition) || count($definition) === 0) {
109
+            if (!is_array($definition) || count($definition) === 0)
110
+            {
106 111
                 throw new SchemaException(
107 112
                     "Invalid schema definition at `{$filter->getName()}`->`{$field}`"
108 113
                 );
109 114
             }
110 115
 
111 116
             // complex definition
112
-            if (!empty($definition[self::ORIGIN])) {
117
+            if (!empty($definition[self::ORIGIN]))
118
+            {
113 119
                 $origin = $definition[self::ORIGIN];
114 120
 
115 121
                 // [class, 'data:something.*'] vs [class, 'data:something']
116 122
                 $iterate = strpos($origin, '.*') !== false || !empty($definition[self::ITERATE]);
117 123
                 $origin = rtrim($origin, '.*');
118
-            } else {
124
+            }
125
+            else
126
+            {
119 127
                 $origin = $field;
120 128
                 $iterate = true;
121 129
             }
122 130
 
123
-            if (!empty($definition[self::OPTIONAL]) && $definition[self::OPTIONAL]) {
131
+            if (!empty($definition[self::OPTIONAL]) && $definition[self::OPTIONAL])
132
+            {
124 133
                 $optional = true;
125 134
             }
126 135
 
@@ -133,7 +142,8 @@  discard block
 block discarded – undo
133 142
                 FilterProvider::OPTIONAL => $optional,
134 143
             ];
135 144
 
136
-            if ($iterate) {
145
+            if ($iterate)
146
+            {
137 147
                 [$source, $origin] = $this->parseDefinition($field, $definition[self::ITERATE] ?? $origin);
138 148
 
139 149
                 $map[FilterProvider::ITERATE_SOURCE] = $source;
@@ -159,7 +169,8 @@  discard block
 block discarded – undo
159 169
      */
160 170
     private function parseDefinition(string $field, string $definition): array
161 171
     {
162
-        if (strpos($definition, ':') === false) {
172
+        if (strpos($definition, ':') === false)
173
+        {
163 174
             return ['data', $definition ?? $field];
164 175
         }
165 176
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                     FilterProvider::SOURCE   => null,
96 96
                     FilterProvider::ORIGIN   => $field,
97 97
                     FilterProvider::FILTER   => $definition,
98
-                    FilterProvider::ARRAY    => false,
98
+                    FilterProvider::array    => false,
99 99
                     FilterProvider::OPTIONAL => $optional,
100 100
                 ];
101 101
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
                 FilterProvider::FILTER   => $definition[self::NESTED],
130 130
                 FilterProvider::SOURCE   => null,
131 131
                 FilterProvider::ORIGIN   => $origin,
132
-                FilterProvider::ARRAY    => $iterate,
132
+                FilterProvider::array    => $iterate,
133 133
                 FilterProvider::OPTIONAL => $optional,
134 134
             ];
135 135
 
Please login to merge, or discard this patch.