Passed
Push — master ( e1a877...53fca2 )
by Aleksei
14:14 queued 02:22
created
src/Boot/tests/DirectoriesTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 
26 26
         $this->assertDir(__DIR__, $dirs->get('root'));
27 27
 
28
-        $this->assertDir(__DIR__ . '/app', $dirs->get('app'));
28
+        $this->assertDir(__DIR__.'/app', $dirs->get('app'));
29 29
 
30
-        $this->assertDir(__DIR__ . '/public', $dirs->get('public'));
30
+        $this->assertDir(__DIR__.'/public', $dirs->get('public'));
31 31
 
32
-        $this->assertDir(__DIR__ . '/app/config', $dirs->get('config'));
33
-        $this->assertDir(__DIR__ . '/app/resources', $dirs->get('resources'));
32
+        $this->assertDir(__DIR__.'/app/config', $dirs->get('config'));
33
+        $this->assertDir(__DIR__.'/app/resources', $dirs->get('resources'));
34 34
 
35
-        $this->assertDir(__DIR__ . '/runtime', $dirs->get('runtime'));
36
-        $this->assertDir(__DIR__ . '/runtime/cache', $dirs->get('cache'));
35
+        $this->assertDir(__DIR__.'/runtime', $dirs->get('runtime'));
36
+        $this->assertDir(__DIR__.'/runtime/cache', $dirs->get('cache'));
37 37
     }
38 38
 
39 39
     public function testKernelException(): void
@@ -94,6 +94,6 @@  discard block
 block discarded – undo
94 94
     private function assertDir($path, $value): void
95 95
     {
96 96
         $path = \str_replace(['\\', '//'], '/', $path);
97
-        self::assertSame(\rtrim($path, '/') . '/', $value);
97
+        self::assertSame(\rtrim($path, '/').'/', $value);
98 98
     }
99 99
 }
Please login to merge, or discard this patch.
src/Boot/src/helpers.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 use Spiral\Core\ContainerScope;
10 10
 use Spiral\Core\Exception\ScopeException;
11 11
 
