Test Failed
Pull Request — master (#1163)
by Abdul Malik
10:57
created
src/Core/src/Exception/Resolver/WrongTypeException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
     {
13 13
         $message = 'An argument resolved with wrong type: ';
14 14
         parent::__construct(
15
-            $message . $error->getMessage(),
15
+            $message.$error->getMessage(),
16 16
             $error->getCode(),
17 17
             $error
18 18
         );
Please login to merge, or discard this patch.
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/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.
src/Csrf/src/Middleware/CsrfFirewall.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -34,18 +34,18 @@  discard block
 block discarded – undo
34 34
     public function __construct(
35 35
         private readonly ResponseFactoryInterface $responseFactory,
36 36
         private readonly array $allowMethods = self::ALLOW_METHODS
37
-    ) {
37
+    ){
38 38
     }
39 39
 
40 40
     public function process(Request $request, RequestHandlerInterface $handler): Response
41 41
     {
42 42
         $token = $request->getAttribute(CsrfMiddleware::ATTRIBUTE);
43 43
 
44
-        if (empty($token)) {
44
+        if (empty($token)){
45 45
             throw new \LogicException('Unable to apply CSRF firewall, attribute is missing');
46 46
         }
47 47
 
48
-        if ($this->isRequired($request) && !\hash_equals($token, $this->fetchToken($request))) {
48
+        if ($this->isRequired($request) && !\hash_equals($token, $this->fetchToken($request))){
49 49
             return $this->responseFactory->createResponse(412, 'Bad CSRF Token');
50 50
         }
51 51
 
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
      */
66 66
     protected function fetchToken(Request $request): string
67 67
     {
68
-        if ($request->hasHeader(self::HEADER)) {
68
+        if ($request->hasHeader(self::HEADER)){
69 69
             return $request->getHeaderLine(self::HEADER);
70 70
         }
71 71
 
72 72
         $data = $request->getParsedBody();
73
-        if (\is_array($data) && isset($data[self::PARAMETER]) && \is_string($data[self::PARAMETER])) {
73
+        if (\is_array($data) && isset($data[self::PARAMETER]) && \is_string($data[self::PARAMETER])){
74 74
             return $data[self::PARAMETER];
75 75
         }
76 76
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,11 +41,13 @@  discard block
 block discarded – undo
41 41
     {
42 42
         $token = $request->getAttribute(CsrfMiddleware::ATTRIBUTE);
43 43
 
44
-        if (empty($token)) {
44
+        if (empty($token))
45
+        {
45 46
             throw new \LogicException('Unable to apply CSRF firewall, attribute is missing');
46 47
         }
47 48
 
48
-        if ($this->isRequired($request) && !\hash_equals($token, $this->fetchToken($request))) {
49
+        if ($this->isRequired($request) && !\hash_equals($token, $this->fetchToken($request)))
50
+        {
49 51
             return $this->responseFactory->createResponse(412, 'Bad CSRF Token');
50 52
         }
51 53
 
@@ -65,12 +67,14 @@  discard block
 block discarded – undo
65 67
      */
66 68
     protected function fetchToken(Request $request): string
67 69
     {
68
-        if ($request->hasHeader(self::HEADER)) {
70
+        if ($request->hasHeader(self::HEADER))
71
+        {
69 72
             return $request->getHeaderLine(self::HEADER);
70 73
         }
71 74
 
72 75
         $data = $request->getParsedBody();
73
-        if (\is_array($data) && isset($data[self::PARAMETER]) && \is_string($data[self::PARAMETER])) {
76
+        if (\is_array($data) && isset($data[self::PARAMETER]) && \is_string($data[self::PARAMETER]))
77
+        {
74 78
             return $data[self::PARAMETER];
75 79
         }
76 80
 
Please login to merge, or discard this patch.
src/Csrf/src/Middleware/CsrfMiddleware.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 
26 26
     public function __construct(
27 27
         private readonly CsrfConfig $config
28
-    ) {
28
+    ){
29 29
     }
30 30
 
31 31
     public function process(Request $request, RequestHandlerInterface $handler): Response
32 32
     {
33 33
         $cookie = null;
34
-        if (isset($request->getCookieParams()[$this->config->getCookie()])) {
34
+        if (isset($request->getCookieParams()[$this->config->getCookie()])){
35 35
             $token = $request->getCookieParams()[$this->config->getCookie()];
36
-        } else {
36
+        }else{
37 37
             //Making new token
38 38
             $token = $this->random($this->config->getTokenLength());
39 39
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         //CSRF issues must be handled by Firewall middleware
45 45
         $response = $handler->handle($request->withAttribute(static::ATTRIBUTE, $token));
46 46
 
47
-        if (!empty($cookie)) {
47
+        if (!empty($cookie)){
48 48
             return $response->withAddedHeader('Set-Cookie', $cookie);
49 49
         }
50 50
 
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
      */
76 76
     private function random(int $length = 32): string
77 77
     {
78
-        try {
79
-            if (empty($string = random_bytes($length))) {
78
+        try{
79
+            if (empty($string = random_bytes($length))){
80 80
                 throw new \RuntimeException('Unable to generate random string');
81 81
             }
82
-        } catch (\Throwable $e) {
83
-            throw new \RuntimeException('Unable to generate random string', (int) $e->getCode(), $e);
82
+        }catch (\Throwable $e){
83
+            throw new \RuntimeException('Unable to generate random string', (int)$e->getCode(), $e);
84 84
         }
85 85
 
86 86
         return \substr(\base64_encode($string), 0, $length);
Please login to merge, or discard this patch.
Braces   +14 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,9 +31,12 @@  discard block
 block discarded – undo
31 31
     public function process(Request $request, RequestHandlerInterface $handler): Response
32 32
     {
33 33
         $cookie = null;
34
-        if (isset($request->getCookieParams()[$this->config->getCookie()])) {
34
+        if (isset($request->getCookieParams()[$this->config->getCookie()]))
35
+        {
35 36
             $token = $request->getCookieParams()[$this->config->getCookie()];
36
-        } else {
37
+        }
38
+        else
39
+        {
37 40
             //Making new token
38 41
             $token = $this->random($this->config->getTokenLength());
39 42
 
@@ -44,7 +47,8 @@  discard block
 block discarded – undo
44 47
         //CSRF issues must be handled by Firewall middleware
45 48
         $response = $handler->handle($request->withAttribute(static::ATTRIBUTE, $token));
46 49
 
47
-        if (!empty($cookie)) {
50
+        if (!empty($cookie))
51
+        {
48 52
             return $response->withAddedHeader('Set-Cookie', $cookie);
49 53
         }
50 54
 
@@ -75,11 +79,15 @@  discard block
 block discarded – undo
75 79
      */
76 80
     private function random(int $length = 32): string
77 81
     {
78
-        try {
79
-            if (empty($string = random_bytes($length))) {
82
+        try
83
+        {
84
+            if (empty($string = random_bytes($length)))
85
+            {
80 86
                 throw new \RuntimeException('Unable to generate random string');
81 87
             }
82
-        } catch (\Throwable $e) {
88
+        }
89
+        catch (\Throwable $e)
90
+        {
83 91
             throw new \RuntimeException('Unable to generate random string', (int) $e->getCode(), $e);
84 92
         }
85 93
 
Please login to merge, or discard this patch.