Passed
Push — master ( 72934f...dfb406 )
by Aleksei
05:59 queued 26s
created
src/Config/src/Loader/JsonLoader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
         $content = \file_get_contents($filename);
14 14
         $data = \json_decode($content, true);
15 15
 
16
-        if (\is_null($data)) {
16
+        if (\is_null($data)){
17 17
             throw new LoaderException(\json_last_error_msg(), \json_last_error());
18 18
         }
19 19
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,8 @@
 block discarded – undo
13 13
         $content = \file_get_contents($filename);
14 14
         $data = \json_decode($content, true);
15 15
 
16
-        if (\is_null($data)) {
16
+        if (\is_null($data))
17
+        {
17 18
             throw new LoaderException(\json_last_error_msg(), \json_last_error());
18 19
         }
19 20
 
Please login to merge, or discard this patch.
src/Config/src/Loader/PhpLoader.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,15 +15,15 @@
 block discarded – undo
15 15
 {
16 16
     public function __construct(
17 17
         private readonly ContainerInterface $container
18
-    ) {
18
+    ){
19 19
     }
20 20
 
21 21
     public function loadFile(string $section, string $filename): array
22 22
     {
23
-        try {
23
+        try{
24 24
             return ContainerScope::runScope($this->container, static fn () => require $filename);
25
-        } catch (\Throwable $e) {
26
-            throw new LoaderException($e->getMessage(), (int) $e->getCode(), $e);
25
+        }catch (\Throwable $e){
26
+            throw new LoaderException($e->getMessage(), (int)$e->getCode(), $e);
27 27
         }
28 28
     }
29 29
 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,9 +20,12 @@
 block discarded – undo
20 20
 
21 21
     public function loadFile(string $section, string $filename): array
22 22
     {
23
-        try {
23
+        try
24
+        {
24 25
             return ContainerScope::runScope($this->container, static fn () => require $filename);
25
-        } catch (\Throwable $e) {
26
+        }
27
+        catch (\Throwable $e)
28
+        {
26 29
             throw new LoaderException($e->getMessage(), (int) $e->getCode(), $e);
27 30
         }
28 31
     }
Please login to merge, or discard this patch.
src/Config/src/Patch/Delete.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,26 +18,26 @@
 block discarded – undo
18 18
         string $position,
19 19
         private readonly ?string $key,
20 20
         private mixed $value = null
21
-    ) {
21
+    ){
22 22
         $this->position = $position === '.' ? '' : $position;
23 23
     }
24 24
 
25 25
     public function patch(array $config): array
26 26
     {
27
-        try {
27
+        try{
28 28
             $target = &$this->dotGet($config, $this->position);
29 29
 
30
-            if ($this->key !== null) {
30
+            if ($this->key !== null){
31 31
                 unset($target[$this->key]);
32
-            } else {
33
-                foreach ($target as $key => $value) {
34
-                    if ($value === $this->value) {
32
+            }else{
33
+                foreach ($target as $key => $value){
34
+                    if ($value === $this->value){
35 35
                         unset($target[$key]);
36 36
                         break;
37 37
                     }
38 38
                 }
39 39
             }
40
-        } catch (DotNotFoundException) {
40
+        }catch (DotNotFoundException){
41 41
             // doing nothing when section not found
42 42
         }
43 43
 
Please login to merge, or discard this patch.
Braces   +14 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,20 +24,28 @@
 block discarded – undo
24 24
 
25 25
     public function patch(array $config): array
26 26
     {
27
-        try {
27
+        try
28
+        {
28 29
             $target = &$this->dotGet($config, $this->position);
29 30
 
30
-            if ($this->key !== null) {
31
+            if ($this->key !== null)
32
+            {
31 33
                 unset($target[$this->key]);
32
-            } else {
33
-                foreach ($target as $key => $value) {
34
-                    if ($value === $this->value) {
34
+            }
35
+            else
36
+            {
37
+                foreach ($target as $key => $value)
38
+                {
39
+                    if ($value === $this->value)
40
+                    {
35 41
                         unset($target[$key]);
36 42
                         break;
37 43
                     }
38 44
                 }
39 45
             }
40
-        } catch (DotNotFoundException) {
46
+        }
47
+        catch (DotNotFoundException)
48
+        {
41 49
             // doing nothing when section not found
42 50
         }
43 51
 
Please login to merge, or discard this patch.
src/Config/src/Patch/Traits/DotTrait.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@
 block discarded – undo
14 14
     private function &dotGet(array &$data, string $name): mixed
15 15
     {
16 16
         //Generating path relative to a given name and prefix
17
-        $path = (!empty($this->prefix) ? $this->prefix . '.' : '') . $name;
18
-        if (empty($path)) {
17
+        $path = (!empty($this->prefix) ? $this->prefix.'.' : '').$name;
18
+        if (empty($path)){
19 19
             return $data;
20 20
         }
21 21
 
22 22
         $path = \explode('.', \rtrim($path, '.'));
23
-        foreach ($path as $step) {
24
-            if (!\is_array($data) || !\array_key_exists($step, $data)) {
23
+        foreach ($path as $step){
24
+            if (!\is_array($data) || !\array_key_exists($step, $data)){
25 25
                 throw new DotNotFoundException(\sprintf("Unable to find config element '%s'.", $name));
26 26
             }
27 27
             $data = &$data[$step];
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,13 +15,16 @@
 block discarded – undo
15 15
     {
16 16
         //Generating path relative to a given name and prefix
17 17
         $path = (!empty($this->prefix) ? $this->prefix . '.' : '') . $name;
18
-        if (empty($path)) {
18
+        if (empty($path))
19
+        {
19 20
             return $data;
20 21
         }
21 22
 
22 23
         $path = \explode('.', \rtrim($path, '.'));
23
-        foreach ($path as $step) {
24
-            if (!\is_array($data) || !\array_key_exists($step, $data)) {
24
+        foreach ($path as $step)
25
+        {
26
+            if (!\is_array($data) || !\array_key_exists($step, $data))
27
+            {
25 28
                 throw new DotNotFoundException(\sprintf("Unable to find config element '%s'.", $name));
26 29
             }
27 30
             $data = &$data[$step];
Please login to merge, or discard this patch.
src/Config/src/Patch/Append.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,21 +19,21 @@
 block discarded – undo
19 19
         string $position,
20 20
         private ?string $key,
21 21
         private mixed $value
22
-    ) {
22
+    ){
23 23
         $this->position = $position === '.' ? '' : $position;
24 24
     }
25 25
 
26 26
     public function patch(array $config): array
27 27
     {
28
-        try {
28
+        try{
29 29
             $target = &$this->dotGet($config, $this->position);
30 30
 
31
-            if ($this->key !== null) {
31
+            if ($this->key !== null){
32 32
                 $target[$this->key] = $this->value;
33
-            } else {
33
+            }else{
34 34
                 $target[] = $this->value;
35 35
             }
36
-        } catch (DotNotFoundException $e) {
36
+        }catch (DotNotFoundException $e){
37 37
             throw new PatchException($e->getMessage(), $e->getCode(), $e);
38 38
         }
39 39
 
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,15 +25,21 @@
 block discarded – undo
25 25
 
26 26
     public function patch(array $config): array
27 27
     {
28
-        try {
28
+        try
29
+        {
29 30
             $target = &$this->dotGet($config, $this->position);
30 31
 
31
-            if ($this->key !== null) {
32
+            if ($this->key !== null)
33
+            {
32 34
                 $target[$this->key] = $this->value;
33
-            } else {
35
+            }
36
+            else
37
+            {
34 38
                 $target[] = $this->value;
35 39
             }
36
-        } catch (DotNotFoundException $e) {
40
+        }
41
+        catch (DotNotFoundException $e)
42
+        {
37 43
             throw new PatchException($e->getMessage(), $e->getCode(), $e);
38 44
         }
39 45
 
Please login to merge, or discard this patch.
src/Config/src/ConfigManager.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     public function __construct(
23 23
         private readonly LoaderInterface $loader,
24 24
         private readonly bool $strict = true
25
-    ) {
25
+    ){
26 26
     }
27 27
 
28 28
     /**
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 
43 43
     public function setDefaults(string $section, array $data): void
44 44
     {
45
-        if (isset($this->defaults[$section])) {
45
+        if (isset($this->defaults[$section])){
46 46
             throw new ConfiguratorException(\sprintf('Unable to set default config `%s` more than once.', $section));
47 47
         }
48 48
 
49
-        if (isset($this->data[$section])) {
49
+        if (isset($this->data[$section])){
50 50
             throw new ConfigDeliveredException(
51 51
                 \sprintf('Unable to set default config `%s`, config has been loaded.', $section)
52 52
             );
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
 
58 58
     public function modify(string $section, PatchInterface $patch): array
59 59
     {
60
-        if (isset($this->instances[$section])) {
61
-            if ($this->strict) {
60
+        if (isset($this->instances[$section])){
61
+            if ($this->strict){
62 62
                 throw new ConfigDeliveredException(
63 63
                     \sprintf('Unable to patch config `%s`, config object has already been delivered.', $section)
64 64
                 );
@@ -69,27 +69,27 @@  discard block
 block discarded – undo
69 69
 
70 70
         $data = $this->getConfig($section);
71 71
 
72
-        try {
72
+        try{
73 73
             return $this->data[$section] = $patch->patch($data);
74
-        } catch (PatchException $e) {
74
+        }catch (PatchException $e){
75 75
             throw new PatchException(\sprintf('Unable to modify config `%s`.', $section), $e->getCode(), $e);
76 76
         }
77 77
     }
78 78
 
79 79
     public function getConfig(string $section = null): array
80 80
     {
81
-        if (isset($this->data[$section])) {
81
+        if (isset($this->data[$section])){
82 82
             return $this->data[$section];
83 83
         }
84 84
 
85
-        if (isset($this->defaults[$section])) {
85
+        if (isset($this->defaults[$section])){
86 86
             $data = [];
87
-            if ($this->loader->has($section)) {
87
+            if ($this->loader->has($section)){
88 88
                 $data = $this->loader->load($section);
89 89
             }
90 90
 
91 91
             $data = \array_merge($this->defaults[$section], $data);
92
-        } else {
92
+        }else{
93 93
             $data = $this->loader->load($section);
94 94
         }
95 95
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     public function createInjection(\ReflectionClass $class, string $context = null): object
100 100
     {
101 101
         $config = $class->getConstant('CONFIG');
102
-        if (isset($this->instances[$config])) {
102
+        if (isset($this->instances[$config])){
103 103
             return $this->instances[$config];
104 104
         }
105 105
 
Please login to merge, or discard this patch.
Braces   +24 added lines, -11 removed lines patch added patch discarded remove patch
@@ -42,11 +42,13 @@  discard block
 block discarded – undo
42 42
 
43 43
     public function setDefaults(string $section, array $data): void
44 44
     {
45
-        if (isset($this->defaults[$section])) {
45
+        if (isset($this->defaults[$section]))
46
+        {
46 47
             throw new ConfiguratorException(\sprintf('Unable to set default config `%s` more than once.', $section));
47 48
         }
48 49
 
49
-        if (isset($this->data[$section])) {
50
+        if (isset($this->data[$section]))
51
+        {
50 52
             throw new ConfigDeliveredException(
51 53
                 \sprintf('Unable to set default config `%s`, config has been loaded.', $section)
52 54
             );
@@ -57,8 +59,10 @@  discard block
 block discarded – undo
57 59
 
58 60
     public function modify(string $section, PatchInterface $patch): array
59 61
     {
60
-        if (isset($this->instances[$section])) {
61
-            if ($this->strict) {
62
+        if (isset($this->instances[$section]))
63
+        {
64
+            if ($this->strict)
65
+            {
62 66
                 throw new ConfigDeliveredException(
63 67
                     \sprintf('Unable to patch config `%s`, config object has already been delivered.', $section)
64 68
                 );
@@ -69,27 +73,35 @@  discard block
 block discarded – undo
69 73
 
70 74
         $data = $this->getConfig($section);
71 75
 
72
-        try {
76
+        try
77
+        {
73 78
             return $this->data[$section] = $patch->patch($data);
74
-        } catch (PatchException $e) {
79
+        }
80
+        catch (PatchException $e)
81
+        {
75 82
             throw new PatchException(\sprintf('Unable to modify config `%s`.', $section), $e->getCode(), $e);
76 83
         }
77 84
     }
78 85
 
79 86
     public function getConfig(string $section = null): array
80 87
     {
81
-        if (isset($this->data[$section])) {
88
+        if (isset($this->data[$section]))
89
+        {
82 90
             return $this->data[$section];
83 91
         }
84 92
 
85
-        if (isset($this->defaults[$section])) {
93
+        if (isset($this->defaults[$section]))
94
+        {
86 95
             $data = [];
87
-            if ($this->loader->has($section)) {
96
+            if ($this->loader->has($section))
97
+            {
88 98
                 $data = $this->loader->load($section);
89 99
             }
90 100
 
91 101
             $data = \array_merge($this->defaults[$section], $data);
92
-        } else {
102
+        }
103
+        else
104
+        {
93 105
             $data = $this->loader->load($section);
94 106
         }
95 107
 
@@ -99,7 +111,8 @@  discard block
 block discarded – undo
99 111
     public function createInjection(\ReflectionClass $class, string $context = null): object
100 112
     {
101 113
         $config = $class->getConstant('CONFIG');
102
-        if (isset($this->instances[$config])) {
114
+        if (isset($this->instances[$config]))
115
+        {
103 116
             return $this->instances[$config];
104 117
         }
105 118
 
Please login to merge, or discard this patch.
src/Router/tests/Loader/PhpFileLoaderTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,12 +29,12 @@
 block discarded – undo
29 29
     {
30 30
         $loader = new PhpFileLoader($this->container, $this->container);
31 31
 
32
-        $routes = $loader->load(\dirname(__DIR__) . '/Fixtures/file.php');
32
+        $routes = $loader->load(\dirname(__DIR__).'/Fixtures/file.php');
33 33
         $this->assertInstanceOf(RouteCollection::class, $routes);
34 34
         $this->assertCount(3, $routes);
35 35
 
36 36
         $this->expectException(LoaderLoadException::class);
37
-        $loader->load(\dirname(__DIR__) . '/Fixtures/unknown.php');
37
+        $loader->load(\dirname(__DIR__).'/Fixtures/unknown.php');
38 38
     }
39 39
 
40 40
     public function testSupports(): void
Please login to merge, or discard this patch.
src/Router/tests/Loader/Configurator/RoutingConfiguratorTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
         $this->assertCount(0, $routes->getCollection());
19 19
 
20
-        $routes->import(\dirname(__DIR__, 2) . '/Fixtures/file.php');
20
+        $routes->import(\dirname(__DIR__, 2).'/Fixtures/file.php');
21 21
 
22 22
         $this->assertCount(3, $routes->getCollection());
23 23
     }
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
         $this->assertCount(0, $routes->getCollection());
30 30
 
31
-        $routes->import(\dirname(__DIR__, 2) . '/Fixtures/file.php', 'php');
31
+        $routes->import(\dirname(__DIR__, 2).'/Fixtures/file.php', 'php');
32 32
 
33 33
         $this->assertCount(3, $routes->getCollection());
34 34
     }
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
         $this->assertCount(0, $routes->getCollection());
41 41
 
42
-        $routes->import(\dirname(__DIR__, 2) . '/Fixtures/file.php', 'yaml');
42
+        $routes->import(\dirname(__DIR__, 2).'/Fixtures/file.php', 'yaml');
43 43
 
44 44
         $this->assertCount(0, $routes->getCollection());
45 45
     }
Please login to merge, or discard this patch.
src/Router/tests/PipelineFactoryTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
             new Autowire('bar'),
72 72
         ]));
73 73
 
74
-        $handle = function (ServerRequestInterface $request, RequestHandlerInterface $handler) {
74
+        $handle = function (ServerRequestInterface $request, RequestHandlerInterface $handler){
75 75
             return $handler->handle($request);
76 76
         };
77 77
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,8 @@
 block discarded – undo
71 71
             new Autowire('bar'),
72 72
         ]));
73 73
 
74
-        $handle = function (ServerRequestInterface $request, RequestHandlerInterface $handler) {
74
+        $handle = function (ServerRequestInterface $request, RequestHandlerInterface $handler)
75
+        {
75 76
             return $handler->handle($request);
76 77
         };
77 78
 
Please login to merge, or discard this patch.