Passed
Pull Request — master (#944)
by Aleksei
08:14
created
src/Stempler/src/Compiler/Renderer/CoreRenderer.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
         Compiler\Result $result,
22 22
         NodeInterface $node
23 23
     ): bool {
24
-        switch (true) {
24
+        switch (true){
25 25
             case $node instanceof Hidden:
26 26
                 return true;
27 27
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
                 $result->withinContext(
30 30
                     $node->getContext(),
31 31
                     function (Compiler\Result $source) use ($node, $compiler): void {
32
-                        foreach ($node->nodes as $child) {
32
+                        foreach ($node->nodes as $child){
33 33
                             $compiler->compile($child, $source);
34 34
                         }
35 35
                     }
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
                 $result->withinContext(
42 42
                     $node->getContext(),
43 43
                     function (Compiler\Result $source) use ($node, $compiler): void {
44
-                        foreach ($node->nodes as $child) {
45
-                            if (\is_string($child)) {
44
+                        foreach ($node->nodes as $child){
45
+                            if (\is_string($child)){
46 46
                                 $source->push($child, null);
47 47
                                 continue;
48 48
                             }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,7 +21,8 @@  discard block
 block discarded – undo
21 21
         Compiler\Result $result,
22 22
         NodeInterface $node
23 23
     ): bool {
24
-        switch (true) {
24
+        switch (true)
25
+        {
25 26
             case $node instanceof Hidden:
26 27
                 return true;
27 28
 
@@ -29,7 +30,8 @@  discard block
 block discarded – undo
29 30
                 $result->withinContext(
30 31
                     $node->getContext(),
31 32
                     function (Compiler\Result $source) use ($node, $compiler): void {
32
-                        foreach ($node->nodes as $child) {
33
+                        foreach ($node->nodes as $child)
34
+                        {
33 35
                             $compiler->compile($child, $source);
34 36
                         }
35 37
                     }
@@ -41,8 +43,10 @@  discard block
 block discarded – undo
41 43
                 $result->withinContext(
42 44
                     $node->getContext(),
43 45
                     function (Compiler\Result $source) use ($node, $compiler): void {
44
-                        foreach ($node->nodes as $child) {
45
-                            if (\is_string($child)) {
46
+                        foreach ($node->nodes as $child)
47
+                        {
48
+                            if (\is_string($child))
49
+                            {
46 50
                                 $source->push($child, null);
47 51
                                 continue;
48 52
                             }
Please login to merge, or discard this patch.
src/Stempler/src/Compiler/Renderer/DynamicRenderer.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
     public function __construct(
20 20
         private readonly ?DirectiveRendererInterface $directiveRenderer = null,
21 21
         private readonly string $defaultFilter = self::DEFAULT_FILTER
22
-    ) {
22
+    ){
23 23
     }
24 24
 
25 25
     public function render(Compiler $compiler, Compiler\Result $result, NodeInterface $node): bool
26 26
     {
27
-        switch (true) {
27
+        switch (true){
28 28
             case $node instanceof Output:
29 29
                 $this->output($result, $node);
30 30
                 return true;
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
      */
42 42
     private function directive(Compiler\Result $source, Directive $directive): void
43 43
     {
44
-        if ($this->directiveRenderer !== null) {
44
+        if ($this->directiveRenderer !== null){
45 45
             $result = $this->directiveRenderer->render($directive);
46
-            if ($result !== null) {
46
+            if ($result !== null){
47 47
                 $source->push($result, $directive->getContext());
48 48
                 return;
49 49
             }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
     private function output(Compiler\Result $source, Output $output): void
59 59
     {
60
-        if ($output->rawOutput) {
60
+        if ($output->rawOutput){
61 61
             $source->push(\sprintf('<?php echo %s; ?>', \trim($output->body)), $output->getContext());
62 62
             return;
63 63
         }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,7 +24,8 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function render(Compiler $compiler, Compiler\Result $result, NodeInterface $node): bool
26 26
     {
27
-        switch (true) {
27
+        switch (true)
28
+        {
28 29
             case $node instanceof Output:
29 30
                 $this->output($result, $node);
30 31
                 return true;
@@ -41,9 +42,11 @@  discard block
 block discarded – undo
41 42
      */
42 43
     private function directive(Compiler\Result $source, Directive $directive): void
43 44
     {
44
-        if ($this->directiveRenderer !== null) {
45
+        if ($this->directiveRenderer !== null)
46
+        {
45 47
             $result = $this->directiveRenderer->render($directive);
46
-            if ($result !== null) {
48
+            if ($result !== null)
49
+            {
47 50
                 $source->push($result, $directive->getContext());
48 51
                 return;
49 52
             }
@@ -57,7 +60,8 @@  discard block
 block discarded – undo
57 60
 
58 61
     private function output(Compiler\Result $source, Output $output): void
59 62
     {
60
-        if ($output->rawOutput) {
63
+        if ($output->rawOutput)
64
+        {
61 65
             $source->push(\sprintf('<?php echo %s; ?>', \trim($output->body)), $output->getContext());
62 66
             return;
63 67
         }
Please login to merge, or discard this patch.
src/Stempler/src/Compiler/SourceMap.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
     {
39 39
         $paths = [];
40 40
 
41
-        foreach ($this->lines as $line) {
42
-            if (!\in_array($this->paths[$line[0]], $paths, true)) {
41
+        foreach ($this->lines as $line){
42
+            if (!\in_array($this->paths[$line[0]], $paths, true)){
43 43
                 $paths[] = $this->paths[$line[0]];
44 44
             }
45 45
         }
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
     public function getStack(int $line): array
55 55
     {
56 56
         $found = null;
57
-        foreach ($this->lines as $linen => $ctx) {
58
-            if ($linen <= $line) {
57
+        foreach ($this->lines as $linen => $ctx){
58
+            if ($linen <= $line){
59 59
                 $found = $ctx;
60 60
             }
61 61
         }
62 62
 
63
-        if ($found === null) {
63
+        if ($found === null){
64 64
             return [];
65 65
         }
66 66
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     /**
74 74
      * Compress.
75 75
      */
76
-    public function serialize(): string|false
76
+    public function serialize(): string | false
77 77
     {
78 78
         return \json_encode($this->__serialize());
79 79
     }
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
     {
88 88
         $map = new self();
89 89
 
90
-        foreach ($locations as $offset => $location) {
90
+        foreach ($locations as $offset => $location){
91 91
             $line = Source::resolveLine($content, $offset);
92
-            if (!isset($map->lines[$line])) {
92
+            if (!isset($map->lines[$line])){
93 93
                 $map->lines[$line] = $map->calculateLine($location, $loader);
94 94
             }
95 95
         }
@@ -106,19 +106,19 @@  discard block
 block discarded – undo
106 106
             'line' => $line[1],
107 107
         ];
108 108
 
109
-        if ($line[2] !== null) {
109
+        if ($line[2] !== null){
110 110
             $this->unpack($result, $line[2]);
111 111
         }
112 112
     }
113 113
 
114 114
     private function calculateLine(Location $location, LoaderInterface $loader): array
115 115
     {
116
-        if (!isset($this->sourceCache[$location->path])) {
116
+        if (!isset($this->sourceCache[$location->path])){
117 117
             $this->sourceCache[$location->path] = $loader->load($location->path);
118 118
         }
119 119
         $path = $this->sourceCache[$location->path]->getFilename();
120 120
 
121
-        if (!\in_array($path, $this->paths, true)) {
121
+        if (!\in_array($path, $this->paths, true)){
122 122
             $this->paths[] = $path;
123 123
         }
124 124
 
Please login to merge, or discard this patch.
Braces   +20 added lines, -10 removed lines patch added patch discarded remove patch
@@ -38,8 +38,10 @@  discard block
 block discarded – undo
38 38
     {
39 39
         $paths = [];
40 40
 
41
-        foreach ($this->lines as $line) {
42
-            if (!\in_array($this->paths[$line[0]], $paths, true)) {
41
+        foreach ($this->lines as $line)
42
+        {
43
+            if (!\in_array($this->paths[$line[0]], $paths, true))
44
+            {
43 45
                 $paths[] = $this->paths[$line[0]];
44 46
             }
45 47
         }
@@ -54,13 +56,16 @@  discard block
 block discarded – undo
54 56
     public function getStack(int $line): array
55 57
     {
56 58
         $found = null;
57
-        foreach ($this->lines as $linen => $ctx) {
58
-            if ($linen <= $line) {
59
+        foreach ($this->lines as $linen => $ctx)
60
+        {
61
+            if ($linen <= $line)
62
+            {
59 63
                 $found = $ctx;
60 64
             }
61 65
         }
62 66
 
63
-        if ($found === null) {
67
+        if ($found === null)
68
+        {
64 69
             return [];
65 70
         }
66 71
 
@@ -87,9 +92,11 @@  discard block
 block discarded – undo
87 92
     {
88 93
         $map = new self();
89 94
 
90
-        foreach ($locations as $offset => $location) {
95
+        foreach ($locations as $offset => $location)
96
+        {
91 97
             $line = Source::resolveLine($content, $offset);
92
-            if (!isset($map->lines[$line])) {
98
+            if (!isset($map->lines[$line]))
99
+            {
93 100
                 $map->lines[$line] = $map->calculateLine($location, $loader);
94 101
             }
95 102
         }
@@ -106,19 +113,22 @@  discard block
 block discarded – undo
106 113
             'line' => $line[1],
107 114
         ];
108 115
 
109
-        if ($line[2] !== null) {
116
+        if ($line[2] !== null)
117
+        {
110 118
             $this->unpack($result, $line[2]);
111 119
         }
112 120
     }
113 121
 
114 122
     private function calculateLine(Location $location, LoaderInterface $loader): array
115 123
     {
116
-        if (!isset($this->sourceCache[$location->path])) {
124
+        if (!isset($this->sourceCache[$location->path]))
125
+        {
117 126
             $this->sourceCache[$location->path] = $loader->load($location->path);
118 127
         }
119 128
         $path = $this->sourceCache[$location->path]->getFilename();
120 129
 
121
-        if (!\in_array($path, $this->paths, true)) {
130
+        if (!\in_array($path, $this->paths, true))
131
+        {
122 132
             $this->paths[] = $path;
123 133
         }
124 134
 
Please login to merge, or discard this patch.
src/Stempler/src/Compiler/Result.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,22 +24,22 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function withinContext(?Context $ctx, callable $body): void
26 26
     {
27
-        if ($ctx === null || $ctx->getPath() === null) {
27
+        if ($ctx === null || $ctx->getPath() === null){
28 28
             $body($this);
29 29
             return;
30 30
         }
31 31
 
32
-        try {
32
+        try{
33 33
             $this->parent = Location::fromContext($ctx, $this->parent);
34 34
             $body($this);
35
-        } finally {
35
+        }finally{
36 36
             $this->parent = $this->parent->parent;
37 37
         }
38 38
     }
39 39
 
40 40
     public function push(string $content, Context $ctx = null): void
41 41
     {
42
-        if ($ctx !== null && $ctx->getPath() !== null) {
42
+        if ($ctx !== null && $ctx->getPath() !== null){
43 43
             $this->locations[\strlen($this->content)] = Location::fromContext($ctx, $this->parent);
44 44
         }
45 45
 
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
         $paths = [];
60 60
 
61 61
         // We can scan top level only
62
-        foreach ($this->locations as $loc) {
63
-            if (!\in_array($loc->path, $paths, true)) {
62
+        foreach ($this->locations as $loc){
63
+            if (!\in_array($loc->path, $paths, true)){
64 64
                 $paths[] = $loc->path;
65 65
             }
66 66
         }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     {
76 76
         $locations = [];
77 77
 
78
-        foreach ($this->locations as $offset => $location) {
78
+        foreach ($this->locations as $offset => $location){
79 79
             $locations[$offset] = $location;
80 80
         }
81 81
 
Please login to merge, or discard this patch.
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,22 +24,27 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function withinContext(?Context $ctx, callable $body): void
26 26
     {
27
-        if ($ctx === null || $ctx->getPath() === null) {
27
+        if ($ctx === null || $ctx->getPath() === null)
28
+        {
28 29
             $body($this);
29 30
             return;
30 31
         }
31 32
 
32
-        try {
33
+        try
34
+        {
33 35
             $this->parent = Location::fromContext($ctx, $this->parent);
34 36
             $body($this);
35
-        } finally {
37
+        }
38
+        finally
39
+        {
36 40
             $this->parent = $this->parent->parent;
37 41
         }
38 42
     }
39 43
 
40 44
     public function push(string $content, Context $ctx = null): void
41 45
     {
42
-        if ($ctx !== null && $ctx->getPath() !== null) {
46
+        if ($ctx !== null && $ctx->getPath() !== null)
47
+        {
43 48
             $this->locations[\strlen($this->content)] = Location::fromContext($ctx, $this->parent);
44 49
         }
45 50
 
@@ -59,8 +64,10 @@  discard block
 block discarded – undo
59 64
         $paths = [];
60 65
 
61 66
         // We can scan top level only
62
-        foreach ($this->locations as $loc) {
63
-            if (!\in_array($loc->path, $paths, true)) {
67
+        foreach ($this->locations as $loc)
68
+        {
69
+            if (!\in_array($loc->path, $paths, true))
70
+            {
64 71
                 $paths[] = $loc->path;
65 72
             }
66 73
         }
@@ -75,7 +82,8 @@  discard block
 block discarded – undo
75 82
     {
76 83
         $locations = [];
77 84
 
78
-        foreach ($this->locations as $offset => $location) {
85
+        foreach ($this->locations as $offset => $location)
86
+        {
79 87
             $locations[$offset] = $location;
80 88
         }
81 89
 
Please login to merge, or discard this patch.
src/Stempler/src/Compiler/Location.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
         public int $offset,
17 17
         public ?string $grammar = null,
18 18
         public ?Location $parent = null
19
-    ) {
19
+    ){
20 20
     }
21 21
 
22 22
     public static function fromContext(Context $context, ?Location $parent = null): Location
Please login to merge, or discard this patch.
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['bucket'] ?? 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['bucket'] ?? 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.
src/Storage/src/Bucket.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
         protected FilesystemOperator $fs,
22 22
         protected ?string $name = null,
23 23
         protected ?UriResolverInterface $resolver = null
24
-    ) {
24
+    ){
25 25
     }
26 26
 
27 27
     public function getName(): ?string
Please login to merge, or discard this patch.
src/Storage/src/StorageInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
     /**
29 29
      * @throws InvalidArgumentException
30 30
      */
31
-    public function file(string|\Stringable $id): FileInterface;
31
+    public function file(string | \Stringable $id): FileInterface;
32 32
 
33 33
     public function withDefault(string $name): self;
34 34
 }
Please login to merge, or discard this patch.
src/Storage/src/Storage.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
     {
56 56
         $name ??= $this->default;
57 57
 
58
-        if (!isset($this->buckets[$name])) {
58
+        if (!isset($this->buckets[$name])){
59 59
             throw new InvalidArgumentException(\sprintf(self::ERROR_NOT_FOUND, $name));
60 60
         }
61 61
 
62 62
         return $this->buckets[$name];
63 63
     }
64 64
 
65
-    public function file(string|\Stringable $id): FileInterface
65
+    public function file(string | \Stringable $id): FileInterface
66 66
     {
67 67
         [$bucket, $file] = $this->parseUri($id);
68 68
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
     public function add(string $name, BucketInterface $storage, bool $overwrite = false): void
73 73
     {
74
-        if (!$overwrite && isset($this->buckets[$name])) {
74
+        if (!$overwrite && isset($this->buckets[$name])){
75 75
             throw new \InvalidArgumentException(\sprintf(self::ERROR_REDEFINITION, $name));
76 76
         }
77 77
 
@@ -92,35 +92,35 @@  discard block
 block discarded – undo
92 92
      * @return array{0: string|null, 1: string}
93 93
      * @throws InvalidArgumentException
94 94
      */
95
-    protected function parseUri(string|\Stringable $uri, bool $withScheme = true): array
95
+    protected function parseUri(string | \Stringable $uri, bool $withScheme = true): array
96 96
     {
97 97
         $uri = $this->uriToString($uri);
98 98
         $result = \parse_url($uri);
99 99
 
100
-        if ($result === false) {
100
+        if ($result === false){
101 101
             $message = 'URI argument must be a valid URI in "[STORAGE]://[PATH_TO_FILE]" format, but `%s` given';
102 102
             throw new InvalidArgumentException(\sprintf($message, $uri));
103 103
         }
104 104
 
105
-        if (!isset($result['scheme'])) {
105
+        if (!isset($result['scheme'])){
106 106
             $result['scheme'] = $withScheme ? $this->default : null;
107 107
         }
108 108
 
109
-        if (!isset($result['host'])) {
109
+        if (!isset($result['host'])){
110 110
             $result['host'] = '';
111 111
         }
112 112
 
113 113
         return [
114 114
             $result['scheme'] ?? null,
115
-            $result['host'] . \rtrim($result['path'] ?? '', '/'),
115
+            $result['host'].\rtrim($result['path'] ?? '', '/'),
116 116
         ];
117 117
     }
118 118
 
119
-    private function uriToString(string|\Stringable $uri): string
119
+    private function uriToString(string | \Stringable $uri): string
120 120
     {
121 121
         return match (true) {
122 122
             \is_string($uri) => $uri,
123
-            default => (string) $uri
123
+            default => (string)$uri
124 124
         };
125 125
     }
126 126
 }
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,7 +55,8 @@  discard block
 block discarded – undo
55 55
     {
56 56
         $name ??= $this->default;
57 57
 
58
-        if (!isset($this->buckets[$name])) {
58
+        if (!isset($this->buckets[$name]))
59
+        {
59 60
             throw new InvalidArgumentException(\sprintf(self::ERROR_NOT_FOUND, $name));
60 61
         }
61 62
 
@@ -71,7 +72,8 @@  discard block
 block discarded – undo
71 72
 
72 73
     public function add(string $name, BucketInterface $storage, bool $overwrite = false): void
73 74
     {
74
-        if (!$overwrite && isset($this->buckets[$name])) {
75
+        if (!$overwrite && isset($this->buckets[$name]))
76
+        {
75 77
             throw new \InvalidArgumentException(\sprintf(self::ERROR_REDEFINITION, $name));
76 78
         }
77 79
 
@@ -97,16 +99,19 @@  discard block
 block discarded – undo
97 99
         $uri = $this->uriToString($uri);
98 100
         $result = \parse_url($uri);
99 101
 
100
-        if ($result === false) {
102
+        if ($result === false)
103
+        {
101 104
             $message = 'URI argument must be a valid URI in "[STORAGE]://[PATH_TO_FILE]" format, but `%s` given';
102 105
             throw new InvalidArgumentException(\sprintf($message, $uri));
103 106
         }
104 107
 
105
-        if (!isset($result['scheme'])) {
108
+        if (!isset($result['scheme']))
109
+        {
106 110
             $result['scheme'] = $withScheme ? $this->default : null;
107 111
         }
108 112
 
109
-        if (!isset($result['host'])) {
113
+        if (!isset($result['host']))
114
+        {
110 115
             $result['host'] = '';
111 116
         }
112 117
 
Please login to merge, or discard this patch.