Passed
Pull Request — master (#977)
by Maxim
10:13
created
src/Storage/src/Config/StorageConfig.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 
78 78
     private function bootStorages(array $config): void
79 79
     {
80
-        foreach ($config['buckets'] as $name => $bucket) {
81
-            if (!\is_string($name)) {
80
+        foreach ($config['buckets'] as $name => $bucket){
81
+            if (!\is_string($name)){
82 82
                 throw new InvalidArgumentException(
83 83
                     \vsprintf('Storage bucket config key must be a string, but %s defined', [
84 84
                         \get_debug_type($name),
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
             }
88 88
 
89 89
             $serverName = $bucket['server'] ?? null;
90
-            if (!\is_string($serverName)) {
90
+            if (!\is_string($serverName)){
91 91
                 throw new InvalidArgumentException(
92 92
                     \vsprintf('Storage bucket `%s.server` config key required and must be a string, but %s defined', [
93 93
                         $name,
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             }
98 98
 
99 99
             $server = $config['servers'][$serverName] ?? null;
100
-            if (!\is_array($server)) {
100
+            if (!\is_array($server)){
101 101
                 throw new InvalidArgumentException(
102 102
                     \vsprintf('Storage bucket `%s` relates to non-existing server `%s`', [
103 103
                         $name,
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
             }
108 108
 
109 109
             $adapter = $server['adapter'] ?? null;
110
-            if (!\is_string($adapter)) {
110
+            if (!\is_string($adapter)){
111 111
                 throw new InvalidArgumentException(
112 112
                     \vsprintf('Storage server `%s.adapter` config key required and must be a string, but %s defined', [
113 113
                         $serverName,
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
             $this->adapters[$name] = $adapter;
122 122
 
123
-            if (isset($bucket['distribution'])) {
123
+            if (isset($bucket['distribution'])){
124 124
                 $this->distributions[$name] = $bucket['distribution'];
125 125
             }
126 126
         }
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
 
139 139
     private function createS3Adapter(string $serverName, array $bucket, array $server, bool $async): FilesystemAdapter
140 140
     {
141
-        if (!\class_exists(Credentials::class)) {
141
+        if (!\class_exists(Credentials::class)){
142 142
             throw new ConfigException(
143
-                'Can not create AWS credentials while creating "' . $serverName . '" server. '
143
+                'Can not create AWS credentials while creating "'.$serverName.'" server. '
144 144
                 . 'Perhaps you forgot to install the "league/flysystem-aws-s3-v3" package?'
145 145
             );
146 146
         }
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
         $name = $bucket['bucket'] ?? $server['bucket'];
161 161
         $visibility = $bucket['visibility'] ?? $server['visibility'] ?? Visibility::VISIBILITY_PUBLIC;
162 162
 
163
-        if ($async) {
164
-            if (!\class_exists(AsyncAwsS3Adapter::class)) {
163
+        if ($async){
164
+            if (!\class_exists(AsyncAwsS3Adapter::class)){
165 165
                 throw new InvalidArgumentException(
166 166
                     'Can not create async S3 client, please install "league/flysystem-async-aws-s3"'
167 167
                 );
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             );
178 178
         }
179 179
 
180
-        if (!\class_exists(AwsS3V3Adapter::class)) {
180
+        if (!\class_exists(AwsS3V3Adapter::class)){
181 181
             throw new InvalidArgumentException(
182 182
                 'Can not create S3 client, please install "league/flysystem-aws-s3-v3"'
183 183
             );
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 
196 196
     private function createLocalAdapter(string $serverName, array $bucket, array $server): FilesystemAdapter
197 197
     {
198
-        if (!\is_string($server['directory'] ?? null)) {
198
+        if (!\is_string($server['directory'] ?? null)){
199 199
             throw new InvalidArgumentException(
200 200
                 \vsprintf('Storage server `%s.directory` config key required and must be a string, but %s defined', [
201 201
                     $serverName,
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         $adapter = $server['adapter'];
226 226
         $isFilesystemAdapter = \is_subclass_of($adapter, FilesystemAdapter::class, true);
227 227
 
228
-        if (!$isFilesystemAdapter) {
228
+        if (!$isFilesystemAdapter){
229 229
             throw new InvalidArgumentException(
230 230
                 \vsprintf('Storage server `%s` must be a class string of %s, but `%s` defined', [
231 231
                     $serverName,
@@ -235,9 +235,9 @@  discard block
 block discarded – undo
235 235
             );
236 236
         }
237 237
 
238
-        try {
238
+        try{
239 239
             return new $adapter(...\array_values($server['options'] ?? []));
240
-        } catch (\Throwable $e) {
240
+        }catch (\Throwable $e){
241 241
             $message = 'An error occurred while server `%s` initializing: %s';
242 242
             throw new InvalidArgumentException(\sprintf($message, $serverName, $e->getMessage()), 0, $e);
243 243
         }
Please login to merge, or discard this patch.
Braces   +29 added lines, -14 removed lines patch added patch discarded remove patch
@@ -77,8 +77,10 @@  discard block
 block discarded – undo
77 77
 
78 78
     private function bootStorages(array $config): void
79 79
     {
80
-        foreach ($config['buckets'] as $name => $bucket) {
81
-            if (!\is_string($name)) {
80
+        foreach ($config['buckets'] as $name => $bucket)
81
+        {
82
+            if (!\is_string($name))
83
+            {
82 84
                 throw new InvalidArgumentException(
83 85
                     \vsprintf('Storage bucket config key must be a string, but %s defined', [
84 86
                         \get_debug_type($name),
@@ -87,7 +89,8 @@  discard block
 block discarded – undo
87 89
             }
88 90
 
89 91
             $serverName = $bucket['server'] ?? null;
90
-            if (!\is_string($serverName)) {
92
+            if (!\is_string($serverName))
93
+            {
91 94
                 throw new InvalidArgumentException(
92 95
                     \vsprintf('Storage bucket `%s.server` config key required and must be a string, but %s defined', [
93 96
                         $name,
@@ -97,7 +100,8 @@  discard block
 block discarded – undo
97 100
             }
98 101
 
99 102
             $server = $config['servers'][$serverName] ?? null;
100
-            if (!\is_array($server)) {
103
+            if (!\is_array($server))
104
+            {
101 105
                 throw new InvalidArgumentException(
102 106
                     \vsprintf('Storage bucket `%s` relates to non-existing server `%s`', [
103 107
                         $name,
@@ -107,7 +111,8 @@  discard block
 block discarded – undo
107 111
             }
108 112
 
109 113
             $adapter = $server['adapter'] ?? null;
110
-            if (!\is_string($adapter)) {
114
+            if (!\is_string($adapter))
115
+            {
111 116
                 throw new InvalidArgumentException(
112 117
                     \vsprintf('Storage server `%s.adapter` config key required and must be a string, but %s defined', [
113 118
                         $serverName,
@@ -120,7 +125,8 @@  discard block
 block discarded – undo
120 125
 
121 126
             $this->adapters[$name] = $adapter;
122 127
 
123
-            if (isset($bucket['distribution'])) {
128
+            if (isset($bucket['distribution']))
129
+            {
124 130
                 $this->distributions[$name] = $bucket['distribution'];
125 131
             }
126 132
         }
@@ -138,7 +144,8 @@  discard block
 block discarded – undo
138 144
 
139 145
     private function createS3Adapter(string $serverName, array $bucket, array $server, bool $async): FilesystemAdapter
140 146
     {
141
-        if (!\class_exists(Credentials::class)) {
147
+        if (!\class_exists(Credentials::class))
148
+        {
142 149
             throw new ConfigException(
143 150
                 'Can not create AWS credentials while creating "' . $serverName . '" server. '
144 151
                 . 'Perhaps you forgot to install the "league/flysystem-aws-s3-v3" package?'
@@ -160,8 +167,10 @@  discard block
 block discarded – undo
160 167
         $name = $bucket['bucket'] ?? $server['bucket'];
161 168
         $visibility = $bucket['visibility'] ?? $server['visibility'] ?? Visibility::VISIBILITY_PUBLIC;
162 169
 
163
-        if ($async) {
164
-            if (!\class_exists(AsyncAwsS3Adapter::class)) {
170
+        if ($async)
171
+        {
172
+            if (!\class_exists(AsyncAwsS3Adapter::class))
173
+            {
165 174
                 throw new InvalidArgumentException(
166 175
                     'Can not create async S3 client, please install "league/flysystem-async-aws-s3"'
167 176
                 );
@@ -177,7 +186,8 @@  discard block
 block discarded – undo
177 186
             );
178 187
         }
179 188
 
180
-        if (!\class_exists(AwsS3V3Adapter::class)) {
189
+        if (!\class_exists(AwsS3V3Adapter::class))
190
+        {
181 191
             throw new InvalidArgumentException(
182 192
                 'Can not create S3 client, please install "league/flysystem-aws-s3-v3"'
183 193
             );
@@ -195,7 +205,8 @@  discard block
 block discarded – undo
195 205
 
196 206
     private function createLocalAdapter(string $serverName, array $bucket, array $server): FilesystemAdapter
197 207
     {
198
-        if (!\is_string($server['directory'] ?? null)) {
208
+        if (!\is_string($server['directory'] ?? null))
209
+        {
199 210
             throw new InvalidArgumentException(
200 211
                 \vsprintf('Storage server `%s.directory` config key required and must be a string, but %s defined', [
201 212
                     $serverName,
@@ -225,7 +236,8 @@  discard block
 block discarded – undo
225 236
         $adapter = $server['adapter'];
226 237
         $isFilesystemAdapter = \is_subclass_of($adapter, FilesystemAdapter::class, true);
227 238
 
228
-        if (!$isFilesystemAdapter) {
239
+        if (!$isFilesystemAdapter)
240
+        {
229 241
             throw new InvalidArgumentException(
230 242
                 \vsprintf('Storage server `%s` must be a class string of %s, but `%s` defined', [
231 243
                     $serverName,
@@ -235,9 +247,12 @@  discard block
 block discarded – undo
235 247
             );
236 248
         }
237 249
 
238
-        try {
250
+        try
251
+        {
239 252
             return new $adapter(...\array_values($server['options'] ?? []));
240
-        } catch (\Throwable $e) {
253
+        }
254
+        catch (\Throwable $e)
255
+        {
241 256
             $message = 'An error occurred while server `%s` initializing: %s';
242 257
             throw new InvalidArgumentException(\sprintf($message, $serverName, $e->getMessage()), 0, $e);
243 258
         }
Please login to merge, or discard this patch.
rector.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 return static function (RectorConfig $config): void {
16 16
     $config->paths([
17
-        __DIR__ . '/src/*/src',
17
+        __DIR__.'/src/*/src',
18 18
     ]);
19 19
 
20 20
     $config->parallel();
@@ -22,30 +22,30 @@  discard block
 block discarded – undo
22 22
         CountOnNullRector::class,
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',
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 49
         ],
50 50
     ]);
51 51
 
Please login to merge, or discard this patch.