Passed
Pull Request — master (#592)
by Aleksei
06:09
created
src/Storage/src/Bucket/WritableTrait.php 3 patches
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -166,8 +166,8 @@
 block discarded – undo
166 166
         string $visibility
167 167
     ): string {
168 168
         return ($visibility === Visibility::VISIBILITY_PUBLIC)
169
-            ? \League\Flysystem\Visibility::PUBLIC
170
-            : \League\Flysystem\Visibility::PRIVATE;
169
+            ? \League\Flysystem\Visibility::public
170
+            : \League\Flysystem\Visibility::private;
171 171
     }
172 172
 
173 173
     /**
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public function create(string $pathname, array $config = []): FileInterface
31 31
     {
32
-        if ($this instanceof ReadableInterface && !$this->exists($pathname)) {
32
+        if ($this instanceof ReadableInterface && !$this->exists($pathname)){
33 33
             return $this->write($pathname, '', $config);
34 34
         }
35 35
 
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 
46 46
         $fs = $this->getOperator();
47 47
 
48
-        try {
49
-            switch (true) {
48
+        try{
49
+            switch (true){
50 50
                 case \is_object($content):
51 51
                 case \is_string($content):
52 52
                     $fs->write($pathname, (string)$content, $config);
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                     $message = 'Content must be a resource stream or stringable type, but %s passed';
61 61
                     throw new \InvalidArgumentException(\sprintf($message, \get_debug_type($content)));
62 62
             }
63
-        } catch (FilesystemException $e) {
63
+        }catch (FilesystemException $e){
64 64
             throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
65 65
         }
66 66
 
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
     ): FileInterface {
78 78
         $fs = $this->getOperator();
79 79
 
80
-        try {
80
+        try{
81 81
             $fs->setVisibility($pathname, $this->toFlysystemVisibility($visibility));
82
-        } catch (FilesystemException $e) {
82
+        }catch (FilesystemException $e){
83 83
             throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
84 84
         }
85 85
 
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
     ): FileInterface {
98 98
         $fs = $this->getOperator();
99 99
 
100
-        if ($storage === null || $storage === $this) {
101
-            try {
100
+        if ($storage === null || $storage === $this){
101
+            try{
102 102
                 $fs->copy($source, $destination, $config);
103
-            } catch (FilesystemException $e) {
103
+            }catch (FilesystemException $e){
104 104
                 throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
105 105
             }
106 106
 
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
     ): FileInterface {
122 122
         $fs = $this->getOperator();
123 123
 
124
-        if ($storage === null || $storage === $this) {
125
-            try {
124
+        if ($storage === null || $storage === $this){
125
+            try{
126 126
                 $fs->move($source, $destination, $config);
127
-            } catch (FilesystemException $e) {
127
+            }catch (FilesystemException $e){
128 128
                 throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
129 129
             }
130 130
 
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
     {
146 146
         $fs = $this->getOperator();
147 147
 
148
-        try {
148
+        try{
149 149
             $fs->delete($pathname);
150 150
 
151
-            if ($clean) {
151
+            if ($clean){
152 152
                 $this->deleteEmptyDirectories($this->getParentDirectory($pathname));
153 153
             }
154
-        } catch (FilesystemException $e) {
154
+        }catch (FilesystemException $e){
155 155
             throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
156 156
         }
157 157
     }
@@ -207,19 +207,19 @@  discard block
 block discarded – undo
207 207
      */
208 208
     private function deleteEmptyDirectories(string $directory): void
