Passed
Pull Request — master (#736)
by Abdul Malik
06:39
created
src/Framework/Bootloader/Cycle/SchemaBootloader.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
     public function getGenerators(): array
86 86
     {
87 87
         $result = [];
88
-        foreach ($this->generators as $group) {
89
-            foreach ($group as $generator) {
90
-                if (is_object($generator) && !$generator instanceof Container\Autowire) {
88
+        foreach ($this->generators as $group){
89
+            foreach ($group as $generator){
90
+                if (is_object($generator) && !$generator instanceof Container\Autowire){
91 91
                     $result[] = $generator;
92
-                } else {
92
+                }else{
93 93
                     $result[] = $this->container->get($generator);
94 94
                 }
95 95
             }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     protected function schema(MemoryInterface $memory): SchemaInterface
108 108
     {
109 109
         $schemaCompiler = SchemaCompiler::fromMemory($memory);
110
-        if ($schemaCompiler->isEmpty()) {
110
+        if ($schemaCompiler->isEmpty()){
111 111
             $schemaCompiler = SchemaCompiler::compile(
112 112
                 $this->container->get(Registry::class),
113 113
                 $this->getGenerators()
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -85,11 +85,16 @@  discard block
 block discarded – undo
85 85
     public function getGenerators(): array
86 86
     {
87 87
         $result = [];
88
-        foreach ($this->generators as $group) {
89
-            foreach ($group as $generator) {
90
-                if (is_object($generator) && !$generator instanceof Container\Autowire) {
88
+        foreach ($this->generators as $group)
89
+        {
90
+            foreach ($group as $generator)
91
+            {
92
+                if (is_object($generator) && !$generator instanceof Container\Autowire)
93
+                {
91 94
                     $result[] = $generator;
92
-                } else {
95
+                }
96
+                else
97
+                {
93 98
                     $result[] = $this->container->get($generator);
94 99
                 }
95 100
             }
@@ -107,7 +112,8 @@  discard block
 block discarded – undo
107 112
     protected function schema(MemoryInterface $memory): SchemaInterface
108 113
     {
109 114
         $schemaCompiler = SchemaCompiler::fromMemory($memory);
110
-        if ($schemaCompiler->isEmpty()) {
115
+        if ($schemaCompiler->isEmpty())
116
+        {
111 117
             $schemaCompiler = SchemaCompiler::compile(
112 118
                 $this->container->get(Registry::class),
113 119
                 $this->getGenerators()
Please login to merge, or discard this patch.
src/Framework/Command/Cycle/SyncCommand.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
         );
45 45
         $schemaCompiler->toMemory($memory);
46 46
 
47
-        if ($show->hasChanges()) {
47
+        if ($show->hasChanges()){
48 48
             $this->writeln("\n<info>ORM Schema has been synchronized</info>");
49 49
         }
50 50
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,8 @@
 block discarded – undo
44 44
         );
45 45
         $schemaCompiler->toMemory($memory);
46 46
 
47
-        if ($show->hasChanges()) {
47
+        if ($show->hasChanges())
48
+        {
48 49
             $this->writeln("\n<info>ORM Schema has been synchronized</info>");
49 50
         }
50 51
     }
Please login to merge, or discard this patch.
src/Prototype/tests/Commands/AbstractCommandsTest.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function __construct($name = null, array $data = [], $dataName = '')
41 41
     {
42
-        $this->storage = new Storage($this->dir() . '/Fixtures/');
42
+        $this->storage = new Storage($this->dir().'/Fixtures/');
43 43
         parent::__construct($name, $data, $dataName);
44 44
     }
45 45
 
46 46
     public function setUp(): void
47 47
     {
48
-        if (!\class_exists(Kernel::class)) {
48
+        if (!\class_exists(Kernel::class)){
49 49
             $this->markTestSkipped('A "spiral/framework" dependency is required to run these tests');
50 50
         }
51 51
 
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
             'cache'  => sys_get_temp_dir()
57 57
         ], null, false);
58 58
 
59
-        foreach (static::STORE as $name) {
59
+        foreach (static::STORE as $name){
60 60
             $this->storage->store($name);
61 61
         }
62 62
     }
63 63
 
64 64
     public function tearDown(): void
65 65
     {
66
-        foreach (static::STORE as $name) {
66
+        foreach (static::STORE as $name){
67 67
             $this->storage->restore($name);
68 68
         }
69 69
     }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,7 +45,8 @@  discard block
 block discarded – undo
45 45
 
46 46
     public function setUp(): void
47 47
     {
48
-        if (!\class_exists(Kernel::class)) {
48
+        if (!\class_exists(Kernel::class))
49
+        {
49 50
             $this->markTestSkipped('A "spiral/framework" dependency is required to run these tests');
50 51
         }
51 52
 
@@ -56,14 +57,16 @@  discard block
 block discarded – undo
56 57
             'cache'  => sys_get_temp_dir()
57 58
         ], null, false);
58 59
 
59
-        foreach (static::STORE as $name) {
60
+        foreach (static::STORE as $name)
61
+        {
60 62
             $this->storage->store($name);
61 63
         }
62 64
     }
63 65
 
64 66
     public function tearDown(): void
65 67
     {
66
-        foreach (static::STORE as $name) {
68
+        foreach (static::STORE as $name)
69
+        {
67 70
             $this->storage->restore($name);
68 71
         }
69 72
     }
Please login to merge, or discard this patch.
src/Prototype/tests/Commands/InjectCommandTest.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         $source = file_get_contents($filename);
30 30
         $this->assertStringContainsString('use PrototypeTrait;', $source);
31 31
 
32
-        try {
32
+        try{
33 33
             $this->app->bindApp();
34 34
 
35 35
             $inp = new ArrayInput(['--remove' => true]);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
             $this->app->get(Console::class)->run('prototype:inject', $inp, $out);
38 38
 
39 39
             $this->assertStringNotContainsString('use PrototypeTrait;', file_get_contents($filename));
40
-        } finally {
40
+        }finally{
41 41
             file_put_contents($filename, $source);
42 42
         }
43 43
     }
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,8 @@  discard block
 block discarded – undo
29 29
         $source = file_get_contents($filename);
30 30
         $this->assertStringContainsString('use PrototypeTrait;', $source);
31 31
 
32
-        try {
32
+        try
33
+        {
33 34
             $this->app->bindApp();
34 35
 
35 36
             $inp = new ArrayInput(['--remove' => true]);
@@ -37,7 +38,9 @@  discard block
 block discarded – undo
37 38
             $this->app->get(Console::class)->run('prototype:inject', $inp, $out);
38 39
 
39 40
             $this->assertStringNotContainsString('use PrototypeTrait;', file_get_contents($filename));
40
-        } finally {
41
+        }
42
+        finally
43
+        {
41 44
             file_put_contents($filename, $source);
42 45
         }
43 46
     }
Please login to merge, or discard this patch.
src/Files/src/Files.php 3 patches
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function __destruct()
47 47
     {
48
-        foreach ($this->destructFiles as $filename) {
48
+        foreach ($this->destructFiles as $filename){
49 49
             $this->delete($filename);
50 50
         }
51 51
     }
@@ -60,30 +60,30 @@  discard block
 block discarded – undo
60 60
         int $mode = null,
61 61
         bool $recursivePermissions = true
62 62
     ): bool {
63
-        if (empty($mode)) {
63
+        if (empty($mode)){
64 64
             $mode = self::DEFAULT_FILE_MODE;
65 65
         }
66 66
 
67 67
         //Directories always executable
68 68
         $mode = $mode | 0111;
69
-        if (is_dir($directory)) {
69
+        if (is_dir($directory)){
70 70
             //Exists :(
71 71
             return $this->setPermissions($directory, $mode);
72 72
         }
73 73
 
74
-        if (!$recursivePermissions) {
74
+        if (!$recursivePermissions){
75 75
             return mkdir($directory, $mode, true);
76 76
         }
77 77
 
78 78
         $directoryChain = [basename($directory)];
79 79
 
80 80
         $baseDirectory = $directory;
81
-        while (!is_dir($baseDirectory = dirname($baseDirectory))) {
81
+        while (!is_dir($baseDirectory = dirname($baseDirectory))){
82 82
             $directoryChain[] = basename($baseDirectory);
83 83
         }
84 84
 
85
-        foreach (array_reverse($directoryChain) as $directory) {
86
-            if (!mkdir($baseDirectory = "{$baseDirectory}/{$directory}")) {
85
+        foreach (array_reverse($directoryChain) as $directory){
86
+            if (!mkdir($baseDirectory = "{$baseDirectory}/{$directory}")){
87 87
                 return false;
88 88
             }
89 89
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      */
99 99
     public function read(string $filename): string
100 100
     {
101
-        if (!$this->exists($filename)) {
101
+        if (!$this->exists($filename)){
102 102
             throw new FileNotFoundException($filename);
103 103
         }
104 104
 
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
     ): bool {
120 120
         $mode = $mode ?? self::DEFAULT_FILE_MODE;
121 121
 
122
-        try {
123
-            if ($ensureDirectory) {
122
+        try{
123
+            if ($ensureDirectory){
124 124
                 $this->ensureDirectory(dirname($filename), $mode);
125 125
             }
126 126
 
127
-            if ($this->exists($filename)) {
127
+            if ($this->exists($filename)){
128 128
                 //Forcing mode for existed file
129 129
                 $this->setPermissions($filename, $mode);
130 130
             }
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
                 $append ? FILE_APPEND | LOCK_EX : LOCK_EX
136 136
             );
137 137
 
138
-            if ($result !== false) {
138
+            if ($result !== false){
139 139
                 //Forcing mode after file creation
140 140
                 $this->setPermissions($filename, $mode);
141 141
             }
142
-        } catch (\Exception $e) {
142
+        }catch (\Exception $e){
143 143
             throw new WriteErrorException($e->getMessage(), $e->getCode(), $e);
144 144
         }
145 145
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
      */
164 164
     public function delete(string $filename)
165 165
     {
166
-        if ($this->exists($filename)) {
166
+        if ($this->exists($filename)){
167 167
             $result = unlink($filename);
168 168
 
169 169
             //Wiping out changes in local file cache
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      */
188 188
     public function deleteDirectory(string $directory, bool $contentOnly = false): void
189 189
     {
190
-        if (!$this->isDirectory($directory)) {
190
+        if (!$this->isDirectory($directory)){
191 191
             throw new FilesException("Undefined or invalid directory {$directory}");
192 192
         }
193 193
 
@@ -196,15 +196,15 @@  discard block
 block discarded – undo
196 196
             \RecursiveIteratorIterator::CHILD_FIRST
197 197
         );
198 198
 
199
-        foreach ($files as $file) {
200
-            if ($file->isDir()) {
199
+        foreach ($files as $file){
200
+            if ($file->isDir()){
201 201
                 rmdir($file->getRealPath());
202
-            } else {
202
+            }else{
203 203
                 $this->delete($file->getRealPath());
204 204
             }
205 205
         }
206 206
 
207
-        if (!$contentOnly) {
207
+        if (!$contentOnly){
208 208
             rmdir($directory);
209 209
         }
210 210
     }
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
      */
215 215
     public function move(string $filename, string $destination): bool
216 216
     {
217
-        if (!$this->exists($filename)) {
217
+        if (!$this->exists($filename)){
218 218
             throw new FileNotFoundException($filename);
219 219
         }
220 220
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
      */
227 227
     public function copy(string $filename, string $destination): bool
228 228
     {
229
-        if (!$this->exists($filename)) {
229
+        if (!$this->exists($filename)){
230 230
             throw new FileNotFoundException($filename);
231 231
         }
232 232
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
      */
239 239
     public function touch(string $filename, int $mode = null): bool
240 240
     {
241
-        if (!touch($filename)) {
241
+        if (!touch($filename)){
242 242
             return false;
243 243
         }
244 244
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      */
259 259
     public function size(string $filename): int
260 260
     {
261
-        if (!$this->exists($filename)) {
261
+        if (!$this->exists($filename)){
262 262
             throw new FileNotFoundException($filename);
263 263
         }
264 264
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
      */
279 279
     public function md5(string $filename): string
280 280
     {
281
-        if (!$this->exists($filename)) {
281
+        if (!$this->exists($filename)){
282 282
             throw new FileNotFoundException($filename);
283 283
         }
284 284
 
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
      */
291 291
     public function time(string $filename): int
292 292
     {
293
-        if (!$this->exists($filename)) {
293
+        if (!$this->exists($filename)){
294 294
             throw new FileNotFoundException($filename);
295 295
         }
296 296
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
      */
319 319
     public function getPermissions(string $filename): int
320 320
     {
321
-        if (!$this->exists($filename)) {
321
+        if (!$this->exists($filename)){
322 322
             throw new FileNotFoundException($filename);
323 323
         }
324 324
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
      */
331 331
     public function setPermissions(string $filename, int $mode)
332 332
     {
333
-        if (is_dir($filename)) {
333
+        if (is_dir($filename)){
334 334
             //Directories must always be executable (i.e. 664 for dir => 775)
335 335
             $mode |= 0111;
336 336
         }
@@ -344,9 +344,9 @@  discard block
 block discarded – undo
344 344
     public function getFiles(string $location, string $pattern = null): array
345 345
     {
346 346
         $result = [];
347
-        foreach ($this->filesIterator($location, $pattern) as $filename) {
348
-            if ($this->isDirectory($filename->getPathname())) {
349
-                $result = array_merge($result, $this->getFiles($filename . DIRECTORY_SEPARATOR));
347
+        foreach ($this->filesIterator($location, $pattern) as $filename){
348
+            if ($this->isDirectory($filename->getPathname())){
349
+                $result = array_merge($result, $this->getFiles($filename.DIRECTORY_SEPARATOR));
350 350
 
351 351
                 continue;
352 352
             }
@@ -362,13 +362,13 @@  discard block
 block discarded – undo
362 362
      */
363 363
     public function tempFilename(string $extension = '', string $location = null): string
364 364
     {
365
-        if (empty($location)) {
365
+        if (empty($location)){
366 366
             $location = sys_get_temp_dir();
367 367
         }
368 368
 
369 369
         $filename = tempnam($location, 'spiral');
370 370
 
371
-        if (!empty($extension)) {
371
+        if (!empty($extension)){
372 372
             [$old, $filename] = [$filename, "{$filename}.{$extension}"];
373 373
             rename($old, $filename);
374 374
             $this->destructFiles[] = $filename;
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
         $path = str_replace(['//', '\\'], '/', $path);
386 386
 
387 387
         //Potentially open links and ../ type directories?
388
-        return rtrim($path, '/') . ($asDirectory ? '/' : '');
388
+        return rtrim($path, '/').($asDirectory ? '/' : '');
389 389
     }
390 390
 
391 391
     /**
@@ -402,21 +402,21 @@  discard block
 block discarded – undo
402 402
         $path = explode('/', $path);
403 403
         $relative = $path;
404 404
 
405
-        foreach ($from as $depth => $dir) {
405
+        foreach ($from as $depth => $dir){
406 406
             //Find first non-matching dir
407
-            if ($dir === $path[$depth]) {
407
+            if ($dir === $path[$depth]){
408 408
                 //Ignore this directory
409 409
                 array_shift($relative);
410
-            } else {
410
+            }else{
411 411
                 //Get number of remaining dirs to $from
412 412
                 $remaining = count($from) - $depth;
413
-                if ($remaining > 1) {
413
+                if ($remaining > 1){
414 414
                     //Add traversals up to first matching directory
415 415
                     $padLength = (count($relative) + $remaining - 1) * -1;
416 416
                     $relative = array_pad($relative, $padLength, '..');
417 417
                     break;
418 418
                 }
419
-                $relative[0] = './' . $relative[0];
419
+                $relative[0] = './'.$relative[0];
420 420
             }
421 421
         }
422 422
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
     private function filesIterator(string $location, string $pattern = null): \GlobIterator
433 433
     {
434 434
         $pattern = $pattern ?? '*';
435
-        $regexp = rtrim($location, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . ltrim($pattern, DIRECTORY_SEPARATOR);
435
+        $regexp = rtrim($location, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.ltrim($pattern, DIRECTORY_SEPARATOR);
436 436
 
437 437
         return new \GlobIterator($regexp);
438 438
     }
Please login to merge, or discard this patch.
Braces   +73 added lines, -35 removed lines patch added patch discarded remove patch
@@ -45,7 +45,8 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function __destruct()
47 47
     {
48
-        foreach ($this->destructFiles as $filename) {
48
+        foreach ($this->destructFiles as $filename)
49
+        {
49 50
             $this->delete($filename);
50 51
         }
51 52
     }
@@ -60,30 +61,36 @@  discard block
 block discarded – undo
60 61
         int $mode = null,
61 62
         bool $recursivePermissions = true
62 63
     ): bool {
63
-        if (empty($mode)) {
64
+        if (empty($mode))
65
+        {
64 66
             $mode = self::DEFAULT_FILE_MODE;
65 67
         }
66 68
 
67 69
         //Directories always executable
68 70
         $mode = $mode | 0111;
69
-        if (is_dir($directory)) {
71
+        if (is_dir($directory))
72
+        {
70 73
             //Exists :(
71 74
             return $this->setPermissions($directory, $mode);
72 75
         }
73 76
 
74
-        if (!$recursivePermissions) {
77
+        if (!$recursivePermissions)
78
+        {
75 79
             return mkdir($directory, $mode, true);
76 80
         }
77 81
 
78 82
         $directoryChain = [basename($directory)];
79 83
 
80 84
         $baseDirectory = $directory;
81
-        while (!is_dir($baseDirectory = dirname($baseDirectory))) {
85
+        while (!is_dir($baseDirectory = dirname($baseDirectory)))
86
+        {
82 87
             $directoryChain[] = basename($baseDirectory);
83 88
         }
84 89
 
85
-        foreach (array_reverse($directoryChain) as $directory) {
86
-            if (!mkdir($baseDirectory = "{$baseDirectory}/{$directory}")) {
90
+        foreach (array_reverse($directoryChain) as $directory)
91
+        {
92
+            if (!mkdir($baseDirectory = "{$baseDirectory}/{$directory}"))
93
+            {
87 94
                 return false;
88 95
             }
89 96
 
@@ -98,7 +105,8 @@  discard block
 block discarded – undo
98 105
      */
99 106
     public function read(string $filename): string
100 107
     {
101
-        if (!$this->exists($filename)) {
108
+        if (!$this->exists($filename))
109
+        {
102 110
             throw new FileNotFoundException($filename);
103 111
         }
104 112
 
@@ -119,12 +127,15 @@  discard block
 block discarded – undo
119 127
     ): bool {
120 128
         $mode = $mode ?? self::DEFAULT_FILE_MODE;
121 129
 
122
-        try {
123
-            if ($ensureDirectory) {
130
+        try
131
+        {
132
+            if ($ensureDirectory)
133
+            {
124 134
                 $this->ensureDirectory(dirname($filename), $mode);
125 135
             }
126 136
 
127
-            if ($this->exists($filename)) {
137
+            if ($this->exists($filename))
138
+            {
128 139
                 //Forcing mode for existed file
129 140
                 $this->setPermissions($filename, $mode);
130 141
             }
@@ -135,11 +146,14 @@  discard block
 block discarded – undo
135 146
                 $append ? FILE_APPEND | LOCK_EX : LOCK_EX
136 147
             );
137 148
 
138
-            if ($result !== false) {
149
+            if ($result !== false)
150
+            {
139 151
                 //Forcing mode after file creation
140 152
                 $this->setPermissions($filename, $mode);
141 153
             }
142
-        } catch (\Exception $e) {
154
+        }
155
+        catch (\Exception $e)
156
+        {
143 157
             throw new WriteErrorException($e->getMessage(), $e->getCode(), $e);
144 158
         }
145 159
 
@@ -163,7 +177,8 @@  discard block
 block discarded – undo
163 177
      */
164 178
     public function delete(string $filename)
165 179
     {
166
-        if ($this->exists($filename)) {
180
+        if ($this->exists($filename))
181
+        {
167 182
             $result = unlink($filename);
168 183
 
169 184
             //Wiping out changes in local file cache
@@ -187,7 +202,8 @@  discard block
 block discarded – undo
187 202
      */
188 203
     public function deleteDirectory(string $directory, bool $contentOnly = false): void
189 204
     {
190
-        if (!$this->isDirectory($directory)) {
205
+        if (!$this->isDirectory($directory))
206
+        {
191 207
             throw new FilesException("Undefined or invalid directory {$directory}");
192 208
         }
193 209
 
@@ -196,15 +212,20 @@  discard block
 block discarded – undo
196 212
             \RecursiveIteratorIterator::CHILD_FIRST
197 213
         );
198 214
 
199
-        foreach ($files as $file) {
200
-            if ($file->isDir()) {
215
+        foreach ($files as $file)
216
+        {
217
+            if ($file->isDir())
218
+            {
201 219
                 rmdir($file->getRealPath());
202
-            } else {
220
+            }
221
+            else
222
+            {
203 223
                 $this->delete($file->getRealPath());
204 224
             }
205 225
         }
206 226
 
207
-        if (!$contentOnly) {
227
+        if (!$contentOnly)
228
+        {
208 229
             rmdir($directory);
209 230
         }
210 231
     }
@@ -214,7 +235,8 @@  discard block
 block discarded – undo
214 235
      */
215 236
     public function move(string $filename, string $destination): bool
216 237
     {
217
-        if (!$this->exists($filename)) {
238
+        if (!$this->exists($filename))
239
+        {
218 240
             throw new FileNotFoundException($filename);
219 241
         }
220 242
 
@@ -226,7 +248,8 @@  discard block
 block discarded – undo
226 248
      */
227 249
     public function copy(string $filename, string $destination): bool
228 250
     {
229
-        if (!$this->exists($filename)) {
251
+        if (!$this->exists($filename))
252
+        {
230 253
             throw new FileNotFoundException($filename);
231 254
         }
232 255
 
@@ -238,7 +261,8 @@  discard block
 block discarded – undo
238 261
      */
239 262
     public function touch(string $filename, int $mode = null): bool
240 263
     {
241
-        if (!touch($filename)) {
264
+        if (!touch($filename))
265
+        {
242 266
             return false;
243 267
         }
244 268
 
@@ -258,7 +282,8 @@  discard block
 block discarded – undo
258 282
      */
259 283
     public function size(string $filename): int
260 284
     {
261
-        if (!$this->exists($filename)) {
285
+        if (!$this->exists($filename))
286
+        {
262 287
             throw new FileNotFoundException($filename);
263 288
         }
264 289
 
@@ -278,7 +303,8 @@  discard block
 block discarded – undo
278 303
      */
279 304
     public function md5(string $filename): string
280 305
     {
281
-        if (!$this->exists($filename)) {
306
+        if (!$this->exists($filename))
307
+        {
282 308
             throw new FileNotFoundException($filename);
283 309
         }
284 310
 
@@ -290,7 +316,8 @@  discard block
 block discarded – undo
290 316
      */
291 317
     public function time(string $filename): int
292 318
     {
293
-        if (!$this->exists($filename)) {
319
+        if (!$this->exists($filename))
320
+        {
294 321
             throw new FileNotFoundException($filename);
295 322
         }
296 323
 
@@ -318,7 +345,8 @@  discard block
 block discarded – undo
318 345
      */
319 346
     public function getPermissions(string $filename): int
320 347
     {
321
-        if (!$this->exists($filename)) {
348
+        if (!$this->exists($filename))
349
+        {
322 350
             throw new FileNotFoundException($filename);
323 351
         }
324 352
 
@@ -330,7 +358,8 @@  discard block
 block discarded – undo
330 358
      */
331 359
     public function setPermissions(string $filename, int $mode)
332 360
     {
333
-        if (is_dir($filename)) {
361
+        if (is_dir($filename))
362
+        {
334 363
             //Directories must always be executable (i.e. 664 for dir => 775)
335 364
             $mode |= 0111;
336 365
         }
@@ -344,8 +373,10 @@  discard block
 block discarded – undo
344 373
     public function getFiles(string $location, string $pattern = null): array
345 374
     {
346 375
         $result = [];
347
-        foreach ($this->filesIterator($location, $pattern) as $filename) {
348
-            if ($this->isDirectory($filename->getPathname())) {
376
+        foreach ($this->filesIterator($location, $pattern) as $filename)
377
+        {
378
+            if ($this->isDirectory($filename->getPathname()))
379
+            {
349 380
                 $result = array_merge($result, $this->getFiles($filename . DIRECTORY_SEPARATOR));
350 381
 
351 382
                 continue;
@@ -362,13 +393,15 @@  discard block
 block discarded – undo
362 393
      */
363 394
     public function tempFilename(string $extension = '', string $location = null): string
364 395
     {
365
-        if (empty($location)) {
396
+        if (empty($location))
397
+        {
366 398
             $location = sys_get_temp_dir();
367 399
         }
368 400
 
369 401
         $filename = tempnam($location, 'spiral');
370 402
 
371
-        if (!empty($extension)) {
403
+        if (!empty($extension))
404
+        {
372 405
             [$old, $filename] = [$filename, "{$filename}.{$extension}"];
373 406
             rename($old, $filename);
374 407
             $this->destructFiles[] = $filename;
@@ -402,15 +435,20 @@  discard block
 block discarded – undo
402 435
         $path = explode('/', $path);
403 436
         $relative = $path;
404 437
 
405
-        foreach ($from as $depth => $dir) {
438
+        foreach ($from as $depth => $dir)
439
+        {
406 440
             //Find first non-matching dir
407
-            if ($dir === $path[$depth]) {
441
+            if ($dir === $path[$depth])
442
+            {
408 443
                 //Ignore this directory
409 444
                 array_shift($relative);
410
-            } else {
445
+            }
446
+            else
447
+            {
411 448
                 //Get number of remaining dirs to $from
412 449
                 $remaining = count($from) - $depth;
413
-                if ($remaining > 1) {
450
+                if ($remaining > 1)
451
+                {
414 452
                     //Add traversals up to first matching directory
415 453
                     $padLength = (count($relative) + $remaining - 1) * -1;
416 454
                     $relative = array_pad($relative, $padLength, '..');
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
     /**
24 24
      * Default file mode for this manager.
25 25
      */
26
-    public const DEFAULT_FILE_MODE = self::READONLY;
26
+    public const DEFAULT_FILE_MODE = self::readonly;
27 27
 
28 28
     /**
29 29
      * Files to be removed when component destructed.
Please login to merge, or discard this patch.
src/Attributes/src/Internal/Instantiator/DoctrineInstantiator.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      * @var string
31 31
      */
32 32
     private const ERROR_INVALID_PROPERTY =
33
-        'The attribute #[%s] declared on %s does not have a property named "%s".' . "\n" .
33
+        'The attribute #[%s] declared on %s does not have a property named "%s".'."\n".
34 34
         'Available properties: %s'
35 35
     ;
36 36
 
@@ -61,23 +61,23 @@  discard block
 block discarded – undo
61 61
         $arguments = $this->formatArguments($arguments);
62 62
 
63 63
         // Using constructor
64
-        if ($this->getConstructor($attr)) {
64
+        if ($this->getConstructor($attr)){
65 65
             return $attr->newInstance($arguments);
66 66
         }
67 67
 
68 68
         // Using direct insert
69 69
         $instance = $attr->newInstanceWithoutConstructor();
70 70
 
71
-        foreach ($arguments as $name => $value) {
72
-            try {
71
+        foreach ($arguments as $name => $value){
72
+            try{
73 73
                 $property = $attr->getProperty($name);
74 74
 
75
-                if (!$property->isPublic()) {
75
+                if (!$property->isPublic()){
76 76
                     throw $this->propertyNotFound($attr, $name, $context);
77 77
                 }
78 78
 
79 79
                 $instance->$name = $value;
80
-            } catch (\Throwable $e) {
80
+            }catch (\Throwable $e){
81 81
                 throw $this->propertyNotFound($attr, $name, $context);
82 82
             }
83 83
         }
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
     {
94 94
         $result = [];
95 95
 
96
-        foreach ($arguments as $name => $value) {
97
-            if (\is_int($name)) {
96
+        foreach ($arguments as $name => $value){
97
+            if (\is_int($name)){
98 98
                 $this->validateArgumentPosition($name, $value);
99 99
 
100 100
                 $name = self::DEFAULT_PROPERTY_NAME;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      */
113 113
     private function validateArgumentPosition(int $index, $value): void
114 114
     {
115
-        if ($index === 0) {
115
+        if ($index === 0){
116 116
             return;
117 117
         }
118 118
 
Please login to merge, or discard this patch.
Braces   +17 added lines, -8 removed lines patch added patch discarded remove patch
@@ -61,23 +61,29 @@  discard block
 block discarded – undo
61 61
         $arguments = $this->formatArguments($arguments);
62 62
 
63 63
         // Using constructor
64
-        if ($this->getConstructor($attr)) {
64
+        if ($this->getConstructor($attr))
65
+        {
65 66
             return $attr->newInstance($arguments);
66 67
         }
67 68
 
68 69
         // Using direct insert
69 70
         $instance = $attr->newInstanceWithoutConstructor();
70 71
 
71
-        foreach ($arguments as $name => $value) {
72
-            try {
72
+        foreach ($arguments as $name => $value)
73
+        {
74
+            try
75
+            {
73 76
                 $property = $attr->getProperty($name);
74 77
 
75
-                if (!$property->isPublic()) {
78
+                if (!$property->isPublic())
79
+                {
76 80
                     throw $this->propertyNotFound($attr, $name, $context);
77 81
                 }
78 82
 
79 83
                 $instance->$name = $value;
80
-            } catch (\Throwable $e) {
84
+            }
85
+            catch (\Throwable $e)
86
+            {
81 87
                 throw $this->propertyNotFound($attr, $name, $context);
82 88
             }
83 89
         }
@@ -93,8 +99,10 @@  discard block
 block discarded – undo
93 99
     {
94 100
         $result = [];
95 101
 
96
-        foreach ($arguments as $name => $value) {
97
-            if (\is_int($name)) {
102
+        foreach ($arguments as $name => $value)
103
+        {
104
+            if (\is_int($name))
105
+            {
98 106
                 $this->validateArgumentPosition($name, $value);
99 107
 
100 108
                 $name = self::DEFAULT_PROPERTY_NAME;
@@ -112,7 +120,8 @@  discard block
 block discarded – undo
112 120
      */
113 121
     private function validateArgumentPosition(int $index, $value): void
114 122
     {
115
-        if ($index === 0) {
123
+        if ($index === 0)
124
+        {
116 125
             return;
117 126
         }
118 127
 
Please login to merge, or discard this patch.
src/SendIt/views/builder.dark.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 $_msg_->subject(\Spiral\SendIt\Renderer\ViewRenderer::escapeSubject(inject('subject')));
9 9
 
10
-if (injected('from')) {
10
+if (injected('from')){
11 11
     $_msg_->from(\Symfony\Component\Mime\Address::create(inject('from')));
12 12
 }
13 13
 
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
 
20 20
 ob_start(); ?>${html}<?php $_html_ = ob_get_clean();
21 21
 
22
-if (!empty($_html_)) {
22
+if (!empty($_html_)){
23 23
     $_msg_->html($_html_);
24 24
 }
25 25
 
26 26
 ob_start(); ?>${text}<?php $_text_ = ob_get_clean();
27 27
 
28
-if (!empty($_text_)) {
28
+if (!empty($_text_)){
29 29
     $_msg_->text($_text_);
30 30
 }
31 31
 ?>
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,7 +7,8 @@  discard block
 block discarded – undo
7 7
  */
8 8
 $_msg_->subject(\Spiral\SendIt\Renderer\ViewRenderer::escapeSubject(inject('subject')));
9 9
 
10
-if (injected('from')) {
10
+if (injected('from'))
11
+{
11 12
     $_msg_->from(\Symfony\Component\Mime\Address::create(inject('from')));
12 13
 }
13 14
 
@@ -19,13 +20,15 @@  discard block
 block discarded – undo
19 20
 
20 21
 ob_start(); ?>${html}<?php $_html_ = ob_get_clean();
21 22
 
22
-if (!empty($_html_)) {
23
+if (!empty($_html_))
24
+{
23 25
     $_msg_->html($_html_);
24 26
 }
25 27
 
26 28
 ob_start(); ?>${text}<?php $_text_ = ob_get_clean();
27 29
 
28
-if (!empty($_text_)) {
30
+if (!empty($_text_))
31
+{
29 32
     $_msg_->text($_text_);
30 33
 }
31 34
 ?>
Please login to merge, or discard this patch.
src/Config/tests/fixtures/broken.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,4 +7,4 @@
 block discarded – undo
7 7
  * @author    Anton Titov (Wolfy-J)
8 8
  */
9 9
 
10
-return ;
10
+return;
Please login to merge, or discard this patch.
src/Validation/src/Checker/DatetimeChecker/ThresholdChecker.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         bool $useMicroSeconds = false
23 23
     ): bool {
24 24
         $compare = $this->compare($this->date($value), $this->date($threshold), $useMicroSeconds);
25
-        if (is_bool($compare)) {
25
+        if (is_bool($compare)){
26 26
             return $compare;
27 27
         }
28 28
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         bool $useMicroSeconds = false
46 46
     ): bool {
47 47
         $compare = $this->compare($this->date($value), $this->date($threshold), $useMicroSeconds);
48
-        if (is_bool($compare)) {
48
+        if (is_bool($compare)){
49 49
             return $compare;
50 50
         }
51 51
 
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
      */
59 59
     private function date($value): ?\DateTimeImmutable
60 60
     {
61
-        if ($value instanceof \DateTimeImmutable) {
61
+        if ($value instanceof \DateTimeImmutable){
62 62
             return $value;
63 63
         }
64 64
 
65
-        if ($value instanceof \DateTime) {
65
+        if ($value instanceof \DateTime){
66 66
             return \DateTimeImmutable::createFromMutable($value);
67 67
         }
68 68
 
@@ -77,15 +77,15 @@  discard block
 block discarded – undo
77 77
      */
78 78
     private function compare(?\DateTimeImmutable $date, ?\DateTimeImmutable $threshold, bool $useMicroseconds)
79 79
     {
80
-        if ($date === null) {
80
+        if ($date === null){
81 81
             return false;
82 82
         }
83 83
 
84
-        if ($threshold === null) {
84
+        if ($threshold === null){
85 85
             return true;
86 86
         }
87 87
 
88
-        if (!$useMicroseconds) {
88
+        if (!$useMicroseconds){
89 89
             $date = $this->dropMicroSeconds($date);
90 90
             $threshold = $this->dropMicroSeconds($threshold);
91 91
         }
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,7 +22,8 @@  discard block
 block discarded – undo
22 22
         bool $useMicroSeconds = false
23 23
     ): bool {
24 24
         $compare = $this->compare($this->date($value), $this->date($threshold), $useMicroSeconds);
25
-        if (is_bool($compare)) {
25
+        if (is_bool($compare))
26
+        {
26 27
             return $compare;
27 28
         }
28 29
 
@@ -45,7 +46,8 @@  discard block
 block discarded – undo
45 46
         bool $useMicroSeconds = false
46 47
     ): bool {
47 48
         $compare = $this->compare($this->date($value), $this->date($threshold), $useMicroSeconds);
48
-        if (is_bool($compare)) {
49
+        if (is_bool($compare))
50
+        {
49 51
             return $compare;
50 52
         }
51 53
 
@@ -58,11 +60,13 @@  discard block
 block discarded – undo
58 60
      */
59 61
     private function date($value): ?\DateTimeImmutable
60 62
     {
61
-        if ($value instanceof \DateTimeImmutable) {
63
+        if ($value instanceof \DateTimeImmutable)
64
+        {
62 65
             return $value;
63 66
         }
64 67
 
65
-        if ($value instanceof \DateTime) {
68
+        if ($value instanceof \DateTime)
69
+        {
66 70
             return \DateTimeImmutable::createFromMutable($value);
67 71
         }
68 72
 
@@ -77,15 +81,18 @@  discard block
 block discarded – undo
77 81
      */
78 82
     private function compare(?\DateTimeImmutable $date, ?\DateTimeImmutable $threshold, bool $useMicroseconds)
79 83
     {
80
-        if ($date === null) {
84
+        if ($date === null)
85
+        {
81 86
             return false;
82 87
         }
83 88
 
84
-        if ($threshold === null) {
89
+        if ($threshold === null)
90
+        {
85 91
             return true;
86 92
         }
87 93
 
88
-        if (!$useMicroseconds) {
94
+        if (!$useMicroseconds)
95
+        {
89 96
             $date = $this->dropMicroSeconds($date);
90 97
             $threshold = $this->dropMicroSeconds($threshold);
91 98
         }
Please login to merge, or discard this patch.