Passed
Push — master ( e1a877...53fca2 )
by Aleksei
14:14 queued 02:22
created
src/Security/tests/PermissionManagerTest.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,8 @@
 block discarded – undo
70 70
 
71 71
         $this->rules->method('has')->willReturn(true);
72 72
         $this->rules->method('get')
73
-            ->willReturnCallback(static function (...$args) use (&$series) {
73
+            ->willReturnCallback(static function (...$args) use (&$series)
74
+            {
74 75
                 [$expectedArgs, $return] = \array_shift($series);
75 76
                 self::assertSame($expectedArgs, $args);
76 77
 
Please login to merge, or discard this patch.
src/Translator/src/Translator.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
         /** @internal */
28 28
         private readonly IdentityTranslator $identityTranslator = new IdentityTranslator(),
29 29
         private readonly ?EventDispatcherInterface $dispatcher = null,
30
-    ) {
30
+    ){
31 31
         $this->locale = $this->config->getDefaultLocale();
32 32
         $this->catalogueManager->load($this->locale);
33 33
     }
@@ -49,18 +49,18 @@  discard block
 block discarded – undo
49 49
         string $postfix = '}',
50 50
     ): string {
51 51
         $replaces = [];
52
-        foreach ($values as $key => $value) {
52
+        foreach ($values as $key => $value){
53 53
             $value = (\is_array($value) || $value instanceof \Closure) ? '' : $value;
54 54
 
55
-            if (\is_object($value)) {
56
-                if (\method_exists($value, '__toString')) {
55
+            if (\is_object($value)){
56
+                if (\method_exists($value, '__toString')){
57 57
                     $value = $value->__toString();
58
-                } else {
58
+                }else{
59 59
                     $value = '';
60 60
                 }
61 61
             }
62 62
 
63
-            $replaces[$prefix . $key . $postfix] = $value;
63
+            $replaces[$prefix.$key.$postfix] = $value;
64 64
         }
65 65
 
66 66
         return \strtr($string, $replaces);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      */
86 86
     public function setLocale(string $locale): void
87 87
     {
88
-        if (!$this->catalogueManager->has($locale)) {
88
+        if (!$this->catalogueManager->has($locale)){
89 89
             throw new LocaleException($locale);
90 90
         }
91 91
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      */
130 130
     public function transChoice(
131 131
         string $id,
132
-        string|int $number,
132
+        string | int $number,
133 133
         array $parameters = [],
134 134
         ?string $domain = null,
135 135
         ?string $locale = null,
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         $domain ??= $this->config->getDefaultDomain();
138 138
         $locale ??= $this->locale;
139 139
 
140
-        try {
140
+        try{
141 141
             $message = $this->get($locale, $domain, $id);
142 142
 
143 143
             $pluralized = $this->identityTranslator->trans(
@@ -146,12 +146,12 @@  discard block
 block discarded – undo
146 146
                 null,
147 147
                 $locale,
148 148
             );
149
-        } catch (\InvalidArgumentException $e) {
149
+        }catch (\InvalidArgumentException $e){
150 150
             //Wrapping into more explanatory exception
151 151
             throw new PluralizationException($e->getMessage(), $e->getCode(), $e);
152 152
         }
153 153
 
154
-        if (empty($parameters['n']) && \is_numeric($number)) {
154
+        if (empty($parameters['n']) && \is_numeric($number)){
155 155
             $parameters['n'] = $number;
156 156
         }
157 157
 
@@ -163,18 +163,18 @@  discard block
 block discarded – undo
163 163
      */
164 164
     protected function get(string &$locale, string $domain, string $string): string
165 165
     {
166
-        if ($this->catalogueManager->get($locale)->has($domain, $string)) {
166
+        if ($this->catalogueManager->get($locale)->has($domain, $string)){
167 167
             return $this->catalogueManager->get($locale)->get($domain, $string);
168 168
         }
169 169
 
170 170
         $locale = $this->config->getFallbackLocale();
171 171
 
172
-        if ($this->catalogueManager->get($locale)->has($domain, $string)) {
172
+        if ($this->catalogueManager->get($locale)->has($domain, $string)){
173 173
             return $this->catalogueManager->get($locale)->get($domain, $string);
174 174
         }
175 175
 
176 176
         // we can automatically register message
177
-        if ($this->config->isAutoRegisterMessages()) {
177
+        if ($this->config->isAutoRegisterMessages()){
178 178
             $this->catalogueManager->get($locale)->set($domain, $string, $string);
179 179
             $this->catalogueManager->save($locale);
180 180
         }
Please login to merge, or discard this patch.
Braces   +24 added lines, -11 removed lines patch added patch discarded remove patch
@@ -49,13 +49,18 @@  discard block
 block discarded – undo
49 49
         string $postfix = '}',
50 50
     ): string {
51 51
         $replaces = [];
52
-        foreach ($values as $key => $value) {
52
+        foreach ($values as $key => $value)
53
+        {
53 54
             $value = (\is_array($value) || $value instanceof \Closure) ? '' : $value;
54 55
 
55
-            if (\is_object($value)) {
56
-                if (\method_exists($value, '__toString')) {
56
+            if (\is_object($value))
57
+            {
58
+                if (\method_exists($value, '__toString'))
59
+                {
57 60
                     $value = $value->__toString();
58
-                } else {
61
+                }
62
+                else
63
+                {
59 64
                     $value = '';
60 65
                 }
61 66
             }
@@ -85,7 +90,8 @@  discard block
 block discarded – undo
85 90
      */
86 91
     public function setLocale(string $locale): void
87 92
     {
88
-        if (!$this->catalogueManager->has($locale)) {
93
+        if (!$this->catalogueManager->has($locale))
94
+        {
89 95
             throw new LocaleException($locale);
90 96
         }
91 97
 
@@ -137,7 +143,8 @@  discard block
 block discarded – undo
137 143
         $domain ??= $this->config->getDefaultDomain();
138 144
         $locale ??= $this->locale;
139 145
 
140
-        try {
146
+        try
147
+        {
141 148
             $message = $this->get($locale, $domain, $id);
142 149
 
143 150
             $pluralized = $this->identityTranslator->trans(
@@ -146,12 +153,15 @@  discard block
 block discarded – undo
146 153
                 null,
147 154
                 $locale,
148 155
             );
149
-        } catch (\InvalidArgumentException $e) {
156
+        }
157
+        catch (\InvalidArgumentException $e)
158
+        {
150 159
             //Wrapping into more explanatory exception
151 160
             throw new PluralizationException($e->getMessage(), $e->getCode(), $e);
152 161
         }
153 162
 
154
-        if (empty($parameters['n']) && \is_numeric($number)) {
163
+        if (empty($parameters['n']) && \is_numeric($number))
164
+        {
155 165
             $parameters['n'] = $number;
156 166
         }
157 167
 
@@ -163,18 +173,21 @@  discard block
 block discarded – undo
163 173
      */
164 174
     protected function get(string &$locale, string $domain, string $string): string
165 175
     {
166
-        if ($this->catalogueManager->get($locale)->has($domain, $string)) {
176
+        if ($this->catalogueManager->get($locale)->has($domain, $string))
177
+        {
167 178
             return $this->catalogueManager->get($locale)->get($domain, $string);
168 179
         }
169 180
 
170 181
         $locale = $this->config->getFallbackLocale();
171 182
 
172
-        if ($this->catalogueManager->get($locale)->has($domain, $string)) {
183
+        if ($this->catalogueManager->get($locale)->has($domain, $string))
184
+        {
173 185
             return $this->catalogueManager->get($locale)->get($domain, $string);
174 186
         }
175 187
 
176 188
         // we can automatically register message
177
-        if ($this->config->isAutoRegisterMessages()) {
189
+        if ($this->config->isAutoRegisterMessages())
190
+        {
178 191
             $this->catalogueManager->get($locale)->set($domain, $string, $string);
179 192
             $this->catalogueManager->save($locale);
180 193
         }
Please login to merge, or discard this patch.
src/Views/src/Loader/PathParser.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     public function __construct(
16 16
         private readonly string $defaultNamespace,
17 17
         private readonly string $extension,
18
-    ) {}
18
+    ){}
19 19
 
20 20
     public function getExtension(): string
21 21
     {
@@ -49,21 +49,21 @@  discard block
 block discarded – undo
49 49
         );
50 50
 
51 51
         $namespace = $this->defaultNamespace;
52
-        if (!\str_contains((string) $filename, '.')) {
52
+        if (!\str_contains((string)$filename, '.')){
53 53
             //Force default extension
54
-            $filename .= '.' . $this->extension;
55
-        } elseif (!$this->match($filename)) {
54
+            $filename .= '.'.$this->extension;
55
+        } elseif (!$this->match($filename)){
56 56
             return null;
57 57
         }
58 58
 
59
-        if (\str_contains((string) $filename, LoaderInterface::NS_SEPARATOR)) {
60
-            [$namespace, $filename] = \explode(LoaderInterface::NS_SEPARATOR, (string) $filename);
59
+        if (\str_contains((string)$filename, LoaderInterface::NS_SEPARATOR)){
60
+            [$namespace, $filename] = \explode(LoaderInterface::NS_SEPARATOR, (string)$filename);
61 61
         }
62 62
 
63 63
         //Twig like namespaces
64
-        if (isset($filename[0]) && $filename[0] === '@') {
64
+        if (isset($filename[0]) && $filename[0] === '@'){
65 65
             $separator = \strpos($filename, '/');
66
-            if ($separator === false) {
66
+            if ($separator === false){
67 67
                 throw new PathException(\sprintf('Malformed view path "%s" (expecting "@namespace/name").', $path));
68 68
             }
69 69
 
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
      */
94 94
     private function validatePath(string $path): void
95 95
     {
96
-        if (empty($path)) {
96
+        if (empty($path)){
97 97
             throw new PathException('A view path is empty');
98 98
         }
99 99
 
100
-        if (\str_contains($path, "\0")) {
100
+        if (\str_contains($path, "\0")){
101 101
             throw new PathException('A view path cannot contain NUL bytes');
102 102
         }
103 103
 
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
         $parts = \explode('/', $path);
106 106
         $level = 0;
107 107
 
108
-        foreach ($parts as $part) {
109
-            if ($part === '..') {
108
+        foreach ($parts as $part){
109
+            if ($part === '..'){
110 110
                 --$level;
111
-            } elseif ($part !== '.') {
111
+            } elseif ($part !== '.'){
112 112
                 ++$level;
113 113
             }
114 114
 
115
-            if ($level < 0) {
115
+            if ($level < 0){
116 116
                 throw new PathException(\sprintf(
117 117
                     'Looks like you try to load a view outside configured directories (%s)',
118 118
                     $path,
Please login to merge, or discard this patch.
Braces   +26 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,7 +15,8 @@  discard block
 block discarded – undo
15 15
     public function __construct(
16 16
         private readonly string $defaultNamespace,
17 17
         private readonly string $extension,
18
-    ) {}
18
+    ) {
19
+}
19 20
 
20 21
     public function getExtension(): string
21 22
     {
@@ -49,21 +50,27 @@  discard block
 block discarded – undo
49 50
         );
50 51
 
51 52
         $namespace = $this->defaultNamespace;
52
-        if (!\str_contains((string) $filename, '.')) {
53
+        if (!\str_contains((string) $filename, '.'))
54
+        {
53 55
             //Force default extension
54 56
             $filename .= '.' . $this->extension;
55
-        } elseif (!$this->match($filename)) {
57
+        }
58
+        elseif (!$this->match($filename))
59
+        {
56 60
             return null;
57 61
         }
58 62
 
59
-        if (\str_contains((string) $filename, LoaderInterface::NS_SEPARATOR)) {
63
+        if (\str_contains((string) $filename, LoaderInterface::NS_SEPARATOR))
64
+        {
60 65
             [$namespace, $filename] = \explode(LoaderInterface::NS_SEPARATOR, (string) $filename);
61 66
         }
62 67
 
63 68
         //Twig like namespaces
64
-        if (isset($filename[0]) && $filename[0] === '@') {
69
+        if (isset($filename[0]) && $filename[0] === '@')
70
+        {
65 71
             $separator = \strpos($filename, '/');
66
-            if ($separator === false) {
72
+            if ($separator === false)
73
+            {
67 74
                 throw new PathException(\sprintf('Malformed view path "%s" (expecting "@namespace/name").', $path));
68 75
             }
69 76
 
@@ -93,11 +100,13 @@  discard block
 block discarded – undo
93 100
      */
94 101
     private function validatePath(string $path): void
95 102
     {
96
-        if (empty($path)) {
103
+        if (empty($path))
104
+        {
97 105
             throw new PathException('A view path is empty');
98 106
         }
99 107
 
100
-        if (\str_contains($path, "\0")) {
108
+        if (\str_contains($path, "\0"))
109
+        {
101 110
             throw new PathException('A view path cannot contain NUL bytes');
102 111
         }
103 112
 
@@ -105,14 +114,19 @@  discard block
 block discarded – undo
105 114
         $parts = \explode('/', $path);
106 115
         $level = 0;
107 116
 
108
-        foreach ($parts as $part) {
109
-            if ($part === '..') {
117
+        foreach ($parts as $part)
118
+        {
119
+            if ($part === '..')
120
+            {
110 121
                 --$level;
111
-            } elseif ($part !== '.') {
122
+            }
123
+            elseif ($part !== '.')
124
+            {
112 125
                 ++$level;
113 126
             }
114 127
 
115
-            if ($level < 0) {
128
+            if ($level < 0)
129
+            {
116 130
                 throw new PathException(\sprintf(
117 131
                     'Looks like you try to load a view outside configured directories (%s)',
118 132
                     $path,
Please login to merge, or discard this patch.
src/Cache/tests/Storage/FileStorageTest.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     public function testGetsWithExistsValueAndCacheFile(): void
26 26
     {
27 27
         $ttl = \time() + self::DEFAULT_TTL;
28
-        $value = $ttl . 's:3:"bar";';
28
+        $value = $ttl.'s:3:"bar";';
29 29
         $path = self::DEFAULT_PATH;
30 30
 
31 31
         $this->files->shouldReceive('read')->with($path)->andReturn($value);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     {
49 49
         $path = self::DEFAULT_PATH;
50 50
 
51
-        $this->files->shouldReceive('read')->with($path)->andReturn(\time() . 's:3:"bar";');
51
+        $this->files->shouldReceive('read')->with($path)->andReturn(\time().'s:3:"bar";');
52 52
         $this->files->shouldReceive('exists')->with($path)->andReturn(true);
53 53
         $this->files->shouldReceive('delete')->with($path)->andReturnTrue();
54 54
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     public function testGetsWithExistsValueWithDeadValue(): void
59 59
     {
60 60
         $ttl = \time() + self::DEFAULT_TTL;
61
-        $value = $ttl . 's:3:"barbar";';
61
+        $value = $ttl.'s:3:"barbar";';
62 62
         $path = self::DEFAULT_PATH;
63 63
 
64 64
         $this->files->shouldReceive('read')->with($path)->andReturn($value);
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     public function testSetsWithDefaultTTL(): void
72 72
     {
73 73
         $ttl = \time() + self::DEFAULT_TTL;
74
-        $value = $ttl . 's:3:"bar";';
74
+        $value = $ttl.'s:3:"bar";';
75 75
 
76 76
         $this->files->shouldReceive('write')->with(self::DEFAULT_PATH, $value, null, true)->andReturnTrue();
77 77
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     public function testSetsWithTTLInSeconds(): void
82 82
     {
83 83
         $ttl = \time() + 30;
84
-        $value = $ttl . 's:3:"bar";';
84
+        $value = $ttl.'s:3:"bar";';
85 85
 
86 86
         $this->files->shouldReceive('write')->with(self::DEFAULT_PATH, $value, null, true)->andReturnTrue();
87 87
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     public function testSetsWithTTLInDateInterval(): void
92 92
     {
93 93
         $ttl = \time() + 30;
94
-        $value = $ttl . 's:3:"bar";';
94
+        $value = $ttl.'s:3:"bar";';
95 95
 
96 96
         $this->files->shouldReceive('write')->with(self::DEFAULT_PATH, $value, null, true)->andReturnTrue();
97 97
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     public function testSetsWithTTLInDateTime(): void
102 102
     {
103 103
         $ttl = \time() + 30;
104
-        $value = $ttl . 's:3:"bar";';
104
+        $value = $ttl.'s:3:"bar";';
105 105
 
106 106
         $this->files->shouldReceive('write')->with(self::DEFAULT_PATH, $value, null, true)->andReturnTrue();
107 107
 
@@ -148,15 +148,15 @@  discard block
 block discarded – undo
148 148
     {
149 149
         $this->files->shouldReceive('read')->with(
150 150
             'path/to/cache/0b/ee/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33',
151
-        )->andReturn((\time() + self::DEFAULT_TTL) . 's:3:"abc";');
151
+        )->andReturn((\time() + self::DEFAULT_TTL).'s:3:"abc";');
152 152
 
153 153
         $this->files->shouldReceive('read')->with(
154 154
             'path/to/cache/62/cd/62cdb7020ff920e5aa642c3d4066950dd1f01f4d',
155
-        )->andReturn((\time() + self::DEFAULT_TTL) . 's:3:"cde";');
155
+        )->andReturn((\time() + self::DEFAULT_TTL).'s:3:"cde";');
156 156
 
157 157
         $this->files->shouldReceive('read')->with(
158 158
             'path/to/cache/bb/e9/bbe960a25ea311d21d40669e93df2003ba9b90a2',
159
-        )->andReturn((\time() + -1) . 's:3:"efg";');
159
+        )->andReturn((\time() + -1).'s:3:"efg";');
160 160
         $this->files->shouldReceive('exists')->with(
161 161
             'path/to/cache/bb/e9/bbe960a25ea311d21d40669e93df2003ba9b90a2',
162 162
         )->andReturnFalse();
@@ -173,15 +173,15 @@  discard block
 block discarded – undo
173 173
         $ttl = \time() + self::DEFAULT_TTL;
174 174
 
175 175
         $this->files->shouldReceive('write')
176
-            ->with('path/to/cache/0b/ee/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33', $ttl . 's:3:"baz";', null, true)
176
+            ->with('path/to/cache/0b/ee/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33', $ttl.'s:3:"baz";', null, true)
177 177
             ->andReturnTrue();
178 178
 
179 179
         $this->files->shouldReceive('write')
180
-            ->with('path/to/cache/62/cd/62cdb7020ff920e5aa642c3d4066950dd1f01f4d', $ttl . 's:3:"foo";', null, true)
180
+            ->with('path/to/cache/62/cd/62cdb7020ff920e5aa642c3d4066950dd1f01f4d', $ttl.'s:3:"foo";', null, true)
181 181
             ->andReturnTrue();
182 182
 
183 183
         $this->files->shouldReceive('write')
184
-            ->with('path/to/cache/bb/e9/bbe960a25ea311d21d40669e93df2003ba9b90a2', $ttl . 's:3:"bar";', null, true)
184
+            ->with('path/to/cache/bb/e9/bbe960a25ea311d21d40669e93df2003ba9b90a2', $ttl.'s:3:"bar";', null, true)
185 185
             ->andReturnTrue();
186 186
 
187 187
         self::assertTrue($this->storage->setMultiple([
@@ -196,15 +196,15 @@  discard block
 block discarded – undo
196 196
         $ttl = \time() + 30;
197 197
 
198 198
         $this->files->shouldReceive('write')
199
-            ->with('path/to/cache/0b/ee/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33', $ttl . 's:3:"baz";', null, true)
199
+            ->with('path/to/cache/0b/ee/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33', $ttl.'s:3:"baz";', null, true)
200 200
             ->andReturnTrue();
201 201
 
202 202
         $this->files->shouldReceive('write')
203
-            ->with('path/to/cache/62/cd/62cdb7020ff920e5aa642c3d4066950dd1f01f4d', $ttl . 's:3:"foo";', null, true)
203
+            ->with('path/to/cache/62/cd/62cdb7020ff920e5aa642c3d4066950dd1f01f4d', $ttl.'s:3:"foo";', null, true)
204 204
             ->andReturnTrue();
205 205
 
206 206
         $this->files->shouldReceive('write')
207
-            ->with('path/to/cache/bb/e9/bbe960a25ea311d21d40669e93df2003ba9b90a2', $ttl . 's:3:"bar";', null, true)
207
+            ->with('path/to/cache/bb/e9/bbe960a25ea311d21d40669e93df2003ba9b90a2', $ttl.'s:3:"bar";', null, true)
208 208
             ->andReturnTrue();
209 209
 
210 210
         self::assertTrue($this->storage->setMultiple([
Please login to merge, or discard this patch.
src/Cache/src/Core/CacheInjector.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,25 +18,25 @@  discard block
 block discarded – undo
18 18
 {
19 19
     public function __construct(
20 20
         private readonly CacheStorageProviderInterface $provider,
21
-    ) {}
21
+    ){}
22 22
 
23 23
     public function createInjection(\ReflectionClass $class, ?string $context = null): CacheInterface
24 24
     {
25
-        try {
26
-            if ($context === null) {
25
+        try{
26
+            if ($context === null){
27 27
                 $connection = $this->provider->storage();
28
-            } else {
28
+            }else{
29 29
                 // Get Cache by context
30
-                try {
30
+                try{
31 31
                     $connection = $this->provider->storage($context);
32
-                } catch (InvalidArgumentException) {
32
+                }catch (InvalidArgumentException){
33 33
                     // Case when context doesn't match to configured connections
34 34
                     return $this->provider->storage();
35 35
                 }
36 36
             }
37 37
 
38 38
             $this->matchType($class, $context, $connection);
39
-        } catch (\Throwable $e) {
39
+        }catch (\Throwable $e){
40 40
             throw new ContainerException(\sprintf("Can't inject the required cache. %s", $e->getMessage()), 0, $e);
41 41
         }
42 42
 
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
      */
51 51
     private function matchType(\ReflectionClass $class, ?string $context, CacheInterface $connection): void
52 52
     {
53
-        if ($connection::class === CacheRepository::class) {
53
+        if ($connection::class === CacheRepository::class){
54 54
             $connection = $connection->getStorage();
55 55
         }
56 56
         $className = $class->getName();
57
-        if ($className !== CacheInterface::class && !$connection instanceof $className) {
57
+        if ($className !== CacheInterface::class && !$connection instanceof $className){
58 58
             throw new \RuntimeException(
59 59
                 \sprintf(
60 60
                     "The cache obtained by the context `%s` doesn't match the type `%s`.",
Please login to merge, or discard this patch.
Braces   +21 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,25 +18,35 @@  discard block
 block discarded – undo
18 18
 {
19 19
     public function __construct(
20 20
         private readonly CacheStorageProviderInterface $provider,
21
-    ) {}
21
+    ) {
22
+}
22 23
 
23 24
     public function createInjection(\ReflectionClass $class, ?string $context = null): CacheInterface
24 25
     {
25
-        try {
26
-            if ($context === null) {
26
+        try
27
+        {
28
+            if ($context === null)
29
+            {
27 30
                 $connection = $this->provider->storage();
28
-            } else {
31
+            }
32
+            else
33
+            {
29 34
                 // Get Cache by context
30
-                try {
35
+                try
36
+                {
31 37
                     $connection = $this->provider->storage($context);
32
-                } catch (InvalidArgumentException) {
38
+                }
39
+                catch (InvalidArgumentException)
40
+                {
33 41
                     // Case when context doesn't match to configured connections
34 42
                     return $this->provider->storage();
35 43
                 }
36 44
             }
37 45
 
38 46
             $this->matchType($class, $context, $connection);
39
-        } catch (\Throwable $e) {
47
+        }
48
+        catch (\Throwable $e)
49
+        {
40 50
             throw new ContainerException(\sprintf("Can't inject the required cache. %s", $e->getMessage()), 0, $e);
41 51
         }
42 52
 
@@ -50,11 +60,13 @@  discard block
 block discarded – undo
50 60
      */
51 61
     private function matchType(\ReflectionClass $class, ?string $context, CacheInterface $connection): void
52 62
     {
53
-        if ($connection::class === CacheRepository::class) {
63
+        if ($connection::class === CacheRepository::class)
64
+        {
54 65
             $connection = $connection->getStorage();
55 66
         }
56 67
         $className = $class->getName();
57
-        if ($className !== CacheInterface::class && !$connection instanceof $className) {
68
+        if ($className !== CacheInterface::class && !$connection instanceof $className)
69
+        {
58 70
             throw new \RuntimeException(
59 71
                 \sprintf(
60 72
                     "The cache obtained by the context `%s` doesn't match the type `%s`.",
Please login to merge, or discard this patch.
src/Exceptions/tests/Renderer/RendererTest.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
         $handler = new ConsoleRenderer();
104 104
         $handler->setColorsSupport(true);
105 105
 
106
-        try {
106
+        try{
107 107
             $this->makeException();
108
-        } catch (\Throwable $e) {
108
+        }catch (\Throwable $e){
109 109
         }
110 110
 
111 111
         $result = $handler->render($e, \Spiral\Exceptions\Verbosity::DEBUG);
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
     {
119 119
         $handler = new PlainRenderer();
120 120
 
121
-        try {
121
+        try{
122 122
             $this->makeException();
123
-        } catch (\Throwable $e) {
123
+        }catch (\Throwable $e){
124 124
         }
125 125
 
126 126
         $result = $handler->render($e, \Spiral\Exceptions\Verbosity::DEBUG);
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
     {
134 134
         $handler = new JsonRenderer();
135 135
 
136
-        try {
136
+        try{
137 137
             $this->makeException();
138
-        } catch (\Throwable $e) {
138
+        }catch (\Throwable $e){
139 139
         }
140 140
 
141 141
         $result = $handler->render($e, \Spiral\Exceptions\Verbosity::DEBUG);
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
 
147 147
     public function makeException(): void
148 148
     {
149
-        try {
149
+        try{
150 150
             $f = static function (): void {
151 151
                 throw new \RuntimeException('error');
152 152
             };
153 153
 
154 154
             $f();
155
-        } catch (\Throwable $e) {
155
+        }catch (\Throwable $e){
156 156
             throw new \LogicException('error', 0, $e);
157 157
         }
158 158
     }
Please login to merge, or discard this patch.
Braces   +20 added lines, -8 removed lines patch added patch discarded remove patch
@@ -103,9 +103,12 @@  discard block
 block discarded – undo
103 103
         $handler = new ConsoleRenderer();
104 104
         $handler->setColorsSupport(true);
105 105
 
106
-        try {
106
+        try
107
+        {
107 108
             $this->makeException();
108
-        } catch (\Throwable $e) {
109
+        }
110
+        catch (\Throwable $e)
111
+        {
109 112
         }
110 113
 
111 114
         $result = $handler->render($e, \Spiral\Exceptions\Verbosity::DEBUG);
@@ -118,9 +121,12 @@  discard block
 block discarded – undo
118 121
     {
119 122
         $handler = new PlainRenderer();
120 123
 
121
-        try {
124
+        try
125
+        {
122 126
             $this->makeException();
123
-        } catch (\Throwable $e) {
127
+        }
128
+        catch (\Throwable $e)
129
+        {
124 130
         }
125 131
 
126 132
         $result = $handler->render($e, \Spiral\Exceptions\Verbosity::DEBUG);
@@ -133,9 +139,12 @@  discard block
 block discarded – undo
133 139
     {
134 140
         $handler = new JsonRenderer();
135 141
 
136
-        try {
142
+        try
143
+        {
137 144
             $this->makeException();
138
-        } catch (\Throwable $e) {
145
+        }
146
+        catch (\Throwable $e)
147
+        {
139 148
         }
140 149
 
141 150
         $result = $handler->render($e, \Spiral\Exceptions\Verbosity::DEBUG);
@@ -146,13 +155,16 @@  discard block
 block discarded – undo
146 155
 
147 156
     public function makeException(): void
148 157
     {
149
-        try {
158
+        try
159
+        {
150 160
             $f = static function (): void {
151 161
                 throw new \RuntimeException('error');
152 162
             };
153 163
 
154 164
             $f();
155
-        } catch (\Throwable $e) {
165
+        }
166
+        catch (\Throwable $e)
167
+        {
156 168
             throw new \LogicException('error', 0, $e);
157 169
         }
158 170
     }
Please login to merge, or discard this patch.
src/Boot/tests/FunctionsTest.php 1 patch
Spacing   +6 added lines, -6 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 ContainerInterface $c */
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     {
34 34
         $core = TestCore::create([
35 35
             'root'   => __DIR__,
36
-            'config' => __DIR__ . '/config',
36
+            'config' => __DIR__.'/config',
37 37
         ])->run(new Environment([
38 38
             'key' => '(true)',
39 39
         ]));
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
     {
51 51
         $core = TestCore::create([
52 52
             'root'   => __DIR__,
53
-            'config' => __DIR__ . '/config',
53
+            'config' => __DIR__.'/config',
54 54
         ])->run();
55 55
 
56 56
         /** @var ContainerInterface $c */
57 57
         $c = $core->getContainer();
58 58
 
59 59
         ContainerScope::runScope($c, function (): void {
60
-            $this->assertDir(__DIR__ . '/config', directory('config'));
60
+            $this->assertDir(__DIR__.'/config', directory('config'));
61 61
         });
62 62
     }
63 63
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
         $core = TestCore::create([
76 76
             'root'   => __DIR__,
77
-            'config' => __DIR__ . '/config',
77
+            'config' => __DIR__.'/config',
78 78
         ])->run();
79 79
 
80 80
         /** @var ContainerInterface $c */
@@ -102,6 +102,6 @@  discard block
 block discarded – undo
102 102
     private function assertDir($path, $value): void
103 103
     {
104 104
         $path = \str_replace(['\\', '//'], '/', $path);
105
-        self::assertSame(\rtrim($path, '/') . '/', $value);
105
+        self::assertSame(\rtrim($path, '/').'/', $value);
106 106
     }
107 107
 }
Please login to merge, or discard this patch.
src/Boot/tests/MemoryTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,17 +14,17 @@  discard block
 block discarded – undo
14 14
     {
15 15
         $core = TestCore::create([
16 16
             'root'  => __DIR__,
17
-            'cache' => __DIR__ . '/cache',
17
+            'cache' => __DIR__.'/cache',
18 18
         ])->run();
19 19
 
20 20
         /** @var MemoryInterface $memory */
21 21
         $memory = $core->getContainer()->get(MemoryInterface::class);
22 22
 
23 23
         $memory->saveData('test', 'data');
24
-        self::assertFileExists(__DIR__ . '/cache/test.php');
24
+        self::assertFileExists(__DIR__.'/cache/test.php');
25 25
         self::assertSame('data', $memory->loadData('test'));
26 26
 
27
-        \unlink(__DIR__ . '/cache/test.php');
27
+        \unlink(__DIR__.'/cache/test.php');
28 28
         self::assertNull($memory->loadData('test'));
29 29
     }
30 30
 
@@ -32,16 +32,16 @@  discard block
 block discarded – undo
32 32
     {
33 33
         $core = TestCore::create([
34 34
             'root'  => __DIR__,
35
-            'cache' => __DIR__ . '/cache',
35
+            'cache' => __DIR__.'/cache',
36 36
         ])->run();
37 37
 
38 38
         /** @var MemoryInterface $memory */
39 39
         $memory = $core->getContainer()->get(MemoryInterface::class);
40 40
 
41
-        \file_put_contents(__DIR__ . '/cache/test.php', '<?php broken');
41
+        \file_put_contents(__DIR__.'/cache/test.php', '<?php broken');
42 42
         self::assertNull($memory->loadData('test'));
43 43
 
44
-        \unlink(__DIR__ . '/cache/test.php');
44
+        \unlink(__DIR__.'/cache/test.php');
45 45
         self::assertNull($memory->loadData('test'));
46 46
     }
47 47
 }
Please login to merge, or discard this patch.
src/Boot/tests/Fixtures/BrokenCore.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,25 +19,25 @@
 block discarded – undo
19 19
      */
20 20
     protected function mapDirectories(array $directories): array
21 21
     {
22
-        if (!isset($directories['root'])) {
22
+        if (!isset($directories['root'])){
23 23
             throw new BootException('Missing required directory `root`.');
24 24
         }
25 25
 
26
-        if (!isset($directories['app'])) {
27
-            $directories['app'] = $directories['root'] . '/app/';
26
+        if (!isset($directories['app'])){
27
+            $directories['app'] = $directories['root'].'/app/';
28 28
         }
29 29
 
30 30
         return \array_merge([
31 31
             // public root
32
-            'public' => $directories['root'] . '/public/',
32
+            'public' => $directories['root'].'/public/',
33 33
 
34 34
             // data directories
35
-            'runtime' => $directories['root'] . '/runtime/',
36
-            'cache' => $directories['root'] . '/runtime/cache/',
35
+            'runtime' => $directories['root'].'/runtime/',
36
+            'cache' => $directories['root'].'/runtime/cache/',
37 37
 
38 38
             // application directories
39
-            'config' => $directories['app'] . '/config/',
40
-            'resources' => $directories['app'] . '/resources/',
39
+            'config' => $directories['app'].'/config/',
40
+            'resources' => $directories['app'].'/resources/',
41 41
         ], $directories);
42 42
     }
43 43
 }
Please login to merge, or discard this patch.