12
-if (!\function_exists('spiral')) {
12
+if (!\function_exists('spiral')){
13 13
     /**
14 14
      * Resolve given alias in current IoC scope.
15 15
      *
@@ -22,19 +22,19 @@  discard block
 block discarded – undo
22 22
      */
23 23
     function spiral(string $alias): mixed
24 24
     {
25
-        if (ContainerScope::getContainer() === null) {
25
+        if (ContainerScope::getContainer() === null){
26 26
             throw new ScopeException('Container scope was not set.');
27 27
         }
28 28
 
29
-        try {
29
+        try{
30 30
             return ContainerScope::getContainer()->get($alias);
31
-        } catch (ContainerExceptionInterface $e) {
31
+        }catch (ContainerExceptionInterface $e){
32 32
             throw new ScopeException($e->getMessage(), $e->getCode(), $e);
33 33
         }
34 34
     }
35 35
 }
36 36
 
37
-if (!\function_exists('directory')) {
37
+if (!\function_exists('directory')){
38 38
     /**
39 39
      * Get directory alias value. Uses application core from the current global scope.
40 40
      *
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     }
50 50
 }
51 51
 
52
-if (!\function_exists('env')) {
52
+if (!\function_exists('env')){
53 53
     /**
54 54
      * Gets the value of an environment variable. Uses application core from the current global scope.
55 55
      *
Please login to merge, or discard this patch.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,7 +9,8 @@  discard block
 block discarded – undo
9 9
 use Spiral\Core\ContainerScope;
10 10
 use Spiral\Core\Exception\ScopeException;
11 11
 
12
-if (!\function_exists('spiral')) {
12
+if (!\function_exists('spiral'))
13
+{
13 14
     /**
14 15
      * Resolve given alias in current IoC scope.
15 16
      *
@@ -22,19 +23,24 @@  discard block
 block discarded – undo
22 23
      */
23 24
     function spiral(string $alias): mixed
24 25
     {
25
-        if (ContainerScope::getContainer() === null) {
26
+        if (ContainerScope::getContainer() === null)
27
+        {
26 28
             throw new ScopeException('Container scope was not set.');
27 29
         }
28 30
 
29
-        try {
31
+        try
32
+        {
30 33
             return ContainerScope::getContainer()->get($alias);
31
-        } catch (ContainerExceptionInterface $e) {
34
+        }
35
+        catch (ContainerExceptionInterface $e)
36
+        {
32 37
             throw new ScopeException($e->getMessage(), $e->getCode(), $e);
33 38
         }
34 39
     }
35 40
 }
36 41
 
37
-if (!\function_exists('directory')) {
42
+if (!\function_exists('directory'))
43
+{
38 44
     /**
39 45
      * Get directory alias value. Uses application core from the current global scope.
40 46
      *
@@ -49,7 +55,8 @@  discard block
 block discarded – undo
49 55
     }
50 56
 }
51 57
 
52
-if (!\function_exists('env')) {
58
+if (!\function_exists('env'))
59
+{
53 60
     /**
54 61
      * Gets the value of an environment variable. Uses application core from the current global scope.
55 62
      *
Please login to merge, or discard this patch.
src/Files/tests/InformationTest.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     public function testTime(): void
14 14
     {
15 15
         $files = new Files();
16
-        $filename = self::FIXTURE_DIRECTORY . '/test.txt';
16
+        $filename = self::FIXTURE_DIRECTORY.'/test.txt';
17 17
 
18 18
         $files->write($filename, 'data', FilesInterface::READONLY);
19 19
         self::assertEquals(\filemtime($filename), $files->time($filename));
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         $this->expectException(FileNotFoundException::class);
26 26
 
27 27
         $files = new Files();
28
-        $filename = self::FIXTURE_DIRECTORY . '/test.txt';
28
+        $filename = self::FIXTURE_DIRECTORY.'/test.txt';
29 29
 
30 30
         $files->time($filename);
31 31
     }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     public function testMD5(): void
34 34
     {
35 35
         $files = new Files();
36
-        $filename = self::FIXTURE_DIRECTORY . '/test.txt';
36
+        $filename = self::FIXTURE_DIRECTORY.'/test.txt';
37 37
 
38 38
         $files->write($filename, 'data');
39 39
         self::assertEquals(\md5_file($filename), $files->md5($filename));
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         $this->expectException(FileNotFoundException::class);
47 47
 
48 48
         $files = new Files();
49
-        $filename = self::FIXTURE_DIRECTORY . '/test.txt';
49
+        $filename = self::FIXTURE_DIRECTORY.'/test.txt';
50 50
 
51 51
         $files->md5($filename);
52 52
     }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     public function testExists(): void
64 64
     {
65 65
         $files = new Files();
66
-        $filename = self::FIXTURE_DIRECTORY . '/test.txt';
66
+        $filename = self::FIXTURE_DIRECTORY.'/test.txt';
67 67
 
68 68
         self::assertFalse($files->exists($filename));
69 69
         self::assertSame(\file_exists($filename), $files->exists($filename));
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     public function testSize(): void
77 77
     {
78 78
         $files = new Files();
79
-        $filename = self::FIXTURE_DIRECTORY . '/test.txt';
79
+        $filename = self::FIXTURE_DIRECTORY.'/test.txt';
80 80
 
81 81
         self::assertFalse($files->exists($filename));
82 82
         $files->write($filename, 'some-data-string');
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         $this->expectException(FileNotFoundException::class);
92 92
 
93 93
         $files = new Files();
94
-        $filename = self::FIXTURE_DIRECTORY . '/test.txt';
94
+        $filename = self::FIXTURE_DIRECTORY.'/test.txt';
95 95
 
96 96
         self::assertFalse($files->exists($filename));
97 97
         $files->size($filename);
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     public function testLocalUri(): void
101 101
     {
102 102
         $files = new Files();
103
-        $filename = self::FIXTURE_DIRECTORY . '/test.txt';
103
+        $filename = self::FIXTURE_DIRECTORY.'/test.txt';
104 104
 
105 105
         self::assertFalse($files->exists($filename));
106 106
         $files->write($filename, 'data');
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     public function testIsFile(): void
111 111
     {
112 112
         $files = new Files();
113
-        $filename = self::FIXTURE_DIRECTORY . '/test.txt';
113
+        $filename = self::FIXTURE_DIRECTORY.'/test.txt';
114 114
 
115 115
         self::assertFalse($files->exists($filename));
116 116
         $files->write($filename, 'data');
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     public function testIsMissingFile(): void
127 127
     {
128 128
         $files = new Files();
129
-        $filename = self::FIXTURE_DIRECTORY . '/test.txt';
129
+        $filename = self::FIXTURE_DIRECTORY.'/test.txt';
130 130
 
131 131
         self::assertFalse($files->exists($filename));
132 132
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     public function testIsDirectory(): void
141 141
     {
142 142
         $files = new Files();
143
-        $directory = self::FIXTURE_DIRECTORY . '/directory/';
143
+        $directory = self::FIXTURE_DIRECTORY.'/directory/';
144 144
 
145 145
         self::assertFalse($files->exists($directory));
146 146
         $files->ensureDirectory($directory);
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     public function testIsMissingDirectory(): void
157 157
     {
158 158
         $files = new Files();
159
-        $directory = self::FIXTURE_DIRECTORY . '/directory/';
159
+        $directory = self::FIXTURE_DIRECTORY.'/directory/';
160 160
 
161 161
         self::assertFalse($files->exists($directory));
162 162
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     public function testIsDirectoryNoSlash(): void
171 171
     {
172 172
         $files = new Files();
173
-        $directory = self::FIXTURE_DIRECTORY . '/directory';
173
+        $directory = self::FIXTURE_DIRECTORY.'/directory';
174 174
 
175 175
         self::assertFalse($files->exists($directory));
176 176
         $files->ensureDirectory($directory);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
         $files = new Files();
16 16
         $filename = self::FIXTURE_DIRECTORY . '/test.txt';
17 17
 
18
-        $files->write($filename, 'data', FilesInterface::READONLY);
18
+        $files->write($filename, 'data', FilesInterface::readonly);
19 19
         self::assertEquals(\filemtime($filename), $files->time($filename));
20 20
     }
21 21
 
Please login to merge, or discard this patch.
src/Files/tests/DirectoriesTest.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     public function testEnsureDirectory(): void
14 14
     {
15 15
         $files = new Files();
16
-        $directory = self::FIXTURE_DIRECTORY . 'directory/';
16
+        $directory = self::FIXTURE_DIRECTORY.'directory/';
17 17
 
18 18
         self::assertFalse($files->exists($directory));
19 19
         self::assertFalse($files->isDirectory($directory));
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     public function testEnsureExistedDirectory(): void
28 28
     {
29 29
         $files = new Files();
30
-        $directory = self::FIXTURE_DIRECTORY . 'directory/';
30
+        $directory = self::FIXTURE_DIRECTORY.'directory/';
31 31
 
32 32
         self::assertFalse($files->exists($directory));
33 33
         self::assertFalse($files->isDirectory($directory));
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     public function testEnsureNestedDirectory(): void
47 47
     {
48 48
         $files = new Files();
49
-        $directory = self::FIXTURE_DIRECTORY . 'directory/sub/other';
49
+        $directory = self::FIXTURE_DIRECTORY.'directory/sub/other';
50 50
 
51 51
         self::assertFalse($files->exists($directory));
52 52
         self::assertFalse($files->isDirectory($directory));
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     public function testEnsureNestedDirectoryNoRecursivePermissions(): void
61 61
     {
62 62
         $files = new Files();
63
-        $directory = self::FIXTURE_DIRECTORY . 'directory/sub/other';
63
+        $directory = self::FIXTURE_DIRECTORY.'directory/sub/other';
64 64
 
65 65
         self::assertFalse($files->exists($directory));
66 66
         self::assertFalse($files->isDirectory($directory));
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
     public function testEnsureExistedNestedDirectory(): void
75 75
     {
76 76
         $files = new Files();
77
-        $directory = self::FIXTURE_DIRECTORY . 'directory/sub/other';
77
+        $directory = self::FIXTURE_DIRECTORY.'directory/sub/other';
78 78
 
79 79
         self::assertFalse($files->exists($directory));
80 80
         self::assertFalse($files->isDirectory($directory));
81 81
 
82
-        \mkdir(self::FIXTURE_DIRECTORY . 'directory');
83
-        \mkdir(self::FIXTURE_DIRECTORY . 'directory/sub');
84
-        \mkdir(self::FIXTURE_DIRECTORY . 'directory/sub/other');
82
+        \mkdir(self::FIXTURE_DIRECTORY.'directory');
83
+        \mkdir(self::FIXTURE_DIRECTORY.'directory/sub');
84
+        \mkdir(self::FIXTURE_DIRECTORY.'directory/sub/other');
85 85
 
86 86
         self::assertTrue($files->exists($directory));
87 87
         self::assertTrue($files->isDirectory($directory));
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
     public function testDeleteDirectoryContent(): void
96 96
     {
97 97
         $files = new Files();
98
-        $baseDirectory = self::FIXTURE_DIRECTORY . 'directory/';
99
-        $directory = $baseDirectory . 'sub/other';
98
+        $baseDirectory = self::FIXTURE_DIRECTORY.'directory/';
99
+        $directory = $baseDirectory.'sub/other';
100 100
 
101 101
         $filenames = [
102
-            $baseDirectory . 'test.file',
103
-            $directory . 'other.file',
104
-            $directory . '.sample',
102
+            $baseDirectory.'test.file',
103
+            $directory.'other.file',
104
+            $directory.'.sample',
105 105
         ];
106 106
 
107 107
         self::assertFalse($files->exists($baseDirectory));
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
         self::assertTrue($files->exists($directory));
119 119
         self::assertTrue($files->isDirectory($directory));
120 120
 
121
-        foreach ($filenames as $filename) {
121
+        foreach ($filenames as $filename){
122 122
             self::assertFalse($files->exists($filename));
123 123
             $files->write($filename, 'random-data');
124 124
             self::assertTrue($files->exists($filename));
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         self::assertFalse($files->exists($directory));
133 133
         self::assertFalse($files->isDirectory($directory));
134 134
 
135
-        foreach ($filenames as $filename) {
135
+        foreach ($filenames as $filename){
136 136
             self::assertFalse($files->exists($filename));
137 137
         }
138 138
     }
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
     public function testDeleteDirectory(): void
141 141
     {
142 142
         $files = new Files();
143
-        $baseDirectory = self::FIXTURE_DIRECTORY . 'directory/';
144
-        $directory = $baseDirectory . 'sub/other';
143
+        $baseDirectory = self::FIXTURE_DIRECTORY.'directory/';
144
+        $directory = $baseDirectory.'sub/other';
145 145
 
146 146
         $filenames = [
147
-            $baseDirectory . 'test.file',
148
-            $directory . 'other.file',
149
-            $directory . '.sample',
147
+            $baseDirectory.'test.file',
148
+            $directory.'other.file',
149
+            $directory.'.sample',
150 150
         ];
151 151
 
152 152
         self::assertFalse($files->exists($baseDirectory));
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         self::assertTrue($files->exists($directory));
164 164
         self::assertTrue($files->isDirectory($directory));
165 165
 
166
-        foreach ($filenames as $filename) {
166
+        foreach ($filenames as $filename){
167 167
             self::assertFalse($files->exists($filename));
168 168
             $files->write($filename, 'random-data');
169 169
             self::assertTrue($files->exists($filename));
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         self::assertFalse($files->exists($directory));
178 178
         self::assertFalse($files->isDirectory($directory));
179 179
 
180
-        foreach ($filenames as $filename) {
180
+        foreach ($filenames as $filename){
181 181
             self::assertFalse($files->exists($filename));
182 182
         }
183 183
     }
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
 
189 189
         $files = new Files();
190 190
 
191
-        $files->write(self::FIXTURE_DIRECTORY . 'test', 'data');
192
-        $files->deleteDirectory(self::FIXTURE_DIRECTORY . 'test');
191
+        $files->write(self::FIXTURE_DIRECTORY.'test', 'data');
192
+        $files->deleteDirectory(self::FIXTURE_DIRECTORY.'test');
193 193
     }
194 194
 
195 195
     public function testGetFiles(): void
Please login to merge, or discard this patch.
src/Files/src/Files.php 2 patches
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -39,30 +39,30 @@  discard block
 block discarded – undo
39 39
         ?int $mode = null,
40 40
         bool $recursivePermissions = true,
41 41
     ): bool {
42
-        if (empty($mode)) {
42
+        if (empty($mode)){
43 43
             $mode = self::DEFAULT_FILE_MODE;
44 44
         }
45 45
 
46 46
         //Directories always executable
47 47
         $mode |= 0o111;
48
-        if (\is_dir($directory)) {
48
+        if (\is_dir($directory)){
49 49
             //Exists :(
50 50
             return $this->setPermissions($directory, $mode);
51 51
         }
52 52
 
53
-        if (!$recursivePermissions) {
53
+        if (!$recursivePermissions){
54 54
             return \mkdir($directory, $mode, true);
55 55
         }
56 56
 
57 57
         $directoryChain = [\basename($directory)];
58 58
 
59 59
         $baseDirectory = $directory;
60
-        while (!\is_dir($baseDirectory = \dirname($baseDirectory))) {
60
+        while (!\is_dir($baseDirectory = \dirname($baseDirectory))){
61 61
             $directoryChain[] = \basename($baseDirectory);
62 62
         }
63 63
 
64
-        foreach (\array_reverse($directoryChain) as $dir) {
65
-            if (!\mkdir($baseDirectory = \sprintf('%s/%s', $baseDirectory, $dir))) {
64
+        foreach (\array_reverse($directoryChain) as $dir){
65
+            if (!\mkdir($baseDirectory = \sprintf('%s/%s', $baseDirectory, $dir))){
66 66
                 return false;
67 67
             }
68 68
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
     public function read(string $filename): string
76 76
     {
77
-        if (!$this->exists($filename)) {
77
+        if (!$this->exists($filename)){
78 78
             throw new FileNotFoundException($filename);
79 79
         }
80 80
 
@@ -93,12 +93,12 @@  discard block
 block discarded – undo
93 93
     ): bool {
94 94
         $mode ??= self::DEFAULT_FILE_MODE;
95 95
 
96
-        try {
97
-            if ($ensureDirectory) {
96
+        try{
97
+            if ($ensureDirectory){
98 98
                 $this->ensureDirectory(\dirname($filename), $mode);
99 99
             }
100 100
 
101
-            if ($this->exists($filename)) {
101
+            if ($this->exists($filename)){
102 102
                 //Forcing mode for existed file
103 103
                 $this->setPermissions($filename, $mode);
104 104
             }
@@ -109,12 +109,12 @@  discard block
 block discarded – undo
109 109
                 $append ? FILE_APPEND | LOCK_EX : LOCK_EX,
110 110
             );
111 111
 
112
-            if ($result !== false) {
112
+            if ($result !== false){
113 113
                 //Forcing mode after file creation
114 114
                 $this->setPermissions($filename, $mode);
115 115
             }
116
-        } catch (\Exception $e) {
117
-            throw new WriteErrorException($e->getMessage(), (int) $e->getCode(), $e);
116
+        }catch (\Exception $e){
117
+            throw new WriteErrorException($e->getMessage(), (int)$e->getCode(), $e);
118 118
         }
119 119
 
120 120
         return $result !== false;
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
     public function delete(string $filename): bool
133 133
     {
134
-        if ($this->exists($filename)) {
134
+        if ($this->exists($filename)){
135 135
             $result = \unlink($filename);
136 136
 
137 137
             //Wiping out changes in local file cache
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      */
151 151
     public function deleteDirectory(string $directory, bool $contentOnly = false): bool
152 152
     {
153
-        if (!$this->isDirectory($directory)) {
153
+        if (!$this->isDirectory($directory)){
154 154
             throw new FilesException(\sprintf('Undefined or invalid directory %s', $directory));
155 155
         }
156 156
 
@@ -159,15 +159,15 @@  discard block
 block discarded – undo
159 159
             \RecursiveIteratorIterator::CHILD_FIRST,
160 160
         );
161 161
 
162
-        foreach ($files as $file) {
163
-            if ($file->isDir()) {
162
+        foreach ($files as $file){
163
+            if ($file->isDir()){
164 164
                 \rmdir($file->getRealPath());
165
-            } else {
165
+            }else{
166 166
                 $this->delete($file->getRealPath());
167 167
             }
168 168
         }
169 169
 
170
-        if (!$contentOnly) {
170
+        if (!$contentOnly){
171 171
             return \rmdir($directory);
172 172
         }
173 173
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
     public function move(string $filename, string $destination): bool
178 178
     {
179
-        if (!$this->exists($filename)) {
179
+        if (!$this->exists($filename)){
180 180
             throw new FileNotFoundException($filename);
181 181
         }
182 182
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 
186 186
     public function copy(string $filename, string $destination): bool
187 187
     {
188
-        if (!$this->exists($filename)) {
188
+        if (!$this->exists($filename)){
189 189
             throw new FileNotFoundException($filename);
190 190
         }
191 191
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 
195 195
     public function touch(string $filename, ?int $mode = null): bool
196 196
     {
197
-        if (!\touch($filename)) {
197
+        if (!\touch($filename)){
198 198
             return false;
199 199
         }
200 200
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
     public function size(string $filename): int
210 210
     {
211
-        if (!$this->exists($filename)) {
211
+        if (!$this->exists($filename)){
212 212
             throw new FileNotFoundException($filename);
213 213
         }
214 214
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 
223 223
     public function md5(string $filename): string
224 224
     {
225
-        if (!$this->exists($filename)) {
225
+        if (!$this->exists($filename)){
226 226
             throw new FileNotFoundException($filename);
227 227
         }
228 228
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
     public function time(string $filename): int
233 233
     {
234
-        if (!$this->exists($filename)) {
234
+        if (!$this->exists($filename)){
235 235
             throw new FileNotFoundException($filename);
236 236
         }
237 237
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 
251 251
     public function getPermissions(string $filename): int
252 252
     {
253
-        if (!$this->exists($filename)) {
253
+        if (!$this->exists($filename)){
254 254
             throw new FileNotFoundException($filename);
255 255
         }
256 256
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 
260 260
     public function setPermissions(string $filename, int $mode): bool
261 261
     {
262
-        if (\is_dir($filename)) {
262
+        if (\is_dir($filename)){
263 263
             //Directories must always be executable (i.e. 664 for dir => 775)
264 264
             $mode |= 0111;
265 265
         }
@@ -270,14 +270,14 @@  discard block
 block discarded – undo
270 270
     public function getFiles(string $location, ?string $pattern = null): array
271 271
     {
272 272
         $result = [];
273
-        foreach ($this->filesIterator($location, $pattern) as $filename) {
274
-            if ($this->isDirectory($filename->getPathname())) {
275
-                $result = \array_merge($result, $this->getFiles($filename . DIRECTORY_SEPARATOR));
273
+        foreach ($this->filesIterator($location, $pattern) as $filename){
274
+            if ($this->isDirectory($filename->getPathname())){
275
+                $result = \array_merge($result, $this->getFiles($filename.DIRECTORY_SEPARATOR));
276 276
 
277 277
                 continue;
278 278
             }
279 279
 
280
-            $result[] = $this->normalizePath((string) $filename);
280
+            $result[] = $this->normalizePath((string)$filename);
281 281
         }
282 282
 
283 283
         return $result;
@@ -285,13 +285,13 @@  discard block
 block discarded – undo
285 285
 
286 286
     public function tempFilename(string $extension = '', ?string $location = null): string
287 287
     {
288
-        if (empty($location)) {
288
+        if (empty($location)){
289 289
             $location = \sys_get_temp_dir();
290 290
         }
291 291
 
292 292
         $filename = \tempnam($location, 'spiral');
293 293
 
294
-        if (!empty($extension)) {
294
+        if (!empty($extension)){
295 295
             $old = $filename;
296 296
             $filename = \sprintf('%s.%s', $filename, $extension);
297 297
             \rename($old, $filename);
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
     public function normalizePath(string $path, bool $asDirectory = false): string
305 305
     {
306 306
         $isUnc = \str_starts_with($path, '\\\\') || \str_starts_with($path, '//');
307
-        if ($isUnc) {
307
+        if ($isUnc){
308 308
             $leadingSlashes = \substr($path, 0, 2);
309 309
             $path = \substr($path, 2);
310 310
         }
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
         $path = \str_replace(['//', '\\'], '/', $path);
313 313
 
314 314
         //Potentially open links and ../ type directories?
315
-        return ($isUnc ? $leadingSlashes : '') . \rtrim($path, '/') . ($asDirectory ? '/' : '');
315
+        return ($isUnc ? $leadingSlashes : '').\rtrim($path, '/').($asDirectory ? '/' : '');
316 316
     }
317 317
 
318 318
     /**
@@ -327,21 +327,21 @@  discard block
 block discarded – undo
327 327
         $path = \explode('/', $path);
328 328
         $relative = $path;
329 329
 
330
-        foreach ($from as $depth => $dir) {
330
+        foreach ($from as $depth => $dir){
331 331
             //Find first non-matching dir
332
-            if ($dir === $path[$depth]) {
332
+            if ($dir === $path[$depth]){
333 333
                 //Ignore this directory
334 334
                 \array_shift($relative);
335
-            } else {
335
+            }else{
336 336
                 //Get number of remaining dirs to $from
337 337
                 $remaining = \count($from) - $depth;
338
-                if ($remaining > 1) {
338
+                if ($remaining > 1){
339 339
                     //Add traversals up to first matching directory
340 340
                     $padLength = (\count($relative) + $remaining - 1) * -1;
341 341
                     $relative = \array_pad($relative, $padLength, '..');
342 342
                     break;
343 343
                 }
344
-                $relative[0] = './' . $relative[0];
344
+                $relative[0] = './'.$relative[0];
345 345
             }
346 346
         }
347 347
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
      */
354 354
     public function __destruct()
355 355
     {
356
-        foreach ($this->destructFiles as $filename) {
356
+        foreach ($this->destructFiles as $filename){
357 357
             $this->delete($filename);
358 358
         }
359 359
     }
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
     private function filesIterator(string $location, ?string $pattern = null): \GlobIterator
362 362
     {
363 363
         $pattern ??= '*';
364
-        $regexp = \rtrim($location, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . \ltrim($pattern, DIRECTORY_SEPARATOR);
364
+        $regexp = \rtrim($location, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.\ltrim($pattern, DIRECTORY_SEPARATOR);
365 365
 
366 366
         return new \GlobIterator($regexp);
367 367
     }
Please login to merge, or discard this patch.
Braces   +75 added lines, -36 removed lines patch added patch discarded remove patch
@@ -39,30 +39,36 @@  discard block
 block discarded – undo
39 39
         ?int $mode = null,
40 40
         bool $recursivePermissions = true,
41 41
     ): bool {
42
-        if (empty($mode)) {
42
+        if (empty($mode))
43
+        {
43 44
             $mode = self::DEFAULT_FILE_MODE;
44 45
         }
45 46
 
46 47
         //Directories always executable
47 48
         $mode |= 0o111;
48
-        if (\is_dir($directory)) {
49
+        if (\is_dir($directory))
50
+        {
49 51
             //Exists :(
50 52
             return $this->setPermissions($directory, $mode);
51 53
         }
52 54
 
53
-        if (!$recursivePermissions) {
55
+        if (!$recursivePermissions)
56
+        {
54 57
             return \mkdir($directory, $mode, true);
55 58
         }
56 59
 
57 60
         $directoryChain = [\basename($directory)];
58 61
 
59 62
         $baseDirectory = $directory;
60
-        while (!\is_dir($baseDirectory = \dirname($baseDirectory))) {
63
+        while (!\is_dir($baseDirectory = \dirname($baseDirectory)))
64
+        {
61 65
             $directoryChain[] = \basename($baseDirectory);
62 66
         }
63 67
 
64
-        foreach (\array_reverse($directoryChain) as $dir) {
65
-            if (!\mkdir($baseDirectory = \sprintf('%s/%s', $baseDirectory, $dir))) {
68
+        foreach (\array_reverse($directoryChain) as $dir)
69
+        {
70
+            if (!\mkdir($baseDirectory = \sprintf('%s/%s', $baseDirectory, $dir)))
71
+            {
66 72
                 return false;
67 73
             }
68 74
 
@@ -74,7 +80,8 @@  discard block
 block discarded – undo
74 80
 
75 81
     public function read(string $filename): string
76 82
     {
77
-        if (!$this->exists($filename)) {
83
+        if (!$this->exists($filename))
84
+        {
78 85
             throw new FileNotFoundException($filename);
79 86
         }
80 87
 
@@ -93,12 +100,15 @@  discard block
 block discarded – undo
93 100
     ): bool {
94 101
         $mode ??= self::DEFAULT_FILE_MODE;
95 102
 
96
-        try {
97
-            if ($ensureDirectory) {
103
+        try
104
+        {
105
+            if ($ensureDirectory)
106
+            {
98 107
                 $this->ensureDirectory(\dirname($filename), $mode);
99 108
             }
100 109
 
101
-            if ($this->exists($filename)) {
110
+            if ($this->exists($filename))
111
+            {
102 112
                 //Forcing mode for existed file
103 113
                 $this->setPermissions($filename, $mode);
104 114
             }
@@ -109,11 +119,14 @@  discard block
 block discarded – undo
109 119
                 $append ? FILE_APPEND | LOCK_EX : LOCK_EX,
110 120
             );
111 121
 
112
-            if ($result !== false) {
122
+            if ($result !== false)
123
+            {
113 124
                 //Forcing mode after file creation
114 125
                 $this->setPermissions($filename, $mode);
115 126
             }
116
-        } catch (\Exception $e) {
127
+        }
128
+        catch (\Exception $e)
129
+        {
117 130
             throw new WriteErrorException($e->getMessage(), (int) $e->getCode(), $e);
118 131
         }
119 132
 
@@ -131,7 +144,8 @@  discard block
 block discarded – undo
131 144
 
132 145
     public function delete(string $filename): bool
133 146
     {
134
-        if ($this->exists($filename)) {
147
+        if ($this->exists($filename))
148
+        {
135 149
             $result = \unlink($filename);
136 150
 
137 151
             //Wiping out changes in local file cache
@@ -150,7 +164,8 @@  discard block
 block discarded – undo
150 164
      */
151 165
     public function deleteDirectory(string $directory, bool $contentOnly = false): bool
152 166
     {
153
-        if (!$this->isDirectory($directory)) {
167
+        if (!$this->isDirectory($directory))
168
+        {
154 169
             throw new FilesException(\sprintf('Undefined or invalid directory %s', $directory));
155 170
         }
156 171
 
@@ -159,15 +174,20 @@  discard block
 block discarded – undo
159 174
             \RecursiveIteratorIterator::CHILD_FIRST,
160 175
         );
161 176
 
162
-        foreach ($files as $file) {
163
-            if ($file->isDir()) {
177
+        foreach ($files as $file)
178
+        {
179
+            if ($file->isDir())
180
+            {
164 181
                 \rmdir($file->getRealPath());
165
-            } else {
182
+            }
183
+            else
184
+            {
166 185
                 $this->delete($file->getRealPath());
167 186
             }
168 187
         }
169 188
 
170
-        if (!$contentOnly) {
189
+        if (!$contentOnly)
190
+        {
171 191
             return \rmdir($directory);
172 192
         }
173 193
 
@@ -176,7 +196,8 @@  discard block
 block discarded – undo
176 196
 
177 197
     public function move(string $filename, string $destination): bool
178 198
     {
179
-        if (!$this->exists($filename)) {
199
+        if (!$this->exists($filename))
200
+        {
180 201
             throw new FileNotFoundException($filename);
181 202
         }
182 203
 
@@ -185,7 +206,8 @@  discard block
 block discarded – undo
185 206
 
186 207
     public function copy(string $filename, string $destination): bool
187 208
     {
188
-        if (!$this->exists($filename)) {
209
+        if (!$this->exists($filename))
210
+        {
189 211
             throw new FileNotFoundException($filename);
190 212
         }
191 213
 
@@ -194,7 +216,8 @@  discard block
 block discarded – undo
194 216
 
195 217
     public function touch(string $filename, ?int $mode = null): bool
196 218
     {
197
-        if (!\touch($filename)) {
219
+        if (!\touch($filename))
220
+        {
198 221
             return false;
199 222
         }
200 223
 
@@ -208,7 +231,8 @@  discard block
 block discarded – undo
208 231
 
209 232
     public function size(string $filename): int
210 233
     {
211
-        if (!$this->exists($filename)) {
234
+        if (!$this->exists($filename))
235
+        {
212 236
             throw new FileNotFoundException($filename);
213 237
         }
214 238
 
@@ -222,7 +246,8 @@  discard block
 block discarded – undo
222 246
 
223 247
     public function md5(string $filename): string
224 248
     {
225
-        if (!$this->exists($filename)) {
249
+        if (!$this->exists($filename))
250
+        {
226 251
             throw new FileNotFoundException($filename);
227 252
         }
228 253
 
@@ -231,7 +256,8 @@  discard block
 block discarded – undo
231 256
 
232 257
     public function time(string $filename): int
233 258
     {
234
-        if (!$this->exists($filename)) {
259
+        if (!$this->exists($filename))
260
+        {
235 261
             throw new FileNotFoundException($filename);
236 262
         }
237 263
 
@@ -250,7 +276,8 @@  discard block
 block discarded – undo
250 276
 
251 277
     public function getPermissions(string $filename): int
252 278
     {
253
-        if (!$this->exists($filename)) {
279
+        if (!$this->exists($filename))
280
+        {
254 281
             throw new FileNotFoundException($filename);
255 282
         }
256 283
 
@@ -259,7 +286,8 @@  discard block
 block discarded – undo
259 286
 
260 287
     public function setPermissions(string $filename, int $mode): bool
261 288
     {
262
-        if (\is_dir($filename)) {
289
+        if (\is_dir($filename))
290
+        {
263 291
             //Directories must always be executable (i.e. 664 for dir => 775)
264 292
             $mode |= 0111;
265 293
         }
@@ -270,8 +298,10 @@  discard block
 block discarded – undo
270 298
     public function getFiles(string $location, ?string $pattern = null): array
271 299
     {
272 300
         $result = [];
273
-        foreach ($this->filesIterator($location, $pattern) as $filename) {
274
-            if ($this->isDirectory($filename->getPathname())) {
301
+        foreach ($this->filesIterator($location, $pattern) as $filename)
302
+        {
303
+            if ($this->isDirectory($filename->getPathname()))
304
+            {
275 305
                 $result = \array_merge($result, $this->getFiles($filename . DIRECTORY_SEPARATOR));
276 306
 
277 307
                 continue;
@@ -285,13 +315,15 @@  discard block
 block discarded – undo
285 315
 
286 316
     public function tempFilename(string $extension = '', ?string $location = null): string
287 317
     {
288
-        if (empty($location)) {
318
+        if (empty($location))
319
+        {
289 320
             $location = \sys_get_temp_dir();
290 321
         }
291 322
 
292 323
         $filename = \tempnam($location, 'spiral');
293 324
 
294
-        if (!empty($extension)) {
325
+        if (!empty($extension))
326
+        {
295 327
             $old = $filename;
296 328
             $filename = \sprintf('%s.%s', $filename, $extension);
297 329
             \rename($old, $filename);
@@ -304,7 +336,8 @@  discard block
 block discarded – undo
304 336
     public function normalizePath(string $path, bool $asDirectory = false): string
305 337
     {
306 338
         $isUnc = \str_starts_with($path, '\\\\') || \str_starts_with($path, '//');
307
-        if ($isUnc) {
339
+        if ($isUnc)
340
+        {
308 341
             $leadingSlashes = \substr($path, 0, 2);
309 342
             $path = \substr($path, 2);
310 343
         }
@@ -327,15 +360,20 @@  discard block
 block discarded – undo
327 360
         $path = \explode('/', $path);
328 361
         $relative = $path;
329 362
 
330
-        foreach ($from as $depth => $dir) {
363
+        foreach ($from as $depth => $dir)
364
+        {
331 365
             //Find first non-matching dir
332
-            if ($dir === $path[$depth]) {
366
+            if ($dir === $path[$depth])
367
+            {
333 368
                 //Ignore this directory
334 369
                 \array_shift($relative);
335
-            } else {
370
+            }
371
+            else
372
+            {
336 373
                 //Get number of remaining dirs to $from
337 374
                 $remaining = \count($from) - $depth;
338
-                if ($remaining > 1) {
375
+                if ($remaining > 1)
376
+                {
339 377
                     //Add traversals up to first matching directory
340 378
                     $padLength = (\count($relative) + $remaining - 1) * -1;
341 379
                     $relative = \array_pad($relative, $padLength, '..');
@@ -353,7 +391,8 @@  discard block
 block discarded – undo
353 391
      */
354 392
     public function __destruct()
355 393
     {
356
-        foreach ($this->destructFiles as $filename) {
394
+        foreach ($this->destructFiles as $filename)
395
+        {
357 396
             $this->delete($filename);
358 397
         }
359 398
     }
Please login to merge, or discard this patch.
src/Console/src/Traits/HelpersTrait.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      */
153 153
     protected function warning(string $string): void
154 154
     {
155
-        if (!$this->output->getFormatter()->hasStyle('warning')) {
155
+        if (!$this->output->getFormatter()->hasStyle('warning')){
156 156
             $style = new OutputFormatterStyle('yellow');
157 157
             $this->output->getFormatter()->setStyle('warning', $style);
158 158
         }
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
         $stringLines = \explode("\n", \wordwrap($string, 300));
170 170
 
171 171
         $this->comment(\str_repeat('*', $length));
172
-        foreach ($stringLines as $line) {
173
-            $this->comment('*     ' . $line . '     *');
172
+        foreach ($stringLines as $line){
173
+            $this->comment('*     '.$line.'     *');
174 174
         }
175 175
         $this->comment(\str_repeat('*', $length));
176 176
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
      *
217 217
      * @throws \InvalidArgumentException When unknown output type is given
218 218
      */
219
-    protected function write(string|iterable $messages, bool $newline = false): void
219
+    protected function write(string | iterable $messages, bool $newline = false): void
220 220
     {
221 221
         $this->output->write(messages: $messages, newline: $newline);
222 222
     }
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
      *
229 229
      * @throws \InvalidArgumentException When unknown output type is given
230 230
      */
231
-    protected function writeln(string|iterable $messages): void
231
+    protected function writeln(string | iterable $messages): void
232 232
     {
233 233
         $this->output->writeln(messages: $messages);
234 234
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -152,7 +152,8 @@  discard block
 block discarded – undo
152 152
      */
153 153
     protected function warning(string $string): void
154 154
     {
155
-        if (!$this->output->getFormatter()->hasStyle('warning')) {
155
+        if (!$this->output->getFormatter()->hasStyle('warning'))
156
+        {
156 157
             $style = new OutputFormatterStyle('yellow');
157 158
             $this->output->getFormatter()->setStyle('warning', $style);
158 159
         }
@@ -169,7 +170,8 @@  discard block
 block discarded – undo
169 170
         $stringLines = \explode("\n", \wordwrap($string, 300));
170 171
 
171 172
         $this->comment(\str_repeat('*', $length));
172
-        foreach ($stringLines as $line) {
173
+        foreach ($stringLines as $line)
174
+        {
173 175
             $this->comment('*     ' . $line . '     *');
174 176
         }
175 177
         $this->comment(\str_repeat('*', $length));
Please login to merge, or discard this patch.
src/Console/src/Console.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         #[Proxy] private readonly ContainerInterface $container = new Container(),
39 39
         private readonly ScopeInterface $scope = new Container(),
40 40
         private readonly ?EventDispatcherInterface $dispatcher = null,
41
-    ) {}
41
+    ){}
42 42
 
43 43
     /**
44 44
      * Run console application.
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function run(
64 64
         ?string $command,
65
-        array|InputInterface $input = [],
65
+        array | InputInterface $input = [],
66 66
         OutputInterface $output = new BufferedOutput(),
67 67
     ): CommandOutput {
68 68
         $input = \is_array($input) ? new ArrayInput($input) : $input;
69 69
 
70 70
         $this->configureIO($input, $output);
71 71
 
72
-        if ($command !== null) {
72
+        if ($command !== null){
73 73
             $input = new InputProxy($input, ['firstArgument' => $command]);
74 74
         }
75 75
 
@@ -96,18 +96,18 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public function getApplication(): Application
98 98
     {
99
-        if ($this->application !== null) {
99
+        if ($this->application !== null){
100 100
             return $this->application;
101 101
         }
102 102
 
103 103
         $this->application = new Application($this->config->getName(), $this->config->getVersion());
104 104
         $this->application->setCatchExceptions(false);
105 105
         $this->application->setAutoExit(false);
106
-        if ($this->dispatcher instanceof SymfonyEventDispatcherInterface) {
106
+        if ($this->dispatcher instanceof SymfonyEventDispatcherInterface){
107 107
             $this->application->setDispatcher($this->dispatcher);
108 108
         }
109 109
 
110
-        if ($this->locator !== null) {
110
+        if ($this->locator !== null){
111 111
             $this->addCommands($this->locator->locateCommands());
112 112
         }
113 113
 
@@ -127,13 +127,13 @@  discard block
 block discarded – undo
127 127
     {
128 128
         $interceptors = $this->config->getInterceptors();
129 129
 
130
-        foreach ($commands as $command) {
131
-            if ($command instanceof Command) {
130
+        foreach ($commands as $command){
131
+            if ($command instanceof Command){
132 132
                 $command->setContainer($this->container);
133 133
                 $command->setInterceptors($interceptors);
134 134
             }
135 135
 
136
-            if ($this->dispatcher !== null && $command instanceof EventDispatcherAwareInterface) {
136
+            if ($this->dispatcher !== null && $command instanceof EventDispatcherAwareInterface){
137 137
                 $command->setEventDispatcher($this->dispatcher);
138 138
             }
139 139
 
@@ -148,27 +148,27 @@  discard block
 block discarded – undo
148 148
      */
149 149
     private function configureIO(InputInterface $input, OutputInterface $output): void
150 150
     {
151
-        if ($input->hasParameterOption(['--ansi'], true)) {
151
+        if ($input->hasParameterOption(['--ansi'], true)){
152 152
             $output->setDecorated(true);
153
-        } elseif ($input->hasParameterOption(['--no-ansi'], true)) {
153
+        } elseif ($input->hasParameterOption(['--no-ansi'], true)){
154 154
             $output->setDecorated(false);
155 155
         }
156 156
 
157
-        if ($input->hasParameterOption(['--no-interaction', '-n'], true)) {
157
+        if ($input->hasParameterOption(['--no-interaction', '-n'], true)){
158 158
             $input->setInteractive(false);
159
-        } elseif (\function_exists('posix_isatty')) {
159
+        } elseif (\function_exists('posix_isatty')){
160 160
             $inputStream = null;
161 161
 
162
-            if ($input instanceof StreamableInputInterface) {
162
+            if ($input instanceof StreamableInputInterface){
163 163
                 $inputStream = $input->getStream();
164 164
             }
165 165
 
166
-            if ($inputStream !== null && !@posix_isatty($inputStream) && \getenv('SHELL_INTERACTIVE') === false) {
166
+            if ($inputStream !== null && !@posix_isatty($inputStream) && \getenv('SHELL_INTERACTIVE') === false){
167 167
                 $input->setInteractive(false);
168 168
             }
169 169
         }
170 170
 
171
-        match ($shellVerbosity = (int) \getenv('SHELL_VERBOSITY')) {
171
+        match ($shellVerbosity = (int)\getenv('SHELL_VERBOSITY')) {
172 172
             -1 => $output->setVerbosity(OutputInterface::VERBOSITY_QUIET),
173 173
             1 => $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE),
174 174
             2 => $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE),
@@ -176,22 +176,22 @@  discard block
 block discarded – undo
176 176
             default => $shellVerbosity = 0,
177 177
         };
178 178
 
179
-        if ($input->hasParameterOption(['--quiet', '-q'], true)) {
179
+        if ($input->hasParameterOption(['--quiet', '-q'], true)){
180 180
             $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
181 181
             $shellVerbosity = -1;
182
-        } else {
182
+        }else{
183 183
             if (
184 184
                 $input->hasParameterOption('-vvv', true)
185 185
                 || $input->hasParameterOption('--verbose=3', true)
186 186
                 || $input->getParameterOption('--verbose', false, true) === 3
187
-            ) {
187
+            ){
188 188
                 $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
189 189
                 $shellVerbosity = 3;
190 190
             } elseif (
191 191
                 $input->hasParameterOption('-vv', true)
192 192
                 || $input->hasParameterOption('--verbose=2', true)
193 193
                 || $input->getParameterOption('--verbose', false, true) === 2
194
-            ) {
194
+            ){
195 195
                 $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
196 196
                 $shellVerbosity = 2;
197 197
             } elseif (
@@ -199,17 +199,17 @@  discard block
 block discarded – undo
199 199
                 || $input->hasParameterOption('--verbose=1', true)
200 200
                 || $input->hasParameterOption('--verbose', true)
201 201
                 || $input->getParameterOption('--verbose', false, true)
202
-            ) {
202
+            ){
203 203
                 $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
204 204
                 $shellVerbosity = 1;
205 205
             }
206 206
         }
207 207
 
208
-        if ($shellVerbosity === -1) {
208
+        if ($shellVerbosity === -1){
209 209
             $input->setInteractive(false);
210 210
         }
211 211
 
212
-        \putenv('SHELL_VERBOSITY=' . $shellVerbosity);
212
+        \putenv('SHELL_VERBOSITY='.$shellVerbosity);
213 213
         $_ENV['SHELL_VERBOSITY'] = $shellVerbosity;
214 214
         $_SERVER['SHELL_VERBOSITY'] = $shellVerbosity;
215 215
     }
Please login to merge, or discard this patch.
Braces   +41 added lines, -19 removed lines patch added patch discarded remove patch
@@ -38,7 +38,8 @@  discard block
 block discarded – undo
38 38
         #[Proxy] private readonly ContainerInterface $container = new Container(),
39 39
         private readonly ScopeInterface $scope = new Container(),
40 40
         private readonly ?EventDispatcherInterface $dispatcher = null,
41
-    ) {}
41
+    ) {
42
+}
42 43
 
43 44
     /**
44 45
      * Run console application.
@@ -69,7 +70,8 @@  discard block
 block discarded – undo
69 70
 
70 71
         $this->configureIO($input, $output);
71 72
 
72
-        if ($command !== null) {
73
+        if ($command !== null)
74
+        {
73 75
             $input = new InputProxy($input, ['firstArgument' => $command]);
74 76
         }
75 77
 
@@ -96,18 +98,21 @@  discard block
 block discarded – undo
96 98
      */
97 99
     public function getApplication(): Application
98 100
     {
99
-        if ($this->application !== null) {
101
+        if ($this->application !== null)
102
+        {
100 103
             return $this->application;
101 104
         }
102 105
 
103 106
         $this->application = new Application($this->config->getName(), $this->config->getVersion());
104 107
         $this->application->setCatchExceptions(false);
105 108
         $this->application->setAutoExit(false);
106
-        if ($this->dispatcher instanceof SymfonyEventDispatcherInterface) {
109
+        if ($this->dispatcher instanceof SymfonyEventDispatcherInterface)
110
+        {
107 111
             $this->application->setDispatcher($this->dispatcher);
108 112
         }
109 113
 
110
-        if ($this->locator !== null) {
114
+        if ($this->locator !== null)
115
+        {
111 116
             $this->addCommands($this->locator->locateCommands());
112 117
         }
113 118
 
@@ -127,13 +132,16 @@  discard block
 block discarded – undo
127 132
     {
128 133
         $interceptors = $this->config->getInterceptors();
129 134
 
130
-        foreach ($commands as $command) {
131
-            if ($command instanceof Command) {
135
+        foreach ($commands as $command)
136
+        {
137
+            if ($command instanceof Command)
138
+            {
132 139
                 $command->setContainer($this->container);
133 140
                 $command->setInterceptors($interceptors);
134 141
             }
135 142
 
136
-            if ($this->dispatcher !== null && $command instanceof EventDispatcherAwareInterface) {
143
+            if ($this->dispatcher !== null && $command instanceof EventDispatcherAwareInterface)
144
+            {
137 145
                 $command->setEventDispatcher($this->dispatcher);
138 146
             }
139 147
 
@@ -148,22 +156,30 @@  discard block
 block discarded – undo
148 156
      */
149 157
     private function configureIO(InputInterface $input, OutputInterface $output): void
150 158
     {
151
-        if ($input->hasParameterOption(['--ansi'], true)) {
159
+        if ($input->hasParameterOption(['--ansi'], true))
160
+        {
152 161
             $output->setDecorated(true);
153
-        } elseif ($input->hasParameterOption(['--no-ansi'], true)) {
162
+        }
163
+        elseif ($input->hasParameterOption(['--no-ansi'], true))
164
+        {
154 165
             $output->setDecorated(false);
155 166
         }
156 167
 
157
-        if ($input->hasParameterOption(['--no-interaction', '-n'], true)) {
168
+        if ($input->hasParameterOption(['--no-interaction', '-n'], true))
169
+        {
158 170
             $input->setInteractive(false);
159
-        } elseif (\function_exists('posix_isatty')) {
171
+        }
172
+        elseif (\function_exists('posix_isatty'))
173
+        {
160 174
             $inputStream = null;
161 175
 
162
-            if ($input instanceof StreamableInputInterface) {
176
+            if ($input instanceof StreamableInputInterface)
177
+            {
163 178
                 $inputStream = $input->getStream();
164 179
             }
165 180
 
166
-            if ($inputStream !== null && !@posix_isatty($inputStream) && \getenv('SHELL_INTERACTIVE') === false) {
181
+            if ($inputStream !== null && !@posix_isatty($inputStream) && \getenv('SHELL_INTERACTIVE') === false)
182
+            {
167 183
                 $input->setInteractive(false);
168 184
             }
169 185
         }
@@ -176,10 +192,13 @@  discard block
 block discarded – undo
176 192
             default => $shellVerbosity = 0,
177 193
         };
178 194
 
179
-        if ($input->hasParameterOption(['--quiet', '-q'], true)) {
195
+        if ($input->hasParameterOption(['--quiet', '-q'], true))
196
+        {
180 197
             $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
181 198
             $shellVerbosity = -1;
182
-        } else {
199
+        }
200
+        else
201
+        {
183 202
             if (
184 203
                 $input->hasParameterOption('-vvv', true)
185 204
                 || $input->hasParameterOption('--verbose=3', true)
@@ -187,14 +206,16 @@  discard block
 block discarded – undo
187 206
             ) {
188 207
                 $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
189 208
                 $shellVerbosity = 3;
190
-            } elseif (
209
+            }
210
+            elseif (
191 211
                 $input->hasParameterOption('-vv', true)
192 212
                 || $input->hasParameterOption('--verbose=2', true)
193 213
                 || $input->getParameterOption('--verbose', false, true) === 2
194 214
             ) {
195 215
                 $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
196 216
                 $shellVerbosity = 2;
197
-            } elseif (
217
+            }
218
+            elseif (
198 219
                 $input->hasParameterOption('-v', true)
199 220
                 || $input->hasParameterOption('--verbose=1', true)
200 221
                 || $input->hasParameterOption('--verbose', true)
@@ -205,7 +226,8 @@  discard block
 block discarded – undo
205 226
             }
206 227
         }
207 228
 
208
-        if ($shellVerbosity === -1) {
229
+        if ($shellVerbosity === -1)
230
+        {
209 231
             $input->setInteractive(false);
210 232
         }
211 233
 
Please login to merge, or discard this patch.
src/Console/src/Command.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
      */
90 90
     protected function execute(InputInterface $input, OutputInterface $output): int
91 91
     {
92
-        if ($this->container === null) {
92
+        if ($this->container === null){
93 93
             throw new ScopeException('Container is not set');
94 94
         }
95 95
 
96 96
         $method = \method_exists($this, 'perform') ? 'perform' : '__invoke';
97 97
 
98
-        try {
98
+        try{
99 99
             [$this->input, $this->output] = [$this->prepareInput($input), $this->prepareOutput($input, $output)];
100 100
 
101 101
             $this->eventDispatcher?->dispatch(new CommandStarting($this, $this->input, $this->output));
@@ -117,18 +117,18 @@  discard block
 block discarded – undo
117 117
                         $arguments = ['input' => $this->input, 'output' => $this->output, 'command' => $this];
118 118
 
119 119
                         return $core instanceof HandlerInterface
120
-                            ? (int) $core->handle(new CallContext(
120
+                            ? (int)$core->handle(new CallContext(
121 121
                                 Target::fromPair($this, $method),
122 122
                                 $arguments,
123 123
                             ))
124
-                            : (int) $core->callAction(static::class, $method, $arguments);
124
+                            : (int)$core->callAction(static::class, $method, $arguments);
125 125
                     },
126 126
                 );
127 127
 
128 128
             $this->eventDispatcher?->dispatch(new CommandFinished($this, $code, $this->input, $this->output));
129 129
 
130 130
             return $code;
131
-        } finally {
131
+        }finally{
132 132
             [$this->input, $this->output] = [null, null];
133 133
         }
134 134
     }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     /**
137 137
      * @deprecated This method will be removed in v4.0.
138 138
      */
139
-    protected function buildCore(): CoreInterface|HandlerInterface
139
+    protected function buildCore(): CoreInterface | HandlerInterface
140 140
     {
141 141
         /** @var InvokerInterface $invoker */
142 142
         $invoker = $this->container->get(InvokerInterface::class);
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -89,13 +89,15 @@  discard block
 block discarded – undo
89 89
      */
90 90
     protected function execute(InputInterface $input, OutputInterface $output): int
91 91
     {
92
-        if ($this->container === null) {
92
+        if ($this->container === null)
93
+        {
93 94
             throw new ScopeException('Container is not set');
94 95
         }
95 96
 
96 97
         $method = \method_exists($this, 'perform') ? 'perform' : '__invoke';
97 98
 
98
-        try {
99
+        try
100
+        {
99 101
             [$this->input, $this->output] = [$this->prepareInput($input), $this->prepareOutput($input, $output)];
100 102
 
101 103
             $this->eventDispatcher?->dispatch(new CommandStarting($this, $this->input, $this->output));
@@ -128,7 +130,9 @@  discard block
 block discarded – undo
128 130
             $this->eventDispatcher?->dispatch(new CommandFinished($this, $code, $this->input, $this->output));
129 131
 
130 132
             return $code;
131
-        } finally {
133
+        }
134
+        finally
135
+        {
132 136
             [$this->input, $this->output] = [null, null];
133 137
         }
134 138
     }
Please login to merge, or discard this patch.
src/Router/tests/ControllerTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
 
42 42
         $response = $router->handle(new ServerRequest('GET', new Uri('/test')));
43 43
         self::assertSame(200, $response->getStatusCode());
44
-        self::assertSame('hello world', (string) $response->getBody());
44
+        self::assertSame('hello world', (string)$response->getBody());
45 45
 
46 46
         $response = $router->handle(new ServerRequest('GET', new Uri('/echo')));
47 47
         self::assertSame(200, $response->getStatusCode());
48
-        self::assertSame('echoed', (string) $response->getBody());
48
+        self::assertSame('echoed', (string)$response->getBody());
49 49
 
50 50
         $response = $router->handle(new ServerRequest('GET', new Uri('/id/888')));
51 51
         self::assertSame(200, $response->getStatusCode());
52
-        self::assertSame('888', (string) $response->getBody());
52
+        self::assertSame('888', (string)$response->getBody());
53 53
     }
54 54
 
55 55
     public function testOptionalParam(): void
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 
63 63
         $response = $router->handle(new ServerRequest('GET', new Uri('/default')));
64 64
         self::assertSame(200, $response->getStatusCode());
65
-        self::assertSame('default', (string) $response->getBody());
65
+        self::assertSame('default', (string)$response->getBody());
66 66
 
67 67
         $response = $router->handle(new ServerRequest('GET', new Uri('/default/123')));
68 68
         self::assertSame(200, $response->getStatusCode());
69
-        self::assertSame('123', (string) $response->getBody());
69
+        self::assertSame('123', (string)$response->getBody());
70 70
     }
71 71
 
72 72
     public function testFallbackHandler(): void
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         $this->getContainer()->removeBinding(CoreInterface::class);
77 77
 
78 78
         $core = $target->getHandler($this->getContainer(), []);
79
-        $handler = (static fn(): HandlerInterface|CoreInterface => $core->core)->bindTo(null, $core)();
79
+        $handler = (static fn(): HandlerInterface | CoreInterface => $core->core)->bindTo(null, $core)();
80 80
 
81 81
         self::assertInstanceOf(AutowireHandler::class, $handler);
82 82
     }
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
 
92 92
         $response = $router->handle(new ServerRequest('GET', new Uri('/defaultInt')));
93 93
         self::assertSame(200, $response->getStatusCode());
94
-        self::assertSame('int: 1', (string) $response->getBody());
94
+        self::assertSame('int: 1', (string)$response->getBody());
95 95
 
96 96
         $response = $router->handle(new ServerRequest('GET', new Uri('/defaultInt/123')));
97 97
         self::assertSame(200, $response->getStatusCode());
98
-        self::assertSame('string: 123', (string) $response->getBody());
98
+        self::assertSame('string: 123', (string)$response->getBody());
99 99
     }
100 100
 
101 101
     public function testUriGeneration(): void
Please login to merge, or discard this patch.