Passed
Push — master ( 65249a...60c051 )
by Arnold
01:44
created
src/Middleware/Slim.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,8 @@
 block discarded – undo
27 27
      * @param bool $useSlimErrors  Throw Slim exceptions for error responses.
28 28
      */
29 29
     public function __construct(public bool $useSlimErrors = false)
30
-    { }
30
+    {
31
+}
31 32
 
32 33
     public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
33 34
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@
 block discarded – undo
97 97
         }
98 98
     }
99 99
 
100
-    protected function getBody(ResponseInterface $response): string|null
100
+    protected function getBody(ResponseInterface $response): string | null
101 101
     {
102 102
         $body = (string)$response->getBody();
103 103
         return $body !== '' ? $body : null;
Please login to merge, or discard this patch.
src/Guardian.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
      * Run a set of guards.
24 24
      */
25 25
     public function guard(
26
-        \ReflectionObject|\ReflectionMethod $subject,
26
+        \ReflectionObject | \ReflectionMethod $subject,
27 27
         ServerRequestInterface $request,
28 28
         ResponseInterface $response,
29 29
     ): ?ResponseInterface {
Please login to merge, or discard this patch.
src/Traits/Guarded.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
         return $this->guardian;
20 20
     }
21 21
 
22
-    protected function guard(\ReflectionObject|\ReflectionMethod $subject): ?ResponseInterface
22
+    protected function guard(\ReflectionObject | \ReflectionMethod $subject): ?ResponseInterface
23 23
     {
24 24
         return $this->getGuardian()->guard($subject, $this->getRequest(), $this->getResponse());
25 25
     }
Please login to merge, or discard this patch.
src/Traits/Header.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      *
25 25
      * @return $this
26 26
      */
27
-    protected function header(string $header, string|int|\Stringable $value, bool $add = false): static
27
+    protected function header(string $header, string | int | \Stringable $value, bool $add = false): static
28 28
     {
29 29
         $response = $add
30 30
             ? $this->getResponse()->withAddedHeader($header, (string)$value)
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      * @param int|string $status
48 48
      * @return $this
49 49
      */
50
-    protected function status(int|string $status): static
50
+    protected function status(int | string $status): static
51 51
     {
52 52
         if (is_string($status)) {
53 53
             [$status, $phrase] = explode(' ', $status, 2) + [1 => ''];
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      * @param string     $url
135 135
      * @param int|string $status  301 (Moved Permanently), 302 (Found), 303 (See Other) or 307 (Temporary Redirect)
136 136
      */
137
-    protected function redirect(string $url, int|string $status = 303): static
137
+    protected function redirect(string $url, int | string $status = 303): static
138 138
     {
139 139
         if ($status < 300 || $status >= 400) {
140 140
             throw new \DomainException("Invalid status code $status for redirect");
Please login to merge, or discard this patch.
tests/ControllerTest.php 1 patch
Braces   +31 added lines, -13 removed lines patch added patch discarded remove patch
@@ -35,9 +35,12 @@  discard block
 block discarded – undo
35 35
         $this->initialResponse = $this->createMock(ResponseInterface::class);
36 36
         $this->finalResponse = $this->createMock(ResponseInterface::class);
37 37
 
38
-        $this->controller = new class ($this) extends Controller {
38
+        $this->controller = new class ($this) extends Controller
39
+        {
39 40
             public $called;
40
-            public function __construct(protected ControllerTest $test) { }
41
+            public function __construct(protected ControllerTest $test)
42
+            {
43
+}
41 44
 
42 45
             public function process(int $foo, string $bar = 'red'): static {
43 46
                 $this->called = __FUNCTION__;
@@ -124,14 +127,19 @@  discard block
 block discarded – undo
124 127
 
125 128
     public function testBefore()
126 129
     {
127
-        $controller = new class ($this) extends Controller {
128
-            function __construct(protected ControllerTest $test) { }
130
+        $controller = new class ($this) extends Controller
131
+        {
132
+            function __construct(protected ControllerTest $test)
133
+            {
134
+}
129 135
 
130
-            function before() {
136
+            function before()
137
+            {
131 138
                 return $this->paymentRequired();
132 139
             }
133 140
 
134
-            function process() {
141
+            function process()
142
+            {
135 143
                 $this->test->fail("Process should not be called");
136 144
             }
137 145
         };
@@ -149,9 +157,12 @@  discard block
 block discarded – undo
149 157
 
150 158
     public function testClassGuard()
151 159
     {
152
-        $controller = new #[PaymentRequired] class ($this) extends Controller {
160
+        $controller = new #[PaymentRequired] class ($this) extends Controller
161
+        {
153 162
             public $called;
154
-            public function __construct(protected ControllerTest $test) { }
163
+            public function __construct(protected ControllerTest $test)
164
+            {
165
+}
155 166
 
156 167
             public function process(): static {
157 168
                 $this->called = __FUNCTION__;
@@ -174,12 +185,16 @@  discard block
 block discarded – undo
174 185
 
175 186
     public function testMethodGuard()
176 187
     {
177
-        $controller = new class ($this) extends Controller {
188
+        $controller = new class ($this) extends Controller
189
+        {
178 190
             public $called;
179
-            function __construct(protected ControllerTest $test) { }
191
+            function __construct(protected ControllerTest $test)
192
+            {
193
+}
180 194
 
181 195
             #[PaymentRequired]
182
-            function process() {
196
+            function process()
197
+            {
183 198
                 $this->called = __FUNCTION__;
184 199
                 return $this->ok();
185 200
             }
@@ -200,9 +215,12 @@  discard block
 block discarded – undo
200 215
 
201 216
     public function testNopGuard()
202 217
     {
203
-        $controller = new #[NopGuard] class ($this) extends Controller {
218
+        $controller = new #[NopGuard] class ($this) extends Controller
219
+        {
204 220
             public $called;
205
-            public function __construct(protected ControllerTest $test) { }
221
+            public function __construct(protected ControllerTest $test)
222
+            {
223
+}
206 224
 
207 225
             public function process(): static {
208 226
                 $this->called = __FUNCTION__;
Please login to merge, or discard this patch.
tests/InContextOf.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,8 @@
 block discarded – undo
4 4
 
5 5
 trait InContextOf
6 6
 {
7
-    public function inContextOf(object $object, \Closure $function) {
7
+    public function inContextOf(object $object, \Closure $function)
8
+    {
8 9
         return $function->bindTo($this, $object)();
9 10
     }
10 11
 }
Please login to merge, or discard this patch.
tests/Traits/CheckResponseTest.php 1 patch
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -61,14 +61,18 @@
 block discarded – undo
61 61
         $response = $this->createMock(ResponseInterface::class);
62 62
         $response->method('getStatusCode')->willReturn($code);
63 63
 
64
-        $controller = new class ($this, $response) extends Controller {
65
-            public function __construct(public TestCase $test, protected ResponseInterface $response) {}
64
+        $controller = new class ($this, $response) extends Controller
65
+        {
66
+            public function __construct(public TestCase $test, protected ResponseInterface $response)
67
+            {
68
+}
66 69
 
67 70
             protected function getResponse(): ResponseInterface {
68 71
                 return $this->response;
69 72
             }
70 73
 
71
-            public function assertResponseStatus(string $type) {
74
+            public function assertResponseStatus(string $type)
75
+            {
72 76
                 $this->test->assertSame($type === 'informational', $this->isInformational(), 'isInformational');
73 77
                 $this->test->assertSame($type === 'successful', $this->isSuccessful(), 'isSuccessful');
74 78
                 $this->test->assertSame($type === 'redirect', $this->isRedirection(), 'isRedirection');
Please login to merge, or discard this patch.
tests/Traits/OutputTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $response = $this->createMock(ResponseInterface::class);
44 44
         $response->method('getBody')->willReturn($stream);
45 45
         $response->expects($this->once())->method('withHeader')
46
-            ->with( 'Content-Type', $contentType)
46
+            ->with('Content-Type', $contentType)
47 47
             ->willReturnSelf();
48 48
 
49 49
         $controller = $this->createPartialMock(Controller::class, ['getResponse']);
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         $response = $this->createMock(ResponseInterface::class);
100 100
         $response->method('getBody')->willReturn($stream);
101 101
         $response->expects($this->once())->method('withHeader')
102
-            ->with( 'Content-Type', 'application/json')
102
+            ->with('Content-Type', 'application/json')
103 103
             ->willReturnSelf();
104 104
 
105 105
         $controller = $this->createPartialMock(Controller::class, ['getResponse']);
Please login to merge, or discard this patch.
tests/Traits/HeaderTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     /**
28 28
      * @dataProvider statusProvider
29 29
      */
30
-    public function testStatus(int|string $status, int $code, string $phrase)
30
+    public function testStatus(int | string $status, int $code, string $phrase)
31 31
     {
32 32
         $response = $this->createMock(ResponseInterface::class);
33 33
         $response->expects($this->once())->method('withStatus')->with($code, $phrase)->willReturnSelf();
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      * Test 'redirect' function
206 206
      * @dataProvider redirectStatusProvider
207 207
      */
208
-    public function testRedirect(int|string $status)
208
+    public function testRedirect(int | string $status)
209 209
     {
210 210
         $controller = $this->createPartialMock(Controller::class, ['status', 'header', 'output']);
211 211
         
Please login to merge, or discard this patch.