Passed
Push — master ( 1a1904...88f463 )
by Aleksei
36:26 queued 25:05
created
src/Views/src/ViewManager.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -22,21 +22,21 @@  discard block
 block discarded – undo
22 22
         private readonly GlobalVariablesInterface $globalVariables,
23 23
         FactoryInterface $factory,
24 24
         ?ContextInterface $context = null
25
-    ) {
25
+    ){
26 26
         $this->context = $context ?? new ViewContext();
27 27
         $this->loader = $factory->make(LoaderInterface::class, [
28 28
             'namespaces' => $config->getNamespaces(),
29 29
         ]);
30 30
 
31
-        foreach ($this->config->getDependencies() as $dependency) {
31
+        foreach ($this->config->getDependencies() as $dependency){
32 32
             $this->addDependency($dependency->resolve($factory));
33 33
         }
34 34
 
35
-        foreach ($this->config->getEngines() as $engine) {
35
+        foreach ($this->config->getEngines() as $engine){
36 36
             $this->addEngine($engine->resolve($factory));
37 37
         }
38 38
 
39
-        if ($this->config->isCacheEnabled()) {
39
+        if ($this->config->isCacheEnabled()){
40 40
             $this->cache = new ViewCache();
41 41
         }
42 42
     }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
         // Rotate all possible context variants and warm up cache
95 95
         $generator = new ContextGenerator($this->context);
96
-        foreach ($generator->generate() as $context) {
96
+        foreach ($generator->generate() as $context){
97 97
             $engine->reset($path, $context);
98 98
             $engine->compile($path, $context);
99 99
         }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
         // Rotate all possible context variants and warm up cache
112 112
         $generator = new ContextGenerator($this->context);
113
-        foreach ($generator->generate() as $context) {
113
+        foreach ($generator->generate() as $context){
114 114
             $engine->reset($path, $context);
115 115
         }
116 116
     }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      */
123 123
     public function get(string $path): ViewInterface
124 124
     {
125
-        if ($this->cache?->has($this->context, $path)) {
125
+        if ($this->cache?->has($this->context, $path)){
126 126
             return $this->cache->get($this->context, $path);
127 127
         }
128 128
 
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
      */
151 151
     private function findEngine(string $path): EngineInterface
152 152
     {
153
-        foreach ($this->engines as $engine) {
154
-            if ($engine->getLoader()->exists($path)) {
153
+        foreach ($this->engines as $engine){
154
+            if ($engine->getLoader()->exists($path)){
155 155
                 return $engine;
156 156
             }
157 157
         }
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,15 +28,18 @@  discard block
 block discarded – undo
28 28
             'namespaces' => $config->getNamespaces(),
29 29
         ]);
30 30
 
31
-        foreach ($this->config->getDependencies() as $dependency) {
31
+        foreach ($this->config->getDependencies() as $dependency)
32
+        {
32 33
             $this->addDependency($dependency->resolve($factory));
33 34
         }
34 35
 
35
-        foreach ($this->config->getEngines() as $engine) {
36
+        foreach ($this->config->getEngines() as $engine)
37
+        {
36 38
             $this->addEngine($engine->resolve($factory));
37 39
         }
38 40
 
39
-        if ($this->config->isCacheEnabled()) {
41
+        if ($this->config->isCacheEnabled())
42
+        {
40 43
             $this->cache = new ViewCache();
41 44
         }
42 45
     }
@@ -93,7 +96,8 @@  discard block
 block discarded – undo
93 96
 
94 97
         // Rotate all possible context variants and warm up cache
95 98
         $generator = new ContextGenerator($this->context);
96
-        foreach ($generator->generate() as $context) {
99
+        foreach ($generator->generate() as $context)
100
+        {
97 101
             $engine->reset($path, $context);
98 102
             $engine->compile($path, $context);
99 103
         }
@@ -110,7 +114,8 @@  discard block
 block discarded – undo
110 114
 
111 115
         // Rotate all possible context variants and warm up cache
112 116
         $generator = new ContextGenerator($this->context);
113
-        foreach ($generator->generate() as $context) {
117
+        foreach ($generator->generate() as $context)
118
+        {
114 119
             $engine->reset($path, $context);
115 120
         }
116 121
     }
@@ -122,7 +127,8 @@  discard block
 block discarded – undo
122 127
      */
123 128
     public function get(string $path): ViewInterface
124 129
     {
125
-        if ($this->cache?->has($this->context, $path)) {
130
+        if ($this->cache?->has($this->context, $path))
131
+        {
126 132
             return $this->cache->get($this->context, $path);
127 133
         }
128 134
 
@@ -150,8 +156,10 @@  discard block
 block discarded – undo
150 156
      */
151 157
     private function findEngine(string $path): EngineInterface
152 158
     {
153
-        foreach ($this->engines as $engine) {
154
-            if ($engine->getLoader()->exists($path)) {
159
+        foreach ($this->engines as $engine)
160
+        {
161
+            if ($engine->getLoader()->exists($path))
162
+            {
155 163
                 return $engine;
156 164
             }
157 165
         }
Please login to merge, or discard this patch.
src/Boot/src/BootloadManager/Initializer.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         protected readonly BinderInterface $binder,
35 35
         protected readonly ClassesRegistry $bootloaders = new ClassesRegistry(),
36 36
         ?BootloaderCheckerInterface $checker = null,
37
-    ) {
37
+    ){
38 38
     }
39 39
 
40 40
     /**
@@ -46,21 +46,21 @@  discard block
 block discarded – undo
46 46
     {
47 47
         $this->checker ??= $this->initDefaultChecker();
48 48
 
49
-        foreach ($classes as $bootloader => $options) {
49
+        foreach ($classes as $bootloader => $options){
50 50
             // default bootload syntax as simple array
51
-            if (\is_string($options) || $options instanceof BootloaderInterface) {
51
+            if (\is_string($options) || $options instanceof BootloaderInterface){
52 52
                 $bootloader = $options;
53 53
                 $options = [];
54 54
             }
55 55
             $options = $useConfig ? $this->getBootloadConfig($bootloader, $options) : [];
56 56
 
57
-            if (!$this->checker->canInitialize($bootloader, $useConfig ? $options : null)) {
57
+            if (!$this->checker->canInitialize($bootloader, $useConfig ? $options : null)){
58 58
                 continue;
59 59
             }
60 60
 
61 61
             $this->bootloaders->register($bootloader instanceof BootloaderInterface ? $bootloader::class : $bootloader);
62 62
 
63
-            if (!$bootloader instanceof BootloaderInterface) {
63
+            if (!$bootloader instanceof BootloaderInterface){
64 64
                 $bootloader = $this->container->get($bootloader);
65 65
             }
66 66
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      */
84 84
     protected function initBootloader(BootloaderInterface $bootloader): iterable
85 85
     {
86
-        if ($bootloader instanceof DependedInterface) {
86
+        if ($bootloader instanceof DependedInterface){
87 87
             yield from $this->init($this->getDependencies($bootloader));
88 88
         }
89 89
 
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
      */
102 102
     protected function initBindings(array $bindings, array $singletons): void
103 103
     {
104
-        foreach ($bindings as $aliases => $resolver) {
104
+        foreach ($bindings as $aliases => $resolver){
105 105
             $this->binder->bind($aliases, $resolver);
106 106
         }
107 107
 
108
-        foreach ($singletons as $aliases => $resolver) {
108
+        foreach ($singletons as $aliases => $resolver){
109 109
             $this->binder->bindSingleton($aliases, $resolver);
110 110
         }
111 111
     }
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 
119 119
         $methodsDeps = [];
120 120
 
121
-        foreach (Methods::cases() as $method) {
122
-            if ($reflectionClass->hasMethod($method->value)) {
121
+        foreach (Methods::cases() as $method){
122
+            if ($reflectionClass->hasMethod($method->value)){
123 123
                 $methodsDeps[] = $this->findBootloaderClassesInMethod(
124 124
                     $reflectionClass->getMethod($method->value)
125 125
                 );
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
     protected function findBootloaderClassesInMethod(\ReflectionMethod $method): array
133 133
     {
134 134
         $args = [];
135
-        foreach ($method->getParameters() as $parameter) {
135
+        foreach ($method->getParameters() as $parameter){
136 136
             $type = $parameter->getType();
137
-            if ($type instanceof \ReflectionNamedType && $this->shouldBeBooted($type)) {
137
+            if ($type instanceof \ReflectionNamedType && $this->shouldBeBooted($type)){
138 138
                 $args[] = $type->getName();
139 139
             }
140 140
         }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
      * @psalm-pure
156 156
      * @psalm-assert-if-true TClass $class
157 157
      */
158
-    protected function isBootloader(string|object $class): bool
158
+    protected function isBootloader(string | object $class): bool
159 159
     {
160 160
         return \is_subclass_of($class, BootloaderInterface::class);
161 161
     }
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
      * @param class-string<BootloaderInterface>|BootloaderInterface $bootloader
177 177
      */
178 178
     private function getBootloadConfig(
179
-        string|BootloaderInterface $bootloader,
180
-        array|callable|BootloadConfig $config
179
+        string | BootloaderInterface $bootloader,
180
+        array | callable | BootloadConfig $config
181 181
     ): BootloadConfig {
182
-        if ($config instanceof \Closure) {
182
+        if ($config instanceof \Closure){
183 183
             $config = $this->container instanceof ResolverInterface
184 184
                 ? $config(...$this->container->resolveArguments(new \ReflectionFunction($config)))
185 185
                 : $config();
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         $getArgument = static fn (string $key, bool $override, mixed $default = []): mixed => match (true) {
190 190
             $config instanceof BootloadConfig && $override => $config->{$key},
191 191
             $config instanceof BootloadConfig && !$override && \is_array($default) =>
192
-                $config->{$key} + ($attr->{$key} ?? []),
192
+                $config->{$key} +($attr->{$key} ?? []),
193 193
             $config instanceof BootloadConfig && !$override && \is_bool($default) => $config->{$key},
194 194
             \is_array($config) && $config !== [] && $key === 'args' => $config,
195 195
             default => $attr->{$key} ?? $default,
@@ -208,15 +208,15 @@  discard block
 block discarded – undo
208 208
     /**
209 209
      * @param class-string<BootloaderInterface>|BootloaderInterface $bootloader
210 210
      */
211
-    private function getBootloadConfigAttribute(string|BootloaderInterface $bootloader): ?BootloadConfig
211
+    private function getBootloadConfigAttribute(string | BootloaderInterface $bootloader): ?BootloadConfig
212 212
     {
213 213
         $attribute = null;
214
-        if ($bootloader instanceof BootloaderInterface || \class_exists($bootloader)) {
214
+        if ($bootloader instanceof BootloaderInterface || \class_exists($bootloader)){
215 215
             $ref = new \ReflectionClass($bootloader);
216 216
             $attribute = $ref->getAttributes(BootloadConfig::class)[0] ?? null;
217 217
         }
218 218
 
219
-        if ($attribute === null) {
219
+        if ($attribute === null){
220 220
             return null;
221 221
         }
222 222
 
Please login to merge, or discard this patch.
src/Router/src/Loader/PhpFileLoader.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     public function __construct(
17 17
         private readonly FactoryInterface $factory,
18 18
         private readonly ResolverInterface $resolver,
19
-    ) {
19
+    ){
20 20
     }
21 21
 
22 22
     /**
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public function load(mixed $resource, string $type = null): RouteCollection
26 26
     {
27
-        if (!\file_exists($resource)) {
27
+        if (!\file_exists($resource)){
28 28
             throw new LoaderLoadException(\sprintf('File [%s] does not exist.', $resource));
29 29
         }
30 30
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,8 @@
 block discarded – undo
24 24
      */
25 25
     public function load(mixed $resource, string $type = null): RouteCollection
26 26
     {
27
-        if (!\file_exists($resource)) {
27
+        if (!\file_exists($resource))
28
+        {
28 29
             throw new LoaderLoadException(\sprintf('File [%s] does not exist.', $resource));
29 30
         }
30 31
 
Please login to merge, or discard this patch.
src/Broadcasting/src/Bootloader/WebsocketsBootloader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
             ResponseFactoryInterface $responseFactory,
30 30
             BroadcastConfig $config,
31 31
             ?EventDispatcherInterface $dispatcher = null,
32
-        ): AuthorizationMiddleware => new AuthorizationMiddleware(
32
+        ) : AuthorizationMiddleware => new AuthorizationMiddleware(
33 33
             $broadcast,
34 34
             $responseFactory,
35 35
             $config->getAuthorizationPath(),
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
     }
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function setLocale(string $locale): void
44 44
     {
45
-        if (!$this->catalogueManager->has($locale)) {
45
+        if (!$this->catalogueManager->has($locale)){
46 46
             throw new LocaleException($locale);
47 47
         }
48 48
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function transChoice(
88 88
         string $id,
89
-        string|int $number,
89
+        string | int $number,
90 90
         array $parameters = [],
91 91
         string $domain = null,
92 92
         string $locale = null
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         $domain ??= $this->config->getDefaultDomain();
95 95
         $locale ??= $this->locale;
96 96
 
97
-        try {
97
+        try{
98 98
             $message = $this->get($locale, $domain, $id);
99 99
 
100 100
             $pluralized = $this->identityTranslator->trans(
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
                 null,
104 104
                 $locale
105 105
             );
106
-        } catch (\InvalidArgumentException $e) {
106
+        }catch (\InvalidArgumentException $e){
107 107
             //Wrapping into more explanatory exception
108 108
             throw new PluralizationException($e->getMessage(), $e->getCode(), $e);
109 109
         }
110 110
 
111
-        if (empty($parameters['n']) && is_numeric($number)) {
111
+        if (empty($parameters['n']) && is_numeric($number)){
112 112
             $parameters['n'] = $number;
113 113
         }
114 114
 
@@ -132,18 +132,18 @@  discard block
 block discarded – undo
132 132
         string $postfix = '}'
133 133
     ): string {
134 134
         $replaces = [];
135
-        foreach ($values as $key => $value) {
135
+        foreach ($values as $key => $value){
136 136
             $value = (\is_array($value) || $value instanceof \Closure) ? '' : $value;
137 137
 
138
-            if (\is_object($value)) {
139
-                if (\method_exists($value, '__toString')) {
138
+            if (\is_object($value)){
139
+                if (\method_exists($value, '__toString')){
140 140
                     $value = $value->__toString();
141
-                } else {
141
+                }else{
142 142
                     $value = '';
143 143
                 }
144 144
             }
145 145
 
146
-            $replaces[$prefix . $key . $postfix] = $value;
146
+            $replaces[$prefix.$key.$postfix] = $value;
147 147
         }
148 148
 
149 149
         return \strtr($string, $replaces);
@@ -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
@@ -42,7 +42,8 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function setLocale(string $locale): void
44 44
     {
45
-        if (!$this->catalogueManager->has($locale)) {
45
+        if (!$this->catalogueManager->has($locale))
46
+        {
46 47
             throw new LocaleException($locale);
47 48
         }
48 49
 
@@ -94,7 +95,8 @@  discard block
 block discarded – undo
94 95
         $domain ??= $this->config->getDefaultDomain();
95 96
         $locale ??= $this->locale;
96 97
 
97
-        try {
98
+        try
99
+        {
98 100
             $message = $this->get($locale, $domain, $id);
99 101
 
100 102
             $pluralized = $this->identityTranslator->trans(
@@ -103,12 +105,15 @@  discard block
 block discarded – undo
103 105
                 null,
104 106
                 $locale
105 107
             );
106
-        } catch (\InvalidArgumentException $e) {
108
+        }
109
+        catch (\InvalidArgumentException $e)
110
+        {
107 111
             //Wrapping into more explanatory exception
108 112
             throw new PluralizationException($e->getMessage(), $e->getCode(), $e);
109 113
         }
110 114
 
111
-        if (empty($parameters['n']) && is_numeric($number)) {
115
+        if (empty($parameters['n']) && is_numeric($number))
116
+        {
112 117
             $parameters['n'] = $number;
113 118
         }
114 119
 
@@ -132,13 +137,18 @@  discard block
 block discarded – undo
132 137
         string $postfix = '}'
133 138
     ): string {
134 139
         $replaces = [];
135
-        foreach ($values as $key => $value) {
140
+        foreach ($values as $key => $value)
141
+        {
136 142
             $value = (\is_array($value) || $value instanceof \Closure) ? '' : $value;
137 143
 
138
-            if (\is_object($value)) {
139
-                if (\method_exists($value, '__toString')) {
144
+            if (\is_object($value))
145
+            {
146
+                if (\method_exists($value, '__toString'))
147
+                {
140 148
                     $value = $value->__toString();
141
-                } else {
149
+                }
150
+                else
151
+                {
142 152
                     $value = '';
143 153
                 }
144 154
             }
@@ -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.