Passed
Pull Request — master (#817)
by Maxim
09:13 queued 01:24
created
src/Core/src/Exception/Resolver/MissingRequiredArgumentException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     public function __construct(
14 14
         \ReflectionFunctionAbstract $reflection,
15 15
         private readonly string $parameter
16
-    ) {
16
+    ){
17 17
         $pattern = "Missing required argument for the `{$parameter}` parameter for `%s` %s.";
18 18
         parent::__construct($this->renderFunctionAndParameter($reflection, $pattern));
19 19
     }
Please login to merge, or discard this patch.
src/Core/src/Exception/Traits/ClosureRendererTrait.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         $line = $reflection->getStartLine();
32 32
 
33 33
         $fileAndLine = '';
34
-        if (!empty($fileName)) {
34
+        if (!empty($fileName)){
35 35
             $fileAndLine = "in \"$fileName\" at line $line";
36 36
         }
37 37
 
@@ -42,23 +42,23 @@  discard block
 block discarded – undo
42 42
     {
43 43
         $closureParameters = [];
44 44
 
45
-        foreach ($reflection->getParameters() as $parameter) {
45
+        foreach ($reflection->getParameters() as $parameter){
46 46
             /** @var ReflectionNamedType|ReflectionUnionType|null $type */
47 47
             $type = $parameter->getType();
48 48
             $parameterString = \sprintf(
49 49
                 '%s %s%s$%s',
50 50
                 // type
51
-                (string) $type,
51
+                (string)$type,
52 52
                 // reference
53 53
                 $parameter->isPassedByReference() ? '&' : '',
54 54
                 // variadic
55 55
                 $parameter->isVariadic() ? '...' : '',
56 56
                 $parameter->getName(),
57 57
             );
58
-            if ($parameter->isDefaultValueAvailable()) {
58
+            if ($parameter->isDefaultValueAvailable()){
59 59
                 $default = $parameter->getDefaultValue();
60
-                $parameterString .= ' = ' . match (true) {
61
-                    \is_object($default) => 'new ' . $default::class . '(...)',
60
+                $parameterString .= ' = '.match (true) {
61
+                    \is_object($default) => 'new '.$default::class.'(...)',
62 62
                     $parameter->isDefaultValueConstant() => $parameter->getDefaultValueConstantName(),
63 63
                     default => \var_export($default, true),
64 64
                 };
@@ -66,6 +66,6 @@  discard block
 block discarded – undo
66 66
             $closureParameters[] = \ltrim($parameterString);
67 67
         }
68 68
         $static = $reflection->isStatic() ? 'static ' : '';
69
-        return "{$static}function (" . \implode(', ', $closureParameters) . ')';
69
+        return "{$static}function (".\implode(', ', $closureParameters).')';
70 70
     }
71 71
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@  discard block
 block discarded – undo
31 31
         $line = $reflection->getStartLine();
32 32
 
33 33
         $fileAndLine = '';
34
-        if (!empty($fileName)) {
34
+        if (!empty($fileName))
35
+        {
35 36
             $fileAndLine = "in \"$fileName\" at line $line";
36 37
         }
37 38
 
@@ -42,7 +43,8 @@  discard block
 block discarded – undo
42 43
     {
43 44
         $closureParameters = [];
44 45
 
45
-        foreach ($reflection->getParameters() as $parameter) {
46
+        foreach ($reflection->getParameters() as $parameter)
47
+        {
46 48
             /** @var ReflectionNamedType|ReflectionUnionType|null $type */
47 49
             $type = $parameter->getType();
48 50
             $parameterString = \sprintf(
@@ -55,7 +57,8 @@  discard block
 block discarded – undo
55 57
                 $parameter->isVariadic() ? '...' : '',
56 58
                 $parameter->getName(),
57 59
             );
58
-            if ($parameter->isDefaultValueAvailable()) {
60
+            if ($parameter->isDefaultValueAvailable())
61
+            {
59 62
                 $default = $parameter->getDefaultValue();
60 63
                 $parameterString .= ' = ' . match (true) {
61 64
                     \is_object($default) => 'new ' . $default::class . '(...)',
Please login to merge, or discard this patch.
src/Core/src/Traits/Config/AliasTrait.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@
 block discarded – undo
16 16
     public function resolveAlias(string $alias): string
17 17
     {
18 18
         $antiCircleReference = [];
19
-        while (isset($this->config, $this->config['aliases'][$alias]) && \is_string($alias)) {
20
-            if (\in_array($alias, $antiCircleReference, true)) {
19
+        while (isset($this->config, $this->config['aliases'][$alias]) && \is_string($alias)){
20
+            if (\in_array($alias, $antiCircleReference, true)){
21 21
                 throw new ContainerException(\sprintf('Circle reference detected for alias `%s`.', $alias));
22 22
             }
23 23
             $antiCircleReference[] = $alias;
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,10 @@
 block discarded – undo
16 16
     public function resolveAlias(string $alias): string
17 17
     {
18 18
         $antiCircleReference = [];
19
-        while (isset($this->config, $this->config['aliases'][$alias]) && \is_string($alias)) {
20
-            if (\in_array($alias, $antiCircleReference, true)) {
19
+        while (isset($this->config, $this->config['aliases'][$alias]) && \is_string($alias))
20
+        {
21
+            if (\in_array($alias, $antiCircleReference, true))
22
+            {
21 23
                 throw new ContainerException(\sprintf('Circle reference detected for alias `%s`.', $alias));
22 24
             }
23 25
             $antiCircleReference[] = $alias;
Please login to merge, or discard this patch.
src/Core/src/InvokerInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,5 +23,5 @@
 block discarded – undo
23 23
      *
24 24
      * @throws NotCallableException
25 25
      */
26
-    public function invoke(array|callable|string $target, array $parameters = []): mixed;
26
+    public function invoke(array | callable | string $target, array $parameters = []): mixed;
27 27
 }
Please login to merge, or discard this patch.
src/Core/src/InjectableConfig.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 
49 49
     public function offsetGet(mixed $offset): mixed
50 50
     {
51
-        if (!$this->offsetExists($offset)) {
51
+        if (!$this->offsetExists($offset)){
52 52
             throw new ConfigException(\sprintf("Undefined configuration key '%s'", $offset));
53 53
         }
54 54
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,8 @@
 block discarded – undo
48 48
 
49 49
     public function offsetGet(mixed $offset): mixed
50 50
     {
51
-        if (!$this->offsetExists($offset)) {
51
+        if (!$this->offsetExists($offset))
52
+        {
52 53
             throw new ConfigException(\sprintf("Undefined configuration key '%s'", $offset));
53 54
         }
54 55
 
Please login to merge, or discard this patch.
src/Core/src/ContainerScope.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,9 +33,9 @@
 block discarded – undo
33 33
     {
34 34
         [$previous, self::$container] = [self::$container, $container];
35 35
 
36
-        try {
36
+        try{
37 37
             return $scope();
38
-        } finally {
38
+        }finally{
39 39
             self::$container = $previous;
40 40
         }
41 41
     }
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,9 +33,12 @@
 block discarded – undo
33 33
     {
34 34
         [$previous, self::$container] = [self::$container, $container];
35 35
 
36
-        try {
36
+        try
37
+        {
37 38
             return $scope();
38
-        } finally {
39
+        }
40
+        finally
41
+        {
39 42
             self::$container = $previous;
40 43
         }
41 44
     }
Please login to merge, or discard this patch.
src/Core/src/BinderInterface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
      *
21 21
      * @psalm-param TResolver $resolver
22 22
      */
23
-    public function bind(string $alias, string|array|callable|object $resolver): void;
23
+    public function bind(string $alias, string | array | callable | object $resolver): void;
24 24
 
25 25
     /**
26 26
      * Bind value resolver to container alias to be executed as cached. Resolver can be class name
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      * @param TResolver $resolver Can be result object or
30 30
      *        the same special callable value like the $target parameter in the {@see InvokerInterface::invoke()} method
31 31
      */
32
-    public function bindSingleton(string $alias, string|array|callable|object $resolver): void;
32
+    public function bindSingleton(string $alias, string | array | callable | object $resolver): void;
33 33
 
34 34
     /**
35 35
      * Check if alias points to constructed instance (singleton).
Please login to merge, or discard this patch.
src/Core/src/Container.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
     use DestructorTrait;
45 45
 
46 46
     private Internal\State $state;
47
-    private ResolverInterface|Internal\Resolver $resolver;
48
-    private FactoryInterface|Internal\Factory $factory;
49
-    private ContainerInterface|Internal\Container $container;
50
-    private BinderInterface|Internal\Binder $binder;
51
-    private InvokerInterface|Internal\Invoker $invoker;
47
+    private ResolverInterface | Internal\Resolver $resolver;
48
+    private FactoryInterface | Internal\Factory $factory;
49
+    private ContainerInterface | Internal\Container $container;
50
+    private BinderInterface | Internal\Binder $binder;
51
+    private InvokerInterface | Internal\Invoker $invoker;
52 52
 
53 53
     /**
54 54
      * Container constructor.
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         $constructor = new Internal\Registry($config, [
59 59
             'state' => new Internal\State(),
60 60
         ]);
61
-        foreach ($config as $property => $class) {
61
+        foreach ($config as $property => $class){
62 62
             $this->$property = $constructor->get($property, $class);
63 63
         }
64 64
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      *
130 130
      * @psalm-suppress PossiblyInvalidArgument, PossiblyInvalidCast
131 131
      */
132
-    public function get(string|Autowire $id, string $context = null): mixed
132
+    public function get(string | Autowire $id, string $context = null): mixed
133 133
     {
134 134
         return $this->container->get($id, $context);
135 135
     }
@@ -143,26 +143,26 @@  discard block
 block discarded – undo
143 143
     {
144 144
         $binds = &$this->state->bindings;
145 145
         $cleanup = $previous = [];
146
-        foreach ($bindings as $alias => $resolver) {
147
-            if (isset($binds[$alias])) {
146
+        foreach ($bindings as $alias => $resolver){
147
+            if (isset($binds[$alias])){
148 148
                 $previous[$alias] = $binds[$alias];
149
-            } else {
149
+            }else{
150 150
                 $cleanup[] = $alias;
151 151
             }
152 152
 
153 153
             $this->binder->bind($alias, $resolver);
154 154
         }
155 155
 
156
-        try {
156
+        try{
157 157
             return ContainerScope::getContainer() !== $this
158 158
                 ? ContainerScope::runScope($this, $scope)
159 159
                 : $scope();
160
-        } finally {
161
-            foreach ($previous as $alias => $resolver) {
160
+        }finally{
161
+            foreach ($previous as $alias => $resolver){
162 162
                 $binds[$alias] = $resolver;
163 163
             }
164 164
 
165
-            foreach ($cleanup as $alias) {
165
+            foreach ($cleanup as $alias){
166 166
                 unset($binds[$alias]);
167 167
             }
168 168
         }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
      * for each method call), function array or Closure (executed every call). Only object resolvers
174 174
      * supported by this method.
175 175
      */
176
-    public function bind(string $alias, string|array|callable|object $resolver): void
176
+    public function bind(string $alias, string | array | callable | object $resolver): void
177 177
     {
178 178
         $this->binder->bind($alias, $resolver);
179 179
     }
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
      *
185 185
      * @psalm-param TResolver $resolver
186 186
      */
187
-    public function bindSingleton(string $alias, string|array|callable|object $resolver): void
187
+    public function bindSingleton(string $alias, string | array | callable | object $resolver): void
188 188
     {
189 189
         $this->binder->bindSingleton($alias, $resolver);
190 190
     }
Please login to merge, or discard this patch.
Braces   +18 added lines, -8 removed lines patch added patch discarded remove patch
@@ -58,7 +58,8 @@  discard block
 block discarded – undo
58 58
         $constructor = new Internal\Registry($config, [
59 59
             'state' => new Internal\State(),
60 60
         ]);
61
-        foreach ($config as $property => $class) {
61
+        foreach ($config as $property => $class)
62
+        {
62 63
             $this->$property = $constructor->get($property, $class);
63 64
         }
64 65
 
@@ -143,26 +144,35 @@  discard block
 block discarded – undo
143 144
     {
144 145
         $binds = &$this->state->bindings;
145 146
         $cleanup = $previous = [];
146
-        foreach ($bindings as $alias => $resolver) {
147
-            if (isset($binds[$alias])) {
147
+        foreach ($bindings as $alias => $resolver)
148
+        {
149
+            if (isset($binds[$alias]))
150
+            {
148 151
                 $previous[$alias] = $binds[$alias];
149
-            } else {
152
+            }
153
+            else
154
+            {
150 155
                 $cleanup[] = $alias;
151 156
             }
152 157
 
153 158
             $this->binder->bind($alias, $resolver);
154 159
         }
155 160
 
156
-        try {
161
+        try
162
+        {
157 163
             return ContainerScope::getContainer() !== $this
158 164
                 ? ContainerScope::runScope($this, $scope)
159 165
                 : $scope();
160
-        } finally {
161
-            foreach ($previous as $alias => $resolver) {
166
+        }
167
+        finally
168
+        {
169
+            foreach ($previous as $alias => $resolver)
170
+            {
162 171
                 $binds[$alias] = $resolver;
163 172
             }
164 173
 
165
-            foreach ($cleanup as $alias) {
174
+            foreach ($cleanup as $alias)
175
+            {
166 176
                 unset($binds[$alias]);
167 177
             }
168 178
         }
Please login to merge, or discard this patch.
src/Mailer/src/Message.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     private ?string $replyTo = null;
16 16
     private array $options = [];
17 17
 
18
-    public function __construct(string $subject, string|array $to, array $data = [])
18
+    public function __construct(string $subject, string | array $to, array $data = [])
19 19
     {
20 20
         $this->setSubject($subject);
21 21
         $this->setTo(...(array)$to);
@@ -125,13 +125,13 @@  discard block
 block discarded – undo
125 125
         return $this->options;
126 126
     }
127 127
 
128
-    public function setDelay(\DateInterval|\DateTimeInterface|int $delay): self
128
+    public function setDelay(\DateInterval | \DateTimeInterface | int $delay): self
129 129
     {
130
-        if ($delay instanceof \DateInterval) {
130
+        if ($delay instanceof \DateInterval){
131 131
             $delay = (new \DateTimeImmutable('NOW'))->add($delay);
132 132
         }
133 133
 
134
-        if ($delay instanceof \DateTimeInterface) {
134
+        if ($delay instanceof \DateTimeInterface){
135 135
             $delay = \max(0, $delay->getTimestamp() - \time());
136 136
         }
137 137
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -127,11 +127,13 @@
 block discarded – undo
127 127
 
128 128
     public function setDelay(\DateInterval|\DateTimeInterface|int $delay): self
129 129
     {
130
-        if ($delay instanceof \DateInterval) {
130
+        if ($delay instanceof \DateInterval)
131
+        {
131 132
             $delay = (new \DateTimeImmutable('NOW'))->add($delay);
132 133
         }
133 134
 
134
-        if ($delay instanceof \DateTimeInterface) {
135
+        if ($delay instanceof \DateTimeInterface)
136
+        {
135 137
             $delay = \max(0, $delay->getTimestamp() - \time());
136 138
         }
137 139
 
Please login to merge, or discard this patch.