209 209
     {
210
-        if (!$this->hasParentDirectory($directory)) {
210
+        if (!$this->hasParentDirectory($directory)){
211 211
             return;
212 212
         }
213 213
 
214 214
         $fs = $this->getOperator();
215 215
 
216
-        try {
217
-            if (!$this->hasFiles($directory)) {
216
+        try{
217
+            if (!$this->hasFiles($directory)){
218 218
                 $fs->deleteDirectory($directory);
219 219
 
220 220
                 $this->deleteEmptyDirectories($this->getParentDirectory($directory));
221 221
             }
222
-        } catch (FilesystemException $e) {
222
+        }catch (FilesystemException $e){
223 223
             throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
224 224
         }
225 225
     }
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
     {
242 242
         $fs = $this->getOperator();
243 243
 
244
-        foreach ($fs->listContents($directory) as $_) {
244
+        foreach ($fs->listContents($directory) as $_){
245 245
             return true;
246 246
         }
247 247
 
@@ -256,15 +256,15 @@  discard block
 block discarded – undo
256 256
      */
257 257
     private function isStringable($value): bool
258 258
     {
259
-        if (\is_string($value)) {
259
+        if (\is_string($value)){
260 260
             return true;
261 261
         }
262 262
 
263
-        if (!\is_object($value)) {
263
+        if (!\is_object($value)){
264 264
             return false;
265 265
         }
266 266
 
267
-        if (\PHP_VERSION_ID >= 80000) {
267
+        if (\PHP_VERSION_ID >= 80000){
268 268
             return $value instanceof \Stringable;
269 269
         }
270 270
 
Please login to merge, or discard this patch.
Braces   +52 added lines, -23 removed lines patch added patch discarded remove patch
@@ -29,7 +29,8 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public function create(string $pathname, array $config = []): FileInterface
31 31
     {
32
-        if ($this instanceof ReadableInterface && !$this->exists($pathname)) {
32
+        if ($this instanceof ReadableInterface && !$this->exists($pathname))
33
+        {
33 34
             return $this->write($pathname, '', $config);
34 35
         }
35 36
 
@@ -45,8 +46,10 @@  discard block
 block discarded – undo
45 46
 
46 47
         $fs = $this->getOperator();
47 48
 
48
-        try {
49
-            switch (true) {
49
+        try
50
+        {
51
+            switch (true)
52
+            {
50 53
                 case \is_object($content):
51 54
                 case \is_string($content):
52 55
                     $fs->write($pathname, (string)$content, $config);
@@ -60,7 +63,9 @@  discard block
 block discarded – undo
60 63
                     $message = 'Content must be a resource stream or stringable type, but %s passed';
61 64
                     throw new \InvalidArgumentException(\sprintf($message, \get_debug_type($content)));
62 65
             }
63
-        } catch (FilesystemException $e) {
66
+        }
67
+        catch (FilesystemException $e)
68
+        {
64 69
             throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
65 70
         }
66 71
 
@@ -77,9 +82,12 @@  discard block
 block discarded – undo
77 82
     ): FileInterface {
78 83
         $fs = $this->getOperator();
79 84
 
80
-        try {
85
+        try
86
+        {
81 87
             $fs->setVisibility($pathname, $this->toFlysystemVisibility($visibility));
82
-        } catch (FilesystemException $e) {
88
+        }
89
+        catch (FilesystemException $e)
90
+        {
83 91
             throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
84 92
         }
85 93
 
@@ -97,10 +105,14 @@  discard block
 block discarded – undo
97 105
     ): FileInterface {
98 106
         $fs = $this->getOperator();
99 107
 
100
-        if ($storage === null || $storage === $this) {
101
-            try {
108
+        if ($storage === null || $storage === $this)
109
+        {
110
+            try
111
+            {
102 112
                 $fs->copy($source, $destination, $config);
103
-            } catch (FilesystemException $e) {
113
+            }
114
+            catch (FilesystemException $e)
115
+            {
104 116
                 throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
105 117
             }
106 118
 
@@ -121,10 +133,14 @@  discard block
 block discarded – undo
121 133
     ): FileInterface {
122 134
         $fs = $this->getOperator();
123 135
 
124
-        if ($storage === null || $storage === $this) {
125
-            try {
136
+        if ($storage === null || $storage === $this)
137
+        {
138
+            try
139
+            {
126 140
                 $fs->move($source, $destination, $config);
127
-            } catch (FilesystemException $e) {
141
+            }
142
+            catch (FilesystemException $e)
143
+            {
128 144
                 throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
129 145
             }
130 146
 
@@ -145,13 +161,17 @@  discard block
 block discarded – undo
145 161
     {
146 162
         $fs = $this->getOperator();
147 163
 
148
-        try {
164
+        try
165
+        {
149 166
             $fs->delete($pathname);
150 167
 
151
-            if ($clean) {
168
+            if ($clean)
169
+            {
152 170
                 $this->deleteEmptyDirectories($this->getParentDirectory($pathname));
153 171
             }
154
-        } catch (FilesystemException $e) {
172
+        }
173
+        catch (FilesystemException $e)
174
+        {
155 175
             throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
156 176
         }
157 177
     }
@@ -207,19 +227,24 @@  discard block
 block discarded – undo
207 227
      */
208 228
     private function deleteEmptyDirectories(string $directory): void
209 229
     {
210
-        if (!$this->hasParentDirectory($directory)) {
230
+        if (!$this->hasParentDirectory($directory))
231
+        {
211 232
             return;
212 233
         }
213 234
 
214 235
         $fs = $this->getOperator();
215 236
 
216
-        try {
217
-            if (!$this->hasFiles($directory)) {
237
+        try
238
+        {
239
+            if (!$this->hasFiles($directory))
240
+            {
218 241
                 $fs->deleteDirectory($directory);
219 242
 
220 243
                 $this->deleteEmptyDirectories($this->getParentDirectory($directory));
221 244
             }
222
-        } catch (FilesystemException $e) {
245
+        }
246
+        catch (FilesystemException $e)
247
+        {
223 248
             throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
224 249
         }
225 250
     }
@@ -241,7 +266,8 @@  discard block
 block discarded – undo
241 266
     {
242 267
         $fs = $this->getOperator();
243 268
 
244
-        foreach ($fs->listContents($directory) as $_) {
269
+        foreach ($fs->listContents($directory) as $_)
270
+        {
245 271
             return true;
246 272
         }
247 273
 
@@ -256,15 +282,18 @@  discard block
 block discarded – undo
256 282
      */
257 283
     private function isStringable($value): bool
258 284
     {
259
-        if (\is_string($value)) {
285
+        if (\is_string($value))
286
+        {
260 287
             return true;
261 288
         }
262 289
 
263
-        if (!\is_object($value)) {
290
+        if (!\is_object($value))
291
+        {
264 292
             return false;
265 293
         }
266 294
 
267
-        if (\PHP_VERSION_ID >= 80000) {
295
+        if (\PHP_VERSION_ID >= 80000)
296
+        {
268 297
             return $value instanceof \Stringable;
269 298
         }
270 299
 
Please login to merge, or discard this patch.
src/Storage/src/Visibility.php 1 patch
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,11 +22,11 @@
 block discarded – undo
22 22
      * @var string
23 23
      * @psalm-var VisibilityType
24 24
      */
25
-    public const VISIBILITY_PUBLIC = \League\Flysystem\Visibility::PUBLIC;
25
+    public const VISIBILITY_PUBLIC = \League\Flysystem\Visibility::public;
26 26
 
27 27
     /**
28 28
      * @var string
29 29
      * @psalm-var VisibilityType
30 30
      */
31
-    public const VISIBILITY_PRIVATE = \League\Flysystem\Visibility::PRIVATE;
31
+    public const VISIBILITY_PRIVATE = \League\Flysystem\Visibility::private;
32 32
 }
Please login to merge, or discard this patch.
src/Framework/Bootloader/Distribution/DistributionBootloader.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
      */
45 45
     private function registerResolver(Container $app): void
46 46
     {
47
-        $app->bindSingleton(UriResolverInterface::class, static function (DistributionInterface $manager) {
47
+        $app->bindSingleton(UriResolverInterface::class, static function (DistributionInterface $manager){
48 48
             return $manager->resolver();
49 49
         });
50 50
 
51
-        $app->bindSingleton(UriResolver::class, static function (Container $app) {
51
+        $app->bindSingleton(UriResolver::class, static function (Container $app){
52 52
             return $app->get(UriResolverInterface::class);
53 53
         });
54 54
     }
@@ -58,21 +58,21 @@  discard block
 block discarded – undo
58 58
      */
59 59
     private function registerManager(Container $app): void
60 60
     {
61
-        $app->bindSingleton(DistributionInterface::class, static function (DistributionConfig $config) {
61
+        $app->bindSingleton(DistributionInterface::class, static function (DistributionConfig $config){
62 62
             $manager = new Manager($config->getDefaultDriver());
63 63
 
64
-            foreach ($config->getResolvers() as $name => $resolver) {
64
+            foreach ($config->getResolvers() as $name => $resolver){
65 65
                 $manager->add($name, $resolver);
66 66
             }
67 67
 
68 68
             return $manager;
69 69
         });
70 70
 
71
-        $app->bindSingleton(MutableDistributionInterface::class, static function (Container $app) {
71
+        $app->bindSingleton(MutableDistributionInterface::class, static function (Container $app){
72 72
             return $app->get(DistributionInterface::class);
73 73
         });
74 74
 
75
-        $app->bindSingleton(Manager::class, static function (Container $app) {
75
+        $app->bindSingleton(Manager::class, static function (Container $app){
76 76
             return $app->get(DistributionInterface::class);
77 77
         });
78 78
     }
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -44,11 +44,13 @@  discard block
 block discarded – undo
44 44
      */
45 45
     private function registerResolver(Container $app): void
46 46
     {
47
-        $app->bindSingleton(UriResolverInterface::class, static function (DistributionInterface $manager) {
47
+        $app->bindSingleton(UriResolverInterface::class, static function (DistributionInterface $manager)
48
+        {
48 49
             return $manager->resolver();
49 50
         });
50 51
 
51
-        $app->bindSingleton(UriResolver::class, static function (Container $app) {
52
+        $app->bindSingleton(UriResolver::class, static function (Container $app)
53
+        {
52 54
             return $app->get(UriResolverInterface::class);
53 55
         });
54 56
     }
@@ -58,21 +60,25 @@  discard block
 block discarded – undo
58 60
      */
59 61
     private function registerManager(Container $app): void
60 62
     {
61
-        $app->bindSingleton(DistributionInterface::class, static function (DistributionConfig $config) {
63
+        $app->bindSingleton(DistributionInterface::class, static function (DistributionConfig $config)
64
+        {
62 65
             $manager = new Manager($config->getDefaultDriver());
63 66
 
64
-            foreach ($config->getResolvers() as $name => $resolver) {
67
+            foreach ($config->getResolvers() as $name => $resolver)
68
+            {
65 69
                 $manager->add($name, $resolver);
66 70
             }
67 71
 
68 72
             return $manager;
69 73
         });
70 74
 
71
-        $app->bindSingleton(MutableDistributionInterface::class, static function (Container $app) {
75
+        $app->bindSingleton(MutableDistributionInterface::class, static function (Container $app)
76
+        {
72 77
             return $app->get(DistributionInterface::class);
73 78
         });
74 79
 
75
-        $app->bindSingleton(Manager::class, static function (Container $app) {
80
+        $app->bindSingleton(Manager::class, static function (Container $app)
81
+        {
76 82
             return $app->get(DistributionInterface::class);
77 83
         });
78 84
     }
Please login to merge, or discard this patch.
src/Distribution/src/Manager.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     {
66 66
         $name = $name ?? $this->default;
67 67
 
68
-        if (!isset($this->resolvers[$name])) {
68
+        if (!isset($this->resolvers[$name])){
69 69
             throw new \InvalidArgumentException(\sprintf(self::ERROR_NOT_FOUND, $name));
70 70
         }
71 71
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function add(string $name, UriResolverInterface $resolver, bool $overwrite = false): void
79 79
     {
80
-        if ($overwrite === false && isset($this->resolvers[$name])) {
80
+        if ($overwrite === false && isset($this->resolvers[$name])){
81 81
             throw new \InvalidArgumentException(\sprintf(self::ERROR_REDEFINITION, $name));
82 82
         }
83 83
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,7 +65,8 @@  discard block
 block discarded – undo
65 65
     {
66 66
         $name = $name ?? $this->default;
67 67
 
68
-        if (!isset($this->resolvers[$name])) {
68
+        if (!isset($this->resolvers[$name]))
69
+        {
69 70
             throw new \InvalidArgumentException(\sprintf(self::ERROR_NOT_FOUND, $name));
70 71
         }
71 72
 
@@ -77,7 +78,8 @@  discard block
 block discarded – undo
77 78
      */
78 79
     public function add(string $name, UriResolverInterface $resolver, bool $overwrite = false): void
79 80
     {
80
-        if ($overwrite === false && isset($this->resolvers[$name])) {
81
+        if ($overwrite === false && isset($this->resolvers[$name]))
82
+        {
81 83
             throw new \InvalidArgumentException(\sprintf(self::ERROR_REDEFINITION, $name));
82 84
         }
83 85
 
Please login to merge, or discard this patch.
src/Http/src/Traits/JsonTrait.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@
 block discarded – undo
29 29
      */
30 30
     private function writeJson(ResponseInterface $response, $payload, int $code = 200): ResponseInterface
31 31
     {
32
-        if ($payload instanceof JsonSerializable) {
32
+        if ($payload instanceof JsonSerializable){
33 33
             $payload = $payload->jsonSerialize();
34 34
         }
35 35
 
36
-        if (is_array($payload) && isset($payload['status']) && is_int($payload['status'])) {
36
+        if (is_array($payload) && isset($payload['status']) && is_int($payload['status'])){
37 37
             $code = $payload['status'];
38 38
         }
39 39
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,11 +29,13 @@
 block discarded – undo
29 29
      */
30 30
     private function writeJson(ResponseInterface $response, $payload, int $code = 200): ResponseInterface
31 31
     {
32
-        if ($payload instanceof JsonSerializable) {
32
+        if ($payload instanceof JsonSerializable)
33
+        {
33 34
             $payload = $payload->jsonSerialize();
34 35
         }
35 36
 
36
-        if (is_array($payload) && isset($payload['status']) && is_int($payload['status'])) {
37
+        if (is_array($payload) && isset($payload['status']) && is_int($payload['status']))
38
+        {
37 39
             $code = $payload['status'];
38 40
         }
39 41
 
Please login to merge, or discard this patch.
src/Console/tests/LazyTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
     public function testLazyCommandCreationInCommandLocator(): void
22 22
     {
23 23
         $locator = new CommandLocator(
24
-            new class() implements ClassesInterface {
24
+            new class() implements ClassesInterface{
25 25
                 public function getClasses($target = null): array
26 26
                 {
27 27
                     return [
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,8 @@
 block discarded – undo
21 21
     public function testLazyCommandCreationInCommandLocator(): void
22 22
     {
23 23
         $locator = new CommandLocator(
24
-            new class() implements ClassesInterface {
24
+            new class() implements ClassesInterface
25
+            {
25 26
                 public function getClasses($target = null): array
26 27
                 {
27 28
                     return [
Please login to merge, or discard this patch.
src/Console/src/Traits/LazyTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
                 ? $class::DESCRIPTION
43 43
                 : '',
44 44
             false,
45
-            function () use ($class): SymfonyCommand {
45
+            function () use ($class) : SymfonyCommand {
46 46
                 $command = $this->container->get($class);
47 47
                 $command->setContainer($this->container);
48 48
 
Please login to merge, or discard this patch.
src/Console/src/StaticLocator.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
     public function locateCommands(): array
42 42
     {
43 43
         $commands = [];
44
-        foreach ($this->commands as $command) {
44
+        foreach ($this->commands as $command){
45 45
             $commands[] = $this->supportsLazyLoading($command)
46 46
                 ? $this->createLazyCommand($command)
47 47
                 : $this->container->get($command);
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,8 @@
 block discarded – undo
41 41
     public function locateCommands(): array
42 42
     {
43 43
         $commands = [];
44
-        foreach ($this->commands as $command) {
44
+        foreach ($this->commands as $command)
45
+        {
45 46
             $commands[] = $this->supportsLazyLoading($command)
46 47
                 ? $this->createLazyCommand($command)
47 48
                 : $this->container->get($command);
Please login to merge, or discard this patch.
tests/Framework/Validation/EntityCheckerTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -165,7 +165,7 @@
 block discarded – undo
165 165
             ['value' => $value] + $data,
166 166
             ['value' => [['entity::unique', User::class, $field, $fields, $ignoreCase]]]
167 167
         );
168
-        if ($context !== null) {
168
+        if ($context !== null){
169 169
             $validator = $validator->withContext($context);
170 170
         }
171 171
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -165,7 +165,8 @@
 block discarded – undo
165 165
             ['value' => $value] + $data,
166 166
             ['value' => [['entity::unique', User::class, $field, $fields, $ignoreCase]]]
167 167
         );
168
-        if ($context !== null) {
168
+        if ($context !== null)
169
+        {
169 170
             $validator = $validator->withContext($context);
170 171
         }
171 172
 
Please login to merge, or discard this patch.