Passed
Pull Request — master (#1218)
by butschster
11:03
created
src/Boot/tests/ConfigsTest.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     {
19 19
         $core = TestCore::create([
20 20
             'root' => __DIR__,
21
-            'config' => __DIR__ . '/config',
21
+            'config' => __DIR__.'/config',
22 22
         ])->run();
23 23
 
24 24
         /** @var TestConfig $testConfig */
@@ -35,16 +35,16 @@  discard block
 block discarded – undo
35 35
     {
36 36
         $core = TestCore::create([
37 37
             'root' => __DIR__,
38
-            'config' => __DIR__ . '/config',
38
+            'config' => __DIR__.'/config',
39 39
         ])->run();
40 40
 
41 41
         $core->getContainer()->bindSingleton(
42 42
             DirectoriesRepositoryInterface::class,
43 43
             static function (DirectoriesInterface $dirs): DirectoriesRepositoryInterface {
44
-                return new class($dirs->get('config')) implements DirectoriesRepositoryInterface {
44
+                return new class($dirs->get('config')) implements DirectoriesRepositoryInterface{
45 45
                     public function __construct(
46 46
                         private string $rootDir,
47
-                    ) {}
47
+                    ){}
48 48
 
49 49
 
50 50
                     public function getIterator(): Traversable
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     {
70 70
         $core = TestCore::create([
71 71
             'root' => __DIR__,
72
-            'config' => __DIR__ . '/config',
72
+            'config' => __DIR__.'/config',
73 73
         ])->run();
74 74
 
75 75
         /** @var ConfiguratorInterface $configurator */
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,10 +41,12 @@
 block discarded – undo
41 41
         $core->getContainer()->bindSingleton(
42 42
             DirectoriesRepositoryInterface::class,
43 43
             static function (DirectoriesInterface $dirs): DirectoriesRepositoryInterface {
44
-                return new class($dirs->get('config')) implements DirectoriesRepositoryInterface {
44
+                return new class($dirs->get('config')) implements DirectoriesRepositoryInterface
45
+                {
45 46
                     public function __construct(
46 47
                         private string $rootDir,
47
-                    ) {}
48
+                    ) {
49
+}
48 50
 
49 51
 
50 52
                     public function getIterator(): Traversable
Please login to merge, or discard this patch.
src/Boot/tests/Fixtures/ConfigBootloader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 
60 60
         $configuration->addLoader('yaml', $container->get(TestLoader::class));
61 61
         $configuration->setDirectories([
62
-            $directories->get('config') . '/prod',
62
+            $directories->get('config').'/prod',
63 63
             $directories->get('config'),
64 64
         ]);
65 65
     }
Please login to merge, or discard this patch.
src/Boot/src/Bootloader/ConfigurationBootloader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 {
30 30
     public function __construct(
31 31
         private readonly ContainerInterface $container,
32
-    ) {}
32
+    ){}
33 33
 
34 34
     public function defineSingletons(): array
35 35
     {
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,8 @@
 block discarded – undo
29 29
 {
30 30
     public function __construct(
31 31
         private readonly ContainerInterface $container,
32
-    ) {}
32
+    ) {
33
+}
33 34
 
34 35
     public function defineSingletons(): array
35 36
     {
Please login to merge, or discard this patch.
src/Config/src/Loader/FileLoaderRegistry.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@
 block discarded – undo
15 15
     public function __construct(
16 16
         /**@var array<non-empty-string, FileLoaderInterface> */
17 17
         private array $loaders = [],
18
-    ) {}
18
+    ){}
19 19
 
20 20
     /**
21 21
      * @param non-empty-string $ext
22 22
      */
23 23
     public function register(string $ext, FileLoaderInterface $loader): void
24 24
     {
25
-        if (!isset($this->loaders[$ext]) || $this->loaders[$ext]::class !== $loader::class) {
25
+        if (!isset($this->loaders[$ext]) || $this->loaders[$ext]::class !== $loader::class){
26 26
             $this->loaders[$ext] = $loader;
27 27
         }
28 28
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,14 +15,16 @@
 block discarded – undo
15 15
     public function __construct(
16 16
         /**@var array<non-empty-string, FileLoaderInterface> */
17 17
         private array $loaders = [],
18
-    ) {}
18
+    ) {
19
+}
19 20
 
20 21
     /**
21 22
      * @param non-empty-string $ext
22 23
      */
23 24
     public function register(string $ext, FileLoaderInterface $loader): void
24 25
     {
25
-        if (!isset($this->loaders[$ext]) || $this->loaders[$ext]::class !== $loader::class) {
26
+        if (!isset($this->loaders[$ext]) || $this->loaders[$ext]::class !== $loader::class)
27
+        {
26 28
             $this->loaders[$ext] = $loader;
27 29
         }
28 30
     }
Please login to merge, or discard this patch.
src/Config/src/Loader/SingleFileStrategyLoader.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,12 +17,12 @@  discard block
 block discarded – undo
17 17
     public function __construct(
18 18
         private readonly DirectoriesRepositoryInterface $directories,
19 19
         private readonly FileLoaderRegistry $fileLoader,
20
-    ) {}
20
+    ){}
21 21
 
22 22
     public function has(string $section): bool
23 23
     {
24
-        foreach ($this->fileLoader->getExtensions() as $extension) {
25
-            if ($this->findFile($section, $extension) !== null) {
24
+        foreach ($this->fileLoader->getExtensions() as $extension){
25
+            if ($this->findFile($section, $extension) !== null){
26 26
                 return true;
27 27
             }
28 28
         }
@@ -32,15 +32,15 @@  discard block
 block discarded – undo
32 32
 
33 33
     public function load(string $section): array
34 34
     {
35
-        foreach ($this->fileLoader->getExtensions() as $extension) {
35
+        foreach ($this->fileLoader->getExtensions() as $extension){
36 36
             $filename = $this->findFile($section, $extension);
37
-            if ($filename === null) {
37
+            if ($filename === null){
38 38
                 continue;
39 39
             }
40 40
 
41
-            try {
41
+            try{
42 42
                 return $this->fileLoader->getLoader($extension)->loadFile($section, $filename);
43
-            } catch (LoaderException $e) {
43
+            }catch (LoaderException $e){
44 44
                 throw new LoaderException("Unable to load config `{$section}`: {$e->getMessage()}", $e->getCode(), $e);
45 45
             }
46 46
         }
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 
51 51
     private function findFile(string $section, string $extension): ?string
52 52
     {
53
-        foreach ($this->directories as $directory) {
53
+        foreach ($this->directories as $directory){
54 54
             $filename = \sprintf('%s/%s.%s', $directory, $section, $extension);
55
-            if (\file_exists($filename)) {
55
+            if (\file_exists($filename)){
56 56
                 return $filename;
57 57
             }
58 58
         }
Please login to merge, or discard this patch.
Braces   +19 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,12 +17,15 @@  discard block
 block discarded – undo
17 17
     public function __construct(
18 18
         private readonly DirectoriesRepositoryInterface $directories,
19 19
         private readonly FileLoaderRegistry $fileLoader,
20
-    ) {}
20
+    ) {
21
+}
21 22
 
22 23
     public function has(string $section): bool
23 24
     {
24
-        foreach ($this->fileLoader->getExtensions() as $extension) {
25
-            if ($this->findFile($section, $extension) !== null) {
25
+        foreach ($this->fileLoader->getExtensions() as $extension)
26
+        {
27
+            if ($this->findFile($section, $extension) !== null)
28
+            {
26 29
                 return true;
27 30
             }
28 31
         }
@@ -32,15 +35,20 @@  discard block
 block discarded – undo
32 35
 
33 36
     public function load(string $section): array
34 37
     {
35
-        foreach ($this->fileLoader->getExtensions() as $extension) {
38
+        foreach ($this->fileLoader->getExtensions() as $extension)
39
+        {
36 40
             $filename = $this->findFile($section, $extension);
37
-            if ($filename === null) {
41
+            if ($filename === null)
42
+            {
38 43
                 continue;
39 44
             }
40 45
 
41
-            try {
46
+            try
47
+            {
42 48
                 return $this->fileLoader->getLoader($extension)->loadFile($section, $filename);
43
-            } catch (LoaderException $e) {
49
+            }
50
+            catch (LoaderException $e)
51
+            {
44 52
                 throw new LoaderException("Unable to load config `{$section}`: {$e->getMessage()}", $e->getCode(), $e);
45 53
             }
46 54
         }
@@ -50,9 +58,11 @@  discard block
 block discarded – undo
50 58
 
51 59
     private function findFile(string $section, string $extension): ?string
52 60
     {
53
-        foreach ($this->directories as $directory) {
61
+        foreach ($this->directories as $directory)
62
+        {
54 63
             $filename = \sprintf('%s/%s.%s', $directory, $section, $extension);
55
-            if (\file_exists($filename)) {
64
+            if (\file_exists($filename))
65
+            {
56 66
                 return $filename;
57 67
             }
58 68
         }
Please login to merge, or discard this patch.
src/Config/src/Loader/MergeFileStrategyLoader.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
         private readonly DirectoriesRepositoryInterface $directories,
20 20
         private readonly FileLoaderRegistry $fileLoader,
21 21
         private readonly ConfigsMergerInterface $configsMerger,
22
-    ) {}
22
+    ){}
23 23
 
24 24
     public function has(string $section): bool
25 25
     {
26
-        foreach ($this->fileLoader->getExtensions() as $extension) {
27
-            if ($this->findFiles($section, $extension) !== []) {
26
+        foreach ($this->fileLoader->getExtensions() as $extension){
27
+            if ($this->findFiles($section, $extension) !== []){
28 28
                 return true;
29 29
             }
30 30
         }
@@ -36,30 +36,30 @@  discard block
 block discarded – undo
36 36
     {
37 37
         $files = [];
38 38
 
39
-        foreach ($this->fileLoader->getExtensions() as $extension) {
39
+        foreach ($this->fileLoader->getExtensions() as $extension){
40 40
             $foundFiles = $this->findFiles($section, $extension);
41 41
 
42
-            if ($foundFiles === []) {
42
+            if ($foundFiles === []){
43 43
                 continue;
44 44
             }
45 45
 
46
-            if (!isset($files[$extension])) {
46
+            if (!isset($files[$extension])){
47 47
                 $files[$extension] = [];
48 48
             }
49 49
 
50 50
             $files[$extension] = [...$files[$extension], ...$foundFiles];
51 51
         }
52 52
 
53
-        if ($files === []) {
53
+        if ($files === []){
54 54
             throw new LoaderException(\sprintf('Unable to load config `%s`: no suitable loader found.', $section));
55 55
         }
56 56
 
57 57
         $configs = [];
58
-        foreach ($files as $ext => $_files) {
59
-            foreach ($_files as $file) {
60
-                try {
58
+        foreach ($files as $ext => $_files){
59
+            foreach ($_files as $file){
60
+                try{
61 61
                     $configs[] = $this->fileLoader->getLoader($ext)->loadFile($section, $file);
62
-                } catch (LoaderException $e) {
62
+                }catch (LoaderException $e){
63 63
                     throw new LoaderException(
64 64
                         "Unable to load config `{$section}`: {$e->getMessage()}",
65 65
                         $e->getCode(),
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
     private function findFiles(string $section, string $extension): array
76 76
     {
77 77
         $files = [];
78
-        foreach ($this->directories as $directory) {
78
+        foreach ($this->directories as $directory){
79 79
             $filename = \sprintf('%s/%s.%s', $directory, $section, $extension);
80
-            if (\file_exists($filename)) {
80
+            if (\file_exists($filename)){
81 81
                 $files[] = $filename;
82 82
             }
83 83
         }
Please login to merge, or discard this patch.
Braces   +27 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,12 +19,15 @@  discard block
 block discarded – undo
19 19
         private readonly DirectoriesRepositoryInterface $directories,
20 20
         private readonly FileLoaderRegistry $fileLoader,
21 21
         private readonly ConfigsMergerInterface $configsMerger,
22
-    ) {}
22
+    ) {
23
+}
23 24
 
24 25
     public function has(string $section): bool
25 26
     {
26
-        foreach ($this->fileLoader->getExtensions() as $extension) {
27
-            if ($this->findFiles($section, $extension) !== []) {
27
+        foreach ($this->fileLoader->getExtensions() as $extension)
28
+        {
29
+            if ($this->findFiles($section, $extension) !== [])
30
+            {
28 31
                 return true;
29 32
             }
30 33
         }
@@ -36,30 +39,39 @@  discard block
 block discarded – undo
36 39
     {
37 40
         $files = [];
38 41
 
39
-        foreach ($this->fileLoader->getExtensions() as $extension) {
42
+        foreach ($this->fileLoader->getExtensions() as $extension)
43
+        {
40 44
             $foundFiles = $this->findFiles($section, $extension);
41 45
 
42
-            if ($foundFiles === []) {
46
+            if ($foundFiles === [])
47
+            {
43 48
                 continue;
44 49
             }
45 50
 
46
-            if (!isset($files[$extension])) {
51
+            if (!isset($files[$extension]))
52
+            {
47 53
                 $files[$extension] = [];
48 54
             }
49 55
 
50 56
             $files[$extension] = [...$files[$extension], ...$foundFiles];
51 57
         }
52 58
 
53
-        if ($files === []) {
59
+        if ($files === [])
60
+        {
54 61
             throw new LoaderException(\sprintf('Unable to load config `%s`: no suitable loader found.', $section));
55 62
         }
56 63
 
57 64
         $configs = [];
58
-        foreach ($files as $ext => $_files) {
59
-            foreach ($_files as $file) {
60
-                try {
65
+        foreach ($files as $ext => $_files)
66
+        {
67
+            foreach ($_files as $file)
68
+            {
69
+                try
70
+                {
61 71
                     $configs[] = $this->fileLoader->getLoader($ext)->loadFile($section, $file);
62
-                } catch (LoaderException $e) {
72
+                }
73
+                catch (LoaderException $e)
74
+                {
63 75
                     throw new LoaderException(
64 76
                         "Unable to load config `{$section}`: {$e->getMessage()}",
65 77
                         $e->getCode(),
@@ -75,9 +87,11 @@  discard block
 block discarded – undo
75 87
     private function findFiles(string $section, string $extension): array
76 88
     {
77 89
         $files = [];
78
-        foreach ($this->directories as $directory) {
90
+        foreach ($this->directories as $directory)
91
+        {
79 92
             $filename = \sprintf('%s/%s.%s', $directory, $section, $extension);
80
-            if (\file_exists($filename)) {
93
+            if (\file_exists($filename))
94
+            {
81 95
                 $files[] = $filename;
82 96
             }
83 97
         }
Please login to merge, or discard this patch.
src/Config/src/Loader/DirectoriesRepositoryInterface.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
 /**
8 8
  * @extends \IteratorAggregate<array-key, string>
9 9
  */
10
-interface DirectoriesRepositoryInterface extends \IteratorAggregate {}
10
+interface DirectoriesRepositoryInterface extends \IteratorAggregate{}
Please login to merge, or discard this patch.