Passed
Pull Request — master (#1131)
by Abdul Malik
15:23 queued 04:16
created
rector.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -16,43 +16,43 @@
 block discarded – undo
16 16
 
17 17
 return RectorConfig::configure()
18 18
     ->withPaths([
19
-        __DIR__ . '/src/*/src',
19
+        __DIR__.'/src/*/src',
20 20
     ])
21 21
     ->withParallel()
22 22
     ->withSkip([
23 23
         IfIssetToCoalescingRector::class,
24 24
         RemoveUnusedPrivatePropertyRector::class => [
25
-            __DIR__ . '/src/Scaffolder/src/Command/BootloaderCommand.php',
26
-            __DIR__ . '/src/Scaffolder/src/Command/CommandCommand.php',
27
-            __DIR__ . '/src/Scaffolder/src/Command/ConfigCommand.php',
28
-            __DIR__ . '/src/Scaffolder/src/Command/ControllerCommand.php',
29
-            __DIR__ . '/src/Scaffolder/src/Command/FilterCommand.php',
30
-            __DIR__ . '/src/Scaffolder/src/Command/JobHandlerCommand.php',
31
-            __DIR__ . '/src/Scaffolder/src/Command/MiddlewareCommand.php',
25
+            __DIR__.'/src/Scaffolder/src/Command/BootloaderCommand.php',
26
+            __DIR__.'/src/Scaffolder/src/Command/CommandCommand.php',
27
+            __DIR__.'/src/Scaffolder/src/Command/ConfigCommand.php',
28
+            __DIR__.'/src/Scaffolder/src/Command/ControllerCommand.php',
29
+            __DIR__.'/src/Scaffolder/src/Command/FilterCommand.php',
30
+            __DIR__.'/src/Scaffolder/src/Command/JobHandlerCommand.php',
31
+            __DIR__.'/src/Scaffolder/src/Command/MiddlewareCommand.php',
32 32
         ],
33 33
         RemoveUnusedPrivateMethodRector::class => [
34
-            __DIR__ . '/src/Boot/src/Bootloader/ConfigurationBootloader.php',
35
-            __DIR__ . '/src/Broadcasting/src/Bootloader/BroadcastingBootloader.php',
36
-            __DIR__ . '/src/Cache/src/Bootloader/CacheBootloader.php',
37
-            __DIR__ . '/src/Serializer/src/Bootloader/SerializerBootloader.php',
38
-            __DIR__ . '/src/Validation/src/Bootloader/ValidationBootloader.php',
34
+            __DIR__.'/src/Boot/src/Bootloader/ConfigurationBootloader.php',
35
+            __DIR__.'/src/Broadcasting/src/Bootloader/BroadcastingBootloader.php',
36
+            __DIR__.'/src/Cache/src/Bootloader/CacheBootloader.php',
37
+            __DIR__.'/src/Serializer/src/Bootloader/SerializerBootloader.php',
38
+            __DIR__.'/src/Validation/src/Bootloader/ValidationBootloader.php',
39 39
         ],
40 40
         RemoveUselessVarTagRector::class => [
41
-            __DIR__ . '/src/Console/src/Traits/HelpersTrait.php',
41
+            __DIR__.'/src/Console/src/Traits/HelpersTrait.php',
42 42
         ],
43 43
         RemoveAlwaysTrueIfConditionRector::class => [
44
-            __DIR__ . '/src/Boot/src/BootloadManager/Initializer.php',
45
-            __DIR__ . '/src/Stempler/src/Traverser.php',
46
-            __DIR__ . '/src/Prototype/src/NodeVisitors/LocateProperties.php',
47
-            __DIR__ . '/src/Prototype/src/NodeVisitors/RemoveTrait.php',
48
-            __DIR__ . '/src/Logger/src/ListenerRegistry.php',
49
-            __DIR__ . '/src/Stempler/src/Transform/Merge/ExtendsParent.php',
44
+            __DIR__.'/src/Boot/src/BootloadManager/Initializer.php',
45
+            __DIR__.'/src/Stempler/src/Traverser.php',
46
+            __DIR__.'/src/Prototype/src/NodeVisitors/LocateProperties.php',
47
+            __DIR__.'/src/Prototype/src/NodeVisitors/RemoveTrait.php',
48
+            __DIR__.'/src/Logger/src/ListenerRegistry.php',
49
+            __DIR__.'/src/Stempler/src/Transform/Merge/ExtendsParent.php',
50 50
         ],
51 51
         RemoveExtraParametersRector::class => [
52
-            __DIR__ . '/src/Boot/src/BootloadManager/AbstractBootloadManager.php',
52
+            __DIR__.'/src/Boot/src/BootloadManager/AbstractBootloadManager.php',
53 53
         ],
54 54
         RemoveUnusedPrivateMethodParameterRector::class => [
55
-            __DIR__ . '/src/Core/src/Internal/Factory.php',
55
+            __DIR__.'/src/Core/src/Internal/Factory.php',
56 56
         ],
57 57
 
58 58
         // to be enabled later after upgrade to 1.2.4 merged
Please login to merge, or discard this patch.
src/Streams/src/StreamWrapper.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function stream_eof(): bool
45 45
     {
46
-        if ($this->stream === null) {
46
+        if ($this->stream === null){
47 47
             throw new WrapperException('Stream is not opened.');
48 48
         }
49 49
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function stream_open(string $path, string $mode): bool
57 57
     {
58
-        if (!isset(self::$uris[$path])) {
58
+        if (!isset(self::$uris[$path])){
59 59
             return false;
60 60
         }
61 61
 
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
     /**
71 71
      * Read data from StreamInterface.
72 72
      */
73
-    public function stream_read(int $length): string|false
73
+    public function stream_read(int $length): string | false
74 74
     {
75
-        if ($this->stream === null) {
75
+        if ($this->stream === null){
76 76
             throw new WrapperException('Stream is not opened.');
77 77
         }
78 78
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function stream_seek(int $offset, int $whence = SEEK_SET): bool
86 86
     {
87
-        if ($this->stream === null) {
87
+        if ($this->stream === null){
88 88
             throw new WrapperException('Stream is not opened.');
89 89
         }
90 90
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public function stream_stat(): array
104 104
     {
105
-        if ($this->stream === null) {
105
+        if ($this->stream === null){
106 106
             throw new WrapperException('Stream is not opened.');
107 107
         }
108 108
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      */
115 115
     public function stream_tell(): int
116 116
     {
117
-        if ($this->stream === null) {
117
+        if ($this->stream === null){
118 118
             throw new WrapperException('Stream is not opened.');
119 119
         }
120 120
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public function stream_write(string $data): int
130 130
     {
131
-        if ($this->stream === null) {
131
+        if ($this->stream === null){
132 132
             throw new WrapperException('Stream is not opened.');
133 133
         }
134 134
 
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
      *
141 141
      * @see stat()
142 142
      */
143
-    public function url_stat(string $path, int $flag): array|false
143
+    public function url_stat(string $path, int $flag): array | false
144 144
     {
145
-        try {
146
-            if (isset(self::$uris[$path])) {
145
+        try{
146
+            if (isset(self::$uris[$path])){
147 147
                 return $this->getStreamStats(self::$uris[$path]);
148 148
             }
149
-        } catch (\Throwable $e) {
150
-            if (($flag & \STREAM_URL_STAT_QUIET) === \STREAM_URL_STAT_QUIET) {
149
+        }catch (\Throwable $e){
150
+            if (($flag & \STREAM_URL_STAT_QUIET) === \STREAM_URL_STAT_QUIET){
151 151
                 return false;
152 152
             }
153 153
             \trigger_error($e->getMessage(), \E_USER_ERROR);
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      */
162 162
     public static function register(): void
163 163
     {
164
-        if (self::$registered) {
164
+        if (self::$registered){
165 165
             return;
166 166
         }
167 167
 
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
     /**
174 174
      * Check if given uri or stream has been allocated.
175 175
      */
176
-    public static function has(StreamInterface|string $file): bool
176
+    public static function has(StreamInterface | string $file): bool
177 177
     {
178
-        if ($file instanceof StreamInterface) {
179
-            $file = 'spiral://' . \spl_object_hash($file);
178
+        if ($file instanceof StreamInterface){
179
+            $file = 'spiral://'.\spl_object_hash($file);
180 180
         }
181 181
 
182 182
         return isset(self::$uris[$file]);
@@ -191,15 +191,15 @@  discard block
 block discarded – undo
191 191
     public static function getResource(StreamInterface $stream)
192 192
     {
193 193
         $mode = null;
194
-        if ($stream->isReadable()) {
194
+        if ($stream->isReadable()){
195 195
             $mode = 'r';
196 196
         }
197 197
 
198
-        if ($stream->isWritable()) {
198
+        if ($stream->isWritable()){
199 199
             $mode = !empty($mode) ? 'r+' : 'w';
200 200
         }
201 201
 
202
-        if (empty($mode)) {
202
+        if (empty($mode)){
203 203
             throw new WrapperException('Stream is not available in read or write modes');
204 204
         }
205 205
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
     {
214 214
         self::register();
215 215
 
216
-        $uri = 'spiral://' . \spl_object_hash($stream);
216
+        $uri = 'spiral://'.\spl_object_hash($stream);
217 217
         self::$uris[$uri] = $stream;
218 218
 
219 219
         return $uri;
@@ -225,10 +225,10 @@  discard block
 block discarded – undo
225 225
      *
226 226
      * @param string|StreamInterface $file String uri or StreamInterface.
227 227
      */
228
-    public static function release(StreamInterface|string $file): void
228
+    public static function release(StreamInterface | string $file): void
229 229
     {
230
-        if ($file instanceof StreamInterface) {
231
-            $file = 'spiral://' . \spl_object_hash($file);
230
+        if ($file instanceof StreamInterface){
231
+            $file = 'spiral://'.\spl_object_hash($file);
232 232
         }
233 233
 
234 234
         unset(self::$uris[$file]);
@@ -240,12 +240,12 @@  discard block
 block discarded – undo
240 240
     private function getStreamStats(StreamInterface $stream): array
241 241
     {
242 242
         $mode = $this->mode;
243
-        if (empty($mode)) {
244
-            if ($stream->isReadable()) {
243
+        if (empty($mode)){
244
+            if ($stream->isReadable()){
245 245
                 $mode = 'r';
246 246
             }
247 247
 
248
-            if ($stream->isWritable()) {
248
+            if ($stream->isWritable()){
249 249
                 $mode = !empty($mode) ? 'r+' : 'w';
250 250
             }
251 251
         }
Please login to merge, or discard this patch.
src/Filters/src/Model/Schema/AttributeMapper.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         private readonly FilterProviderInterface $provider,
27 27
         private readonly ReaderInterface $reader,
28 28
         private readonly Mapper $mapper
29
-    ) {
29
+    ){
30 30
     }
31 31
 
32 32
     /**
@@ -40,54 +40,54 @@  discard block
 block discarded – undo
40 40
         $optionalFilters = [];
41 41
         $class = new \ReflectionClass($filter);
42 42
 
43
-        foreach ($class->getProperties() as $property) {
43
+        foreach ($class->getProperties() as $property){
44 44
             /** @var object $attribute */
45
-            foreach ($this->reader->getPropertyMetadata($property) as $attribute) {
46
-                if ($attribute instanceof AbstractInput) {
45
+            foreach ($this->reader->getPropertyMetadata($property) as $attribute){
46
+                if ($attribute instanceof AbstractInput){
47 47
                     $value = $attribute->getValue($input, $property);
48
-                    try {
48
+                    try{
49 49
                         $this->setValue($filter, $property, $value);
50
-                    } catch (SetterException $e) {
50
+                    }catch (SetterException $e){
51 51
                         $errors[$property->getName()] = $this->createErrorMessage($e, $property, $value);
52 52
                     }
53 53
                     $schema[$property->getName()] = $attribute->getSchema($property);
54
-                } elseif ($attribute instanceof NestedFilter) {
54
+                } elseif ($attribute instanceof NestedFilter){
55 55
                     $prefix = $attribute->prefix ?? $property->name;
56
-                    try {
56
+                    try{
57 57
                         $value = $this->provider->createFilter(
58 58
                             $attribute->class,
59 59
                             $input->withPrefix($prefix)
60 60
                         );
61 61
 
62
-                        try {
62
+                        try{
63 63
                             $this->setValue($filter, $property, $value);
64
-                        } catch (SetterException $e) {
64
+                        }catch (SetterException $e){
65 65
                             $errors[$property->getName()] = $this->createErrorMessage($e, $property, $value);
66 66
                         }
67
-                    } catch (ValidationException $e) {
68
-                        if ($this->allowsNull($property)) {
67
+                    }catch (ValidationException $e){
68
+                        if ($this->allowsNull($property)){
69 69
                             $this->setValue($filter, $property, null);
70 70
                             $optionalFilters[] = $property->getName();
71
-                        } else {
71
+                        }else{
72 72
                             $errors[$prefix] = $e->errors;
73 73
                         }
74 74
                     }
75 75
 
76 76
                     $schema[$property->getName()] = $attribute->getSchema();
77
-                } elseif ($attribute instanceof NestedArray) {
77
+                } elseif ($attribute instanceof NestedArray){
78 78
                     $values = $attribute->getValue($input, $property);
79 79
                     $propertyValues = [];
80 80
 
81 81
                     $prefix = $attribute->input->key ?? $attribute->prefix ?? $property->getName();
82 82
 
83
-                    if (\is_array($values)) {
84
-                        foreach (\array_keys($values) as $key) {
85
-                            try {
83
+                    if (\is_array($values)){
84
+                        foreach (\array_keys($values) as $key){
85
+                            try{
86 86
                                 $propertyValues[$key] = $this->provider->createFilter(
87 87
                                     $attribute->class,
88
-                                    $input->withPrefix($prefix . '.' . $key)
88
+                                    $input->withPrefix($prefix.'.'.$key)
89 89
                                 );
90
-                            } catch (ValidationException $e) {
90
+                            }catch (ValidationException $e){
91 91
                                 /** @psalm-suppress InvalidArrayOffset */
92 92
                                 $errors[$property->getName()][$key] = $e->errors;
93 93
                             }
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
                     }
96 96
 
97 97
                     $this->setValue($filter, $property, $propertyValues);
98
-                    $schema[$property->getName()] = [$attribute->class, $prefix . '.*'];
99
-                } elseif ($attribute instanceof Setter) {
98
+                    $schema[$property->getName()] = [$attribute->class, $prefix.'.*'];
99
+                } elseif ($attribute instanceof Setter){
100 100
                     $setters[$property->getName()][] = $attribute;
101 101
                 }
102 102
             }
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
 
108 108
     private function setValue(FilterInterface $filter, \ReflectionProperty $property, mixed $value): void
109 109
     {
110
-        if ($value === null) {
110
+        if ($value === null){
111 111
             return;
112 112
         }
113 113
 
114 114
         $setters = $this->reader->getPropertyMetadata($property, Setter::class);
115 115
 
116
-        foreach ($setters as $setter) {
116
+        foreach ($setters as $setter){
117 117
             $value = $setter->updateValue($value);
118 118
         }
119 119
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     ): string {
135 135
         $attribute = $this->reader->firstPropertyMetadata($property, CastingErrorMessage::class);
136 136
 
137
-        if ($attribute === null) {
137
+        if ($attribute === null){
138 138
             return $exception->getMessage();
139 139
         }
140 140
 
Please login to merge, or discard this patch.
src/Filters/src/Attribute/NestedFilter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,12 +29,12 @@
 block discarded – undo
29 29
     public function __construct(
30 30
         public readonly string $class,
31 31
         public readonly ?string $prefix = null
32
-    ) {
32
+    ){
33 33
     }
34 34
 
35
-    public function getSchema(): string|array
35
+    public function getSchema(): string | array
36 36
     {
37
-        if ($this->prefix) {
37
+        if ($this->prefix){
38 38
             return [$this->class, $this->prefix];
39 39
         }
40 40
 
Please login to merge, or discard this patch.
src/Filters/src/Attribute/NestedArray.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         public readonly string $class,
37 37
         public readonly AbstractInput $input,
38 38
         public readonly ?string $prefix = null
39
-    ) {
39
+    ){
40 40
     }
41 41
 
42 42
     public function getValue(InputInterface $input, \ReflectionProperty $property): mixed
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
     public function getSchema(): array
48 48
     {
49
-        if ($this->prefix) {
49
+        if ($this->prefix){
50 50
             return [$this->class, $this->prefix];
51 51
         }
52 52
 
Please login to merge, or discard this patch.