Passed
Pull Request — master (#407)
by Kirill
07:03
created
src/Prototype/src/ClassNode/ConstructorParam.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,13 +56,13 @@
 block discarded – undo
56 56
         $stmt->name = $parameter->getName();
57 57
 
58 58
         $type = $parameter->getType();
59
-        if ($type instanceof \ReflectionNamedType) {
59
+        if ($type instanceof \ReflectionNamedType){
60 60
             $stmt->type = Type::create($type->getName());
61 61
             $stmt->builtIn = $type->isBuiltin();
62 62
             $stmt->nullable = $type->allowsNull();
63 63
         }
64 64
 
65
-        if ($parameter->isDefaultValueAvailable()) {
65
+        if ($parameter->isDefaultValueAvailable()){
66 66
             $stmt->hasDefault = true;
67 67
             $stmt->default = $parameter->getDefaultValue();
68 68
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,13 +56,15 @@
 block discarded – undo
56 56
         $stmt->name = $parameter->getName();
57 57
 
58 58
         $type = $parameter->getType();
59
-        if ($type instanceof \ReflectionNamedType) {
59
+        if ($type instanceof \ReflectionNamedType)
60
+        {
60 61
             $stmt->type = Type::create($type->getName());
61 62
             $stmt->builtIn = $type->isBuiltin();
62 63
             $stmt->nullable = $type->allowsNull();
63 64
         }
64 65
 
65
-        if ($parameter->isDefaultValueAvailable()) {
66
+        if ($parameter->isDefaultValueAvailable())
67
+        {
66 68
             $stmt->hasDefault = true;
67 69
             $stmt->default = $parameter->getDefaultValue();
68 70
         }
Please login to merge, or discard this patch.
src/Attributes/src/polyfill.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
     use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
15 15
 
16
-    if (!\interface_exists(NamedArgumentConstructorAnnotation::class)) {
16
+    if (!\interface_exists(NamedArgumentConstructorAnnotation::class)){
17 17
         /**
18 18
          * Marker interface for PHP7/PHP8 compatible support for named
19 19
          * arguments (and constructor property promotion).
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 namespace Doctrine\Common\Annotations\Annotation {
33 33
 
34
-    if (!\class_exists(NamedArgumentConstructor::class, false)) {
34
+    if (!\class_exists(NamedArgumentConstructor::class, false)){
35 35
         /**
36 36
          * Annotation that indicates that the annotated class should be
37 37
          * constructed with a named argument call.
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
     use JetBrains\PhpStorm\ExpectedValues;
53 53
 
54
-    if (!\class_exists(Attribute::class, false)) {
54
+    if (!\class_exists(Attribute::class, false)){
55 55
         #[Attribute(Attribute::TARGET_CLASS)]
56 56
         final class Attribute
57 57
         {
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             public function __construct(
128 128
                 #[ExpectedValues(flagsFromClass: Attribute::class)]
129 129
                 int $flags = self::TARGET_ALL
130
-            ) {
130
+            ){
131 131
             }
132 132
         }
133 133
     }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,7 +13,8 @@  discard block
 block discarded – undo
13 13
 
14 14
     use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
15 15
 
16
-    if (!\interface_exists(NamedArgumentConstructorAnnotation::class)) {
16
+    if (!\interface_exists(NamedArgumentConstructorAnnotation::class))
17
+    {
17 18
         /**
18 19
          * Marker interface for PHP7/PHP8 compatible support for named
19 20
          * arguments (and constructor property promotion).
@@ -31,7 +32,8 @@  discard block
 block discarded – undo
31 32
 
32 33
 namespace Doctrine\Common\Annotations\Annotation {
33 34
 
34
-    if (!\class_exists(NamedArgumentConstructor::class, false)) {
35
+    if (!\class_exists(NamedArgumentConstructor::class, false))
36
+    {
35 37
         /**
36 38
          * Annotation that indicates that the annotated class should be
37 39
          * constructed with a named argument call.
@@ -51,7 +53,8 @@  discard block
 block discarded – undo
51 53
 
52 54
     use JetBrains\PhpStorm\ExpectedValues;
53 55
 
54
-    if (!\class_exists(Attribute::class, false)) {
56
+    if (!\class_exists(Attribute::class, false))
57
+    {
55 58
         #[Attribute(Attribute::TARGET_CLASS)]
56 59
         final class Attribute
57 60
         {
Please login to merge, or discard this patch.
src/Storage/src/Storage.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     {
78 78
         $name = $name ?? $this->default;
79 79
 
80
-        if (!isset($this->buckets[$name])) {
80
+        if (!isset($this->buckets[$name])){
81 81
             throw new InvalidArgumentException(\sprintf(self::ERROR_NOT_FOUND, $name));
82 82
         }
83 83
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function add(string $name, BucketInterface $storage, bool $overwrite = false): void
101 101
     {
102
-        if ($overwrite === false && isset($this->buckets[$name])) {
102
+        if ($overwrite === false && isset($this->buckets[$name])){
103 103
             throw new \InvalidArgumentException(\sprintf(self::ERROR_REDEFINITION, $name));
104 104
         }
105 105
 
@@ -133,22 +133,22 @@  discard block
 block discarded – undo
133 133
         $uri = $this->uriToString($uri);
134 134
         $result = \parse_url($uri);
135 135
 
136
-        if ($result === false) {
136
+        if ($result === false){
137 137
             $message = 'URI argument must be a valid URI in "[STORAGE]://[PATH_TO_FILE]" format, but `%s` given';
138 138
             throw new InvalidArgumentException(\sprintf($message, $uri));
139 139
         }
140 140
 
141
-        if (!isset($result['scheme'])) {
141
+        if (!isset($result['scheme'])){
142 142
             $result['scheme'] = $withScheme ? $this->default : null;
143 143
         }
144 144
 
145
-        if (!isset($result['host'])) {
145
+        if (!isset($result['host'])){
146 146
             $result['host'] = '';
147 147
         }
148 148
 
149 149
         return [
150 150
             $result['scheme'] ?? null,
151
-            $result['host'] . \rtrim($result['path'] ?? '', '/'),
151
+            $result['host'].\rtrim($result['path'] ?? '', '/'),
152 152
         ];
153 153
     }
154 154
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      */
160 160
     private function uriToString($uri): string
161 161
     {
162
-        switch (true) {
162
+        switch (true){
163 163
             case $uri instanceof UriInterface:
164 164
             case $uri instanceof \Stringable:
165 165
             case \is_object($uri) && \method_exists($uri, '__toString'):
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -77,7 +77,8 @@  discard block
 block discarded – undo
77 77
     {
78 78
         $name = $name ?? $this->default;
79 79
 
80
-        if (!isset($this->buckets[$name])) {
80
+        if (!isset($this->buckets[$name]))
81
+        {
81 82
             throw new InvalidArgumentException(\sprintf(self::ERROR_NOT_FOUND, $name));
82 83
         }
83 84
 
@@ -99,7 +100,8 @@  discard block
 block discarded – undo
99 100
      */
100 101
     public function add(string $name, BucketInterface $storage, bool $overwrite = false): void
101 102
     {
102
-        if ($overwrite === false && isset($this->buckets[$name])) {
103
+        if ($overwrite === false && isset($this->buckets[$name]))
104
+        {
103 105
             throw new \InvalidArgumentException(\sprintf(self::ERROR_REDEFINITION, $name));
104 106
         }
105 107
 
@@ -133,16 +135,19 @@  discard block
 block discarded – undo
133 135
         $uri = $this->uriToString($uri);
134 136
         $result = \parse_url($uri);
135 137
 
136
-        if ($result === false) {
138
+        if ($result === false)
139
+        {
137 140
             $message = 'URI argument must be a valid URI in "[STORAGE]://[PATH_TO_FILE]" format, but `%s` given';
138 141
             throw new InvalidArgumentException(\sprintf($message, $uri));
139 142
         }
140 143
 
141
-        if (!isset($result['scheme'])) {
144
+        if (!isset($result['scheme']))
145
+        {
142 146
             $result['scheme'] = $withScheme ? $this->default : null;
143 147
         }
144 148
 
145
-        if (!isset($result['host'])) {
149
+        if (!isset($result['host']))
150
+        {
146 151
             $result['host'] = '';
147 152
         }
148 153
 
@@ -159,7 +164,8 @@  discard block
 block discarded – undo
159 164
      */
160 165
     private function uriToString($uri): string
161 166
     {
162
-        switch (true) {
167
+        switch (true)
168
+        {
163 169
             case $uri instanceof UriInterface:
164 170
             case $uri instanceof \Stringable:
165 171
             case \is_object($uri) && \method_exists($uri, '__toString'):
Please login to merge, or discard this patch.
src/Storage/src/File.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
     {
65 65
         $name = $this->storage->getName();
66 66
 
67
-        if ($name === null) {
67
+        if ($name === null){
68 68
             return $this->getPathname();
69 69
         }
70 70
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,8 @@
 block discarded – undo
64 64
     {
65 65
         $name = $this->storage->getName();
66 66
 
67
-        if ($name === null) {
67
+        if ($name === null)
68
+        {
68 69
             return $this->getPathname();
69 70
         }
70 71
 
Please login to merge, or discard this patch.
src/Storage/src/Bucket/ReadableTrait.php 3 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
     {
30 30
         $fs = $this->getOperator();
31 31
 
32
-        try {
32
+        try{
33 33
             return $fs->fileExists($pathname);
34
-        } catch (FilesystemException $e) {
34
+        }catch (FilesystemException $e){
35 35
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
36 36
         }
37 37
     }
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
     {
44 44
         $fs = $this->getOperator();
45 45
 
46
-        try {
46
+        try{
47 47
             return $fs->read($pathname);
48
-        } catch (FilesystemException $e) {
48
+        }catch (FilesystemException $e){
49 49
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
50 50
         }
51 51
     }
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
     {
58 58
         $fs = $this->getOperator();
59 59
 
60
-        try {
60
+        try{
61 61
             return $fs->readStream($pathname);
62
-        } catch (FilesystemException $e) {
62
+        }catch (FilesystemException $e){
63 63
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
64 64
         }
65 65
     }
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
     {
72 72
         $fs = $this->getOperator();
73 73
 
74
-        try {
74
+        try{
75 75
             return $fs->lastModified($pathname);
76
-        } catch (FilesystemException $e) {
76
+        }catch (FilesystemException $e){
77 77
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
78 78
         }
79 79
     }
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
     {
86 86
         $fs = $this->getOperator();
87 87
 
88
-        try {
88
+        try{
89 89
             return $fs->fileSize($pathname);
90
-        } catch (FilesystemException $e) {
90
+        }catch (FilesystemException $e){
91 91
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
92 92
         }
93 93
     }
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
     {
100 100
         $fs = $this->getOperator();
101 101
 
102
-        try {
102
+        try{
103 103
             return $fs->mimeType($pathname);
104
-        } catch (FilesystemException $e) {
104
+        }catch (FilesystemException $e){
105 105
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
106 106
         }
107 107
     }
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
     {
115 115
         $fs = $this->getOperator();
116 116
 
117
-        try {
117
+        try{
118 118
             return $this->fromFlysystemVisibility(
119 119
                 $fs->visibility($pathname)
120 120
             );
121
-        } catch (FilesystemException $e) {
121
+        }catch (FilesystemException $e){
122 122
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
123 123
         }
124 124
     }
Please login to merge, or discard this patch.
Braces   +35 added lines, -14 removed lines patch added patch discarded remove patch
@@ -29,9 +29,12 @@  discard block
 block discarded – undo
29 29
     {
30 30
         $fs = $this->getOperator();
31 31
 
32
-        try {
32
+        try
33
+        {
33 34
             return $fs->fileExists($pathname);
34
-        } catch (FilesystemException $e) {
35
+        }
36
+        catch (FilesystemException $e)
37
+        {
35 38
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
36 39
         }
37 40
     }
@@ -43,9 +46,12 @@  discard block
 block discarded – undo
43 46
     {
44 47
         $fs = $this->getOperator();
45 48
 
46
-        try {
49
+        try
50
+        {
47 51
             return $fs->read($pathname);
48
-        } catch (FilesystemException $e) {
52
+        }
53
+        catch (FilesystemException $e)
54
+        {
49 55
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
50 56
         }
51 57
     }
@@ -57,9 +63,12 @@  discard block
 block discarded – undo
57 63
     {
58 64
         $fs = $this->getOperator();
59 65
 
60
-        try {
66
+        try
67
+        {
61 68
             return $fs->readStream($pathname);
62
-        } catch (FilesystemException $e) {
69
+        }
70
+        catch (FilesystemException $e)
71
+        {
63 72
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
64 73
         }
65 74
     }
@@ -71,9 +80,12 @@  discard block
 block discarded – undo
71 80
     {
72 81
         $fs = $this->getOperator();
73 82
 
74
-        try {
83
+        try
84
+        {
75 85
             return $fs->lastModified($pathname);
76
-        } catch (FilesystemException $e) {
86
+        }
87
+        catch (FilesystemException $e)
88
+        {
77 89
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
78 90
         }
79 91
     }
@@ -85,9 +97,12 @@  discard block
 block discarded – undo
85 97
     {
86 98
         $fs = $this->getOperator();
87 99
 
88
-        try {
100
+        try
101
+        {
89 102
             return $fs->fileSize($pathname);
90
-        } catch (FilesystemException $e) {
103
+        }
104
+        catch (FilesystemException $e)
105
+        {
91 106
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
92 107
         }
93 108
     }
@@ -99,9 +114,12 @@  discard block
 block discarded – undo
99 114
     {
100 115
         $fs = $this->getOperator();
101 116
 
102
-        try {
117
+        try
118
+        {
103 119
             return $fs->mimeType($pathname);
104
-        } catch (FilesystemException $e) {
120
+        }
121
+        catch (FilesystemException $e)
122
+        {
105 123
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
106 124
         }
107 125
     }
@@ -114,11 +132,14 @@  discard block
 block discarded – undo
114 132
     {
115 133
         $fs = $this->getOperator();
116 134
 
117
-        try {
135
+        try
136
+        {
118 137
             return $this->fromFlysystemVisibility(
119 138
                 $fs->visibility($pathname)
120 139
             );
121
-        } catch (FilesystemException $e) {
140
+        }
141
+        catch (FilesystemException $e)
142
+        {
122 143
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
123 144
         }
124 145
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@
 block discarded – undo
136 136
         #[ExpectedValues(valuesFromClass: \League\Flysystem\Visibility::class)]
137 137
         string $visibility
138 138
     ): string {
139
-        return $visibility === \League\Flysystem\Visibility::PUBLIC
139
+        return $visibility === \League\Flysystem\Visibility::public
140 140
             ? Visibility::VISIBILITY_PUBLIC
141 141
             : Visibility::VISIBILITY_PRIVATE;
142 142
     }
Please login to merge, or discard this patch.
src/Storage/src/Bucket/WritableTrait.php 3 patches
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(), (int)$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(), (int)$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(), (int)$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(), (int)$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(), (int)$e->getCode(), $e);
156 156
         }
157 157
     }
@@ -219,19 +219,19 @@  discard block
 block discarded – undo
219 219
      */
220 220
     private function deleteEmptyDirectories(string $directory): void
221 221
     {
222
-        if (!$this->hasParentDirectory($directory)) {
222
+        if (!$this->hasParentDirectory($directory)){
223 223
             return;
224 224
         }
225 225
 
226 226
         $fs = $this->getOperator();
227 227
 
228
-        try {
229
-            if (!$this->hasFiles($directory)) {
228
+        try{
229
+            if (!$this->hasFiles($directory)){
230 230
                 $fs->deleteDirectory($directory);
231 231
 
232 232
                 $this->deleteEmptyDirectories($this->getParentDirectory($directory));
233 233
             }
234
-        } catch (FilesystemException $e) {
234
+        }catch (FilesystemException $e){
235 235
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
236 236
         }
237 237
     }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
     {
255 255
         $fs = $this->getOperator();
256 256
 
257
-        foreach ($fs->listContents($directory) as $_) {
257
+        foreach ($fs->listContents($directory) as $_){
258 258
             return true;
259 259
         }
260 260
 
@@ -270,15 +270,15 @@  discard block
 block discarded – undo
270 270
      */
271 271
     private function isStringable($value): bool
272 272
     {
273
-        if (\is_string($value)) {
273
+        if (\is_string($value)){
274 274
             return true;
275 275
         }
276 276
 
277
-        if (!\is_object($value)) {
277
+        if (!\is_object($value)){
278 278
             return false;
279 279
         }
280 280
 
281
-        if (\PHP_VERSION_ID >= 80000) {
281
+        if (\PHP_VERSION_ID >= 80000){
282 282
             return $value instanceof \Stringable;
283 283
         }
284 284
 
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(), (int)$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(), (int)$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(), (int)$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(), (int)$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(), (int)$e->getCode(), $e);
156 176
         }
157 177
     }
@@ -219,19 +239,24 @@  discard block
 block discarded – undo
219 239
      */
220 240
     private function deleteEmptyDirectories(string $directory): void
221 241
     {
222
-        if (!$this->hasParentDirectory($directory)) {
242
+        if (!$this->hasParentDirectory($directory))
243
+        {
223 244
             return;
224 245
         }
225 246
 
226 247
         $fs = $this->getOperator();
227 248
 
228
-        try {
229
-            if (!$this->hasFiles($directory)) {
249
+        try
250
+        {
251
+            if (!$this->hasFiles($directory))
252
+            {
230 253
                 $fs->deleteDirectory($directory);
231 254
 
232 255
                 $this->deleteEmptyDirectories($this->getParentDirectory($directory));
233 256
             }
234
-        } catch (FilesystemException $e) {
257
+        }
258
+        catch (FilesystemException $e)
259
+        {
235 260
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
236 261
         }
237 262
     }
@@ -254,7 +279,8 @@  discard block
 block discarded – undo
254 279
     {
255 280
         $fs = $this->getOperator();
256 281
 
257
-        foreach ($fs->listContents($directory) as $_) {
282
+        foreach ($fs->listContents($directory) as $_)
283
+        {
258 284
             return true;
259 285
         }
260 286
 
@@ -270,15 +296,18 @@  discard block
 block discarded – undo
270 296
      */
271 297
     private function isStringable($value): bool
272 298
     {
273
-        if (\is_string($value)) {
299
+        if (\is_string($value))
300
+        {
274 301
             return true;
275 302
         }
276 303
 
277
-        if (!\is_object($value)) {
304
+        if (!\is_object($value))
305
+        {
278 306
             return false;
279 307
         }
280 308
 
281
-        if (\PHP_VERSION_ID >= 80000) {
309
+        if (\PHP_VERSION_ID >= 80000)
310
+        {
282 311
             return $value instanceof \Stringable;
283 312
         }
284 313
 
Please login to merge, or discard this patch.
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.
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/Storage/StorageBootloader.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
 
37 37
         $app->bindInjector(StorageConfig::class, ConfiguratorInterface::class);
38 38
 
39
-        $app->bindSingleton(StorageInterface::class, static function (StorageConfig $config, CdnInterface $cdn) {
39
+        $app->bindSingleton(StorageInterface::class, static function (StorageConfig $config, CdnInterface $cdn){
40 40
             $manager = new Storage($config->getDefaultBucket());
41 41
 
42 42
             $distributions = $config->getDistributions();
43 43
 
44
-            foreach ($config->getAdapters() as $name => $adapter) {
44
+            foreach ($config->getAdapters() as $name => $adapter){
45 45
                 $resolver = isset($distributions[$name])
46 46
                     ? $cdn->resolver($distributions[$name])
47 47
                     : null;
@@ -52,15 +52,15 @@  discard block
 block discarded – undo
52 52
             return $manager;
53 53
         });
54 54
 
55
-        $app->bindSingleton(Storage::class, static function (StorageInterface $manager) {
55
+        $app->bindSingleton(Storage::class, static function (StorageInterface $manager){
56 56
             return $manager;
57 57
         });
58 58
 
59
-        $app->bindSingleton(BucketInterface::class, static function (StorageInterface $manager) {
59
+        $app->bindSingleton(BucketInterface::class, static function (StorageInterface $manager){
60 60
             return $manager->bucket();
61 61
         });
62 62
 
63
-        $app->bindSingleton(Bucket::class, static function (BucketInterface $storage) {
63
+        $app->bindSingleton(Bucket::class, static function (BucketInterface $storage){
64 64
             return $storage;
65 65
         });
66 66
     }
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,12 +36,14 @@  discard block
 block discarded – undo
36 36
 
37 37
         $app->bindInjector(StorageConfig::class, ConfiguratorInterface::class);
38 38
 
39
-        $app->bindSingleton(StorageInterface::class, static function (StorageConfig $config, CdnInterface $cdn) {
39
+        $app->bindSingleton(StorageInterface::class, static function (StorageConfig $config, CdnInterface $cdn)
40
+        {
40 41
             $manager = new Storage($config->getDefaultBucket());
41 42
 
42 43
             $distributions = $config->getDistributions();
43 44
 
44
-            foreach ($config->getAdapters() as $name => $adapter) {
45
+            foreach ($config->getAdapters() as $name => $adapter)
46
+            {
45 47
                 $resolver = isset($distributions[$name])
46 48
                     ? $cdn->resolver($distributions[$name])
47 49
                     : null;
@@ -52,15 +54,18 @@  discard block
 block discarded – undo
52 54
             return $manager;
53 55
         });
54 56
 
55
-        $app->bindSingleton(Storage::class, static function (StorageInterface $manager) {
57
+        $app->bindSingleton(Storage::class, static function (StorageInterface $manager)
58
+        {
56 59
             return $manager;
57 60
         });
58 61
 
59
-        $app->bindSingleton(BucketInterface::class, static function (StorageInterface $manager) {
62
+        $app->bindSingleton(BucketInterface::class, static function (StorageInterface $manager)
63
+        {
60 64
             return $manager->bucket();
61 65
         });
62 66
 
63
-        $app->bindSingleton(Bucket::class, static function (BucketInterface $storage) {
67
+        $app->bindSingleton(Bucket::class, static function (BucketInterface $storage)
68
+        {
64 69
             return $storage;
65 70
         });
66 71
     }
Please login to merge, or discard this patch.
src/Framework/Bootloader/Storage/StorageConfig.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
      */
103 103
     private function bootStorages(array $config): void
104 104
     {
105
-        foreach ($config['buckets'] as $name => $bucket) {
106
-            if (!\is_string($name)) {
105
+        foreach ($config['buckets'] as $name => $bucket){
106
+            if (!\is_string($name)){
107 107
                 throw new InvalidArgumentException(
108 108
                     \vsprintf('Storage bucket config key must be a string, but %s defined', [
109 109
                         \get_debug_type($name),
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
             }
113 113
 
114 114
             $serverName = $bucket['server'] ?? null;
115
-            if (!\is_string($serverName)) {
115
+            if (!\is_string($serverName)){
116 116
                 throw new InvalidArgumentException(
117 117
                     \vsprintf('Storage bucket `%s.server` config key required and must be a string, but %s defined', [
118 118
                         $name,
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
             }
123 123
 
124 124
             $server = $config['servers'][$serverName] ?? null;
125
-            if (!\is_array($server)) {
125
+            if (!\is_array($server)){
126 126
                 throw new InvalidArgumentException(
127 127
                     \vsprintf('Storage bucket `%s` relates to non-existing server `%s`', [
128 128
                         $name,
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             }
133 133
 
134 134
             $adapter = $server['adapter'] ?? null;
135
-            if (!\is_string($adapter)) {
135
+            if (!\is_string($adapter)){
136 136
                 throw new InvalidArgumentException(
137 137
                     \vsprintf('Storage server `%s.adapter` config key required and must be a string, but %s defined', [
138 138
                         $serverName,
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
             $this->adapters[$name] = $adapter;
147 147
 
148
-            if (isset($bucket['distribution'])) {
148
+            if (isset($bucket['distribution'])){
149 149
                 $this->distributions[$name] = $bucket['distribution'];
150 150
             }
151 151
         }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      */
160 160
     private function createAdapter(string $serverName, array $bucket, array $server): FilesystemAdapter
161 161
     {
162
-        switch ($server['adapter']) {
162
+        switch ($server['adapter']){
163 163
             case 'local':
164 164
                 return $this->createLocalAdapter($serverName, $bucket, $server);
165 165
 
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
         $bucket = $bucket['bucket'] ?? $server['bucket'];
198 198
         $visibility = $bucket['visibility'] ?? $server['bucket'] ?? Visibility::VISIBILITY_PUBLIC;
199 199
 
200
-        if ($async) {
201
-            if (!\class_exists(AsyncAwsS3Adapter::class)) {
200
+        if ($async){
201
+            if (!\class_exists(AsyncAwsS3Adapter::class)){
202 202
                 throw new InvalidArgumentException(
203 203
                     'Can not create async S3 client, please install "league/flysystem-async-aws-s3"'
204 204
                 );
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
             );
215 215
         }
216 216
 
217
-        if (!\class_exists(AwsS3V3Adapter::class)) {
217
+        if (!\class_exists(AwsS3V3Adapter::class)){
218 218
             throw new InvalidArgumentException(
219 219
                 'Can not create S3 client, please install "league/flysystem-aws-s3-v3"'
220 220
             );
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
      */
239 239
     private function createLocalAdapter(string $serverName, array $bucket, array $server): FilesystemAdapter
240 240
     {
241
-        if (!\is_string($server['directory'] ?? null)) {
241
+        if (!\is_string($server['directory'] ?? null)){
242 242
             throw new InvalidArgumentException(
243 243
                 \vsprintf('Storage server `%s.directory` config key required and must be a string, but %s defined', [
244 244
                     $serverName,
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
         $adapter = $server['adapter'];
274 274
         $isFilesystemAdapter = \is_subclass_of($adapter, FilesystemAdapter::class, true);
275 275
 
276
-        if (!$isFilesystemAdapter) {
276
+        if (!$isFilesystemAdapter){
277 277
             throw new InvalidArgumentException(
278 278
                 \vsprintf('Storage server `%s` must be a class string of %s, but `%s` defined', [
279 279
                     $serverName,
@@ -283,9 +283,9 @@  discard block
 block discarded – undo
283 283
             );
284 284
         }
285 285
 
286
-        try {
286
+        try{
287 287
             return new $adapter(...\array_values($server['options'] ?? []));
288
-        } catch (\Throwable $e) {
288
+        }catch (\Throwable $e){
289 289
             $message = 'An error occurred while server `%s` initializing: %s';
290 290
             throw new InvalidArgumentException(\sprintf($message, $serverName, $e->getMessage()), 0, $e);
291 291
         }
Please login to merge, or discard this patch.
Braces   +29 added lines, -14 removed lines patch added patch discarded remove patch
@@ -102,8 +102,10 @@  discard block
 block discarded – undo
102 102
      */
103 103
     private function bootStorages(array $config): void
104 104
     {
105
-        foreach ($config['buckets'] as $name => $bucket) {
106
-            if (!\is_string($name)) {
105
+        foreach ($config['buckets'] as $name => $bucket)
106
+        {
107
+            if (!\is_string($name))
108
+            {
107 109
                 throw new InvalidArgumentException(
108 110
                     \vsprintf('Storage bucket config key must be a string, but %s defined', [
109 111
                         \get_debug_type($name),
@@ -112,7 +114,8 @@  discard block
 block discarded – undo
112 114
             }
113 115
 
114 116
             $serverName = $bucket['server'] ?? null;
115
-            if (!\is_string($serverName)) {
117
+            if (!\is_string($serverName))
118
+            {
116 119
                 throw new InvalidArgumentException(
117 120
                     \vsprintf('Storage bucket `%s.server` config key required and must be a string, but %s defined', [
118 121
                         $name,
@@ -122,7 +125,8 @@  discard block
 block discarded – undo
122 125
             }
123 126
 
124 127
             $server = $config['servers'][$serverName] ?? null;
125
-            if (!\is_array($server)) {
128
+            if (!\is_array($server))
129
+            {
126 130
                 throw new InvalidArgumentException(
127 131
                     \vsprintf('Storage bucket `%s` relates to non-existing server `%s`', [
128 132
                         $name,
@@ -132,7 +136,8 @@  discard block
 block discarded – undo
132 136
             }
133 137
 
134 138
             $adapter = $server['adapter'] ?? null;
135
-            if (!\is_string($adapter)) {
139
+            if (!\is_string($adapter))
140
+            {
136 141
                 throw new InvalidArgumentException(
137 142
                     \vsprintf('Storage server `%s.adapter` config key required and must be a string, but %s defined', [
138 143
                         $serverName,
@@ -145,7 +150,8 @@  discard block
 block discarded – undo
145 150
 
146 151
             $this->adapters[$name] = $adapter;
147 152
 
148
-            if (isset($bucket['distribution'])) {
153
+            if (isset($bucket['distribution']))
154
+            {
149 155
                 $this->distributions[$name] = $bucket['distribution'];
150 156
             }
151 157
         }
@@ -159,7 +165,8 @@  discard block
 block discarded – undo
159 165
      */
160 166
     private function createAdapter(string $serverName, array $bucket, array $server): FilesystemAdapter
161 167
     {
162
-        switch ($server['adapter']) {
168
+        switch ($server['adapter'])
169
+        {
163 170
             case 'local':
164 171
                 return $this->createLocalAdapter($serverName, $bucket, $server);
165 172
 
@@ -197,8 +204,10 @@  discard block
 block discarded – undo
197 204
         $bucket = $bucket['bucket'] ?? $server['bucket'];
198 205
         $visibility = $bucket['visibility'] ?? $server['bucket'] ?? Visibility::VISIBILITY_PUBLIC;
199 206
 
200
-        if ($async) {
201
-            if (!\class_exists(AsyncAwsS3Adapter::class)) {
207
+        if ($async)
208
+        {
209
+            if (!\class_exists(AsyncAwsS3Adapter::class))
210
+            {
202 211
                 throw new InvalidArgumentException(
203 212
                     'Can not create async S3 client, please install "league/flysystem-async-aws-s3"'
204 213
                 );
@@ -214,7 +223,8 @@  discard block
 block discarded – undo
214 223
             );
215 224
         }
216 225
 
217
-        if (!\class_exists(AwsS3V3Adapter::class)) {
226
+        if (!\class_exists(AwsS3V3Adapter::class))
227
+        {
218 228
             throw new InvalidArgumentException(
219 229
                 'Can not create S3 client, please install "league/flysystem-aws-s3-v3"'
220 230
             );
@@ -238,7 +248,8 @@  discard block
 block discarded – undo
238 248
      */
239 249
     private function createLocalAdapter(string $serverName, array $bucket, array $server): FilesystemAdapter
240 250
     {
241
-        if (!\is_string($server['directory'] ?? null)) {
251
+        if (!\is_string($server['directory'] ?? null))
252
+        {
242 253
             throw new InvalidArgumentException(
243 254
                 \vsprintf('Storage server `%s.directory` config key required and must be a string, but %s defined', [
244 255
                     $serverName,
@@ -273,7 +284,8 @@  discard block
 block discarded – undo
273 284
         $adapter = $server['adapter'];
274 285
         $isFilesystemAdapter = \is_subclass_of($adapter, FilesystemAdapter::class, true);
275 286
 
276
-        if (!$isFilesystemAdapter) {
287
+        if (!$isFilesystemAdapter)
288
+        {
277 289
             throw new InvalidArgumentException(
278 290
                 \vsprintf('Storage server `%s` must be a class string of %s, but `%s` defined', [
279 291
                     $serverName,
@@ -283,9 +295,12 @@  discard block
 block discarded – undo
283 295
             );
284 296
         }
285 297
 
286
-        try {
298
+        try
299
+        {
287 300
             return new $adapter(...\array_values($server['options'] ?? []));
288
-        } catch (\Throwable $e) {
301
+        }
302
+        catch (\Throwable $e)
303
+        {
289 304
             $message = 'An error occurred while server `%s` initializing: %s';
290 305
             throw new InvalidArgumentException(\sprintf($message, $serverName, $e->getMessage()), 0, $e);
291 306
         }
Please login to merge, or discard this patch.