@@ -12,9 +12,9 @@ |
||
| 12 | 12 | public function testToString(): void |
| 13 | 13 | { |
| 14 | 14 | $attribute = new TargetClass('foo'); |
| 15 | - self::assertSame('3319d33aad20ad375d27dcd03c879454', (string) $attribute); |
|
| 15 | + self::assertSame('3319d33aad20ad375d27dcd03c879454', (string)$attribute); |
|
| 16 | 16 | |
| 17 | 17 | $attribute = new TargetClass('foo', 'bar'); |
| 18 | - self::assertSame('a95c8a2cfc901290939df93183ce98d6', (string) $attribute); |
|
| 18 | + self::assertSame('a95c8a2cfc901290939df93183ce98d6', (string)$attribute); |
|
| 19 | 19 | } |
| 20 | 20 | } |
| 21 | 21 | \ No newline at end of file |
@@ -33,6 +33,6 @@ |
||
| 33 | 33 | new ServerRequest('GET', new Uri('/admin'), ['X-Auth-Token' => $token], 'php://input') |
| 34 | 34 | ); |
| 35 | 35 | |
| 36 | - self::assertSame($token === 'ok' ? '/admin' : '/login', (string) $response->getBody()); |
|
| 36 | + self::assertSame($token === 'ok' ? '/admin' : '/login', (string)$response->getBody()); |
|
| 37 | 37 | } |
| 38 | 38 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | self::assertSame(302, $response->getStatusCode()); |
| 59 | 59 | self::assertSame(['Location' => ['/login']], $response->getHeaders()); |
| 60 | - self::assertSame('', (string) $response->getBody()); |
|
| 60 | + self::assertSame('', (string)$response->getBody()); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | #[DataProvider('failTokensDataProvider')] |
@@ -80,6 +80,6 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | self::assertSame(301, $response->getStatusCode()); |
| 82 | 82 | self::assertSame(['Location' => ['/login']], $response->getHeaders()); |
| 83 | - self::assertSame('', (string) $response->getBody()); |
|
| 83 | + self::assertSame('', (string)$response->getBody()); |
|
| 84 | 84 | } |
| 85 | 85 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | $response = $http->handle(new ServerRequest('GET', '', ['X-Auth-Token' => $token], 'php://input')); |
| 33 | 33 | |
| 34 | - self::assertSame('OK', (string) $response->getBody()); |
|
| 34 | + self::assertSame('OK', (string)$response->getBody()); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | #[DataProvider('failTokensDataProvider')] |
@@ -51,6 +51,6 @@ discard block |
||
| 51 | 51 | $this->expectException(AuthException::class); |
| 52 | 52 | $response = $http->handle(new ServerRequest('GET', '', ['X-Auth-Token' => $token], 'php://input')); |
| 53 | 53 | |
| 54 | - self::assertSame('OK', (string) $response->getBody()); |
|
| 54 | + self::assertSame('OK', (string)$response->getBody()); |
|
| 55 | 55 | } |
| 56 | 56 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | class StreamsTest extends TestCase |
| 12 | 12 | { |
| 13 | - private const FIXTURE_DIRECTORY = __DIR__ . '/fixtures'; |
|
| 13 | + private const FIXTURE_DIRECTORY = __DIR__.'/fixtures'; |
|
| 14 | 14 | |
| 15 | 15 | public function setUp(): void |
| 16 | 16 | { |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | self::assertSame(strlen('sample text'), filesize($filename)); |
| 36 | 36 | self::assertSame(md5('sample text'), md5_file($filename)); |
| 37 | 37 | |
| 38 | - $newFilename = self::FIXTURE_DIRECTORY . '/test.txt'; |
|
| 38 | + $newFilename = self::FIXTURE_DIRECTORY.'/test.txt'; |
|
| 39 | 39 | copy($filename, $newFilename); |
| 40 | 40 | |
| 41 | 41 | self::assertFileExists($newFilename); |
@@ -76,15 +76,15 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public function testException(): void |
| 78 | 78 | { |
| 79 | - try { |
|
| 79 | + try{ |
|
| 80 | 80 | fopen('spiral://non-exists', 'rb'); |
| 81 | - } catch (\Throwable $e) { |
|
| 81 | + }catch (\Throwable $e){ |
|
| 82 | 82 | self::assertStringContainsString('failed to open stream', $e->getMessage()); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - try { |
|
| 85 | + try{ |
|
| 86 | 86 | filemtime('spiral://non-exists'); |
| 87 | - } catch (\Throwable $e) { |
|
| 87 | + }catch (\Throwable $e){ |
|
| 88 | 88 | self::assertStringContainsString('stat failed', $e->getMessage()); |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -94,15 +94,15 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function testExceptionPHP8(): void |
| 96 | 96 | { |
| 97 | - try { |
|
| 97 | + try{ |
|
| 98 | 98 | fopen('spiral://non-exists', 'rb'); |
| 99 | - } catch (\Throwable $e) { |
|
| 99 | + }catch (\Throwable $e){ |
|
| 100 | 100 | self::assertStringContainsString('Failed to open stream', $e->getMessage()); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - try { |
|
| 103 | + try{ |
|
| 104 | 104 | filemtime('spiral://non-exists'); |
| 105 | - } catch (\Throwable $e) { |
|
| 105 | + }catch (\Throwable $e){ |
|
| 106 | 106 | self::assertStringContainsString('stat failed', $e->getMessage()); |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -76,15 +76,21 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public function testException(): void |
| 78 | 78 | { |
| 79 | - try { |
|
| 79 | + try |
|
| 80 | + { |
|
| 80 | 81 | fopen('spiral://non-exists', 'rb'); |
| 81 | - } catch (\Throwable $e) { |
|
| 82 | + } |
|
| 83 | + catch (\Throwable $e) |
|
| 84 | + { |
|
| 82 | 85 | self::assertStringContainsString('failed to open stream', $e->getMessage()); |
| 83 | 86 | } |
| 84 | 87 | |
| 85 | - try { |
|
| 88 | + try |
|
| 89 | + { |
|
| 86 | 90 | filemtime('spiral://non-exists'); |
| 87 | - } catch (\Throwable $e) { |
|
| 91 | + } |
|
| 92 | + catch (\Throwable $e) |
|
| 93 | + { |
|
| 88 | 94 | self::assertStringContainsString('stat failed', $e->getMessage()); |
| 89 | 95 | } |
| 90 | 96 | } |
@@ -94,15 +100,21 @@ discard block |
||
| 94 | 100 | */ |
| 95 | 101 | public function testExceptionPHP8(): void |
| 96 | 102 | { |
| 97 | - try { |
|
| 103 | + try |
|
| 104 | + { |
|
| 98 | 105 | fopen('spiral://non-exists', 'rb'); |
| 99 | - } catch (\Throwable $e) { |
|
| 106 | + } |
|
| 107 | + catch (\Throwable $e) |
|
| 108 | + { |
|
| 100 | 109 | self::assertStringContainsString('Failed to open stream', $e->getMessage()); |
| 101 | 110 | } |
| 102 | 111 | |
| 103 | - try { |
|
| 112 | + try |
|
| 113 | + { |
|
| 104 | 114 | filemtime('spiral://non-exists'); |
| 105 | - } catch (\Throwable $e) { |
|
| 115 | + } |
|
| 116 | + catch (\Throwable $e) |
|
| 117 | + { |
|
| 106 | 118 | self::assertStringContainsString('stat failed', $e->getMessage()); |
| 107 | 119 | } |
| 108 | 120 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | public static function emptyItemProvider(): iterable |
| 22 | 22 | { |
| 23 | 23 | $values = ['', ' ']; |
| 24 | - foreach ($values as $value) { |
|
| 24 | + foreach ($values as $value){ |
|
| 25 | 25 | yield from [ |
| 26 | 26 | [AcceptHeaderItem::fromString($value)], |
| 27 | 27 | [new AcceptHeaderItem($value)], |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | #[DataProvider('qualityBoundariesProvider')] |
| 59 | 59 | public function testItemQualityBoundaries(float $quality, AcceptHeaderItem $item): void |
| 60 | 60 | { |
| 61 | - if ($quality > 1) { |
|
| 61 | + if ($quality > 1){ |
|
| 62 | 62 | self::assertEqualsWithDelta(1.0, $item->getQuality(), PHP_FLOAT_EPSILON); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - if ($quality < 0) { |
|
| 65 | + if ($quality < 0){ |
|
| 66 | 66 | self::assertEqualsWithDelta(0.0, $item->getQuality(), PHP_FLOAT_EPSILON); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | public static function qualityBoundariesProvider(): iterable |
| 74 | 74 | { |
| 75 | 75 | $qualities = [-1, 0, 0.5, 1, 2]; |
| 76 | - foreach ($qualities as $quality) { |
|
| 76 | + foreach ($qualities as $quality){ |
|
| 77 | 77 | yield from [ |
| 78 | 78 | [$quality, AcceptHeaderItem::fromString("*;q=$quality")], |
| 79 | 79 | [$quality, AcceptHeaderItem::fromString("*;Q=$quality")], |
@@ -106,9 +106,9 @@ discard block |
||
| 106 | 106 | ] |
| 107 | 107 | ]; |
| 108 | 108 | |
| 109 | - foreach ($set as $params) { |
|
| 109 | + foreach ($set as $params){ |
|
| 110 | 110 | $formattedParams = []; |
| 111 | - foreach ($params['passed'] as $k => $v) { |
|
| 111 | + foreach ($params['passed'] as $k => $v){ |
|
| 112 | 112 | $formattedParams[] = "$k=$v"; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -21,7 +21,8 @@ discard block |
||
| 21 | 21 | public static function emptyItemProvider(): iterable |
| 22 | 22 | { |
| 23 | 23 | $values = ['', ' ']; |
| 24 | - foreach ($values as $value) { |
|
| 24 | + foreach ($values as $value) |
|
| 25 | + { |
|
| 25 | 26 | yield from [ |
| 26 | 27 | [AcceptHeaderItem::fromString($value)], |
| 27 | 28 | [new AcceptHeaderItem($value)], |
@@ -58,11 +59,13 @@ discard block |
||
| 58 | 59 | #[DataProvider('qualityBoundariesProvider')] |
| 59 | 60 | public function testItemQualityBoundaries(float $quality, AcceptHeaderItem $item): void |
| 60 | 61 | { |
| 61 | - if ($quality > 1) { |
|
| 62 | + if ($quality > 1) |
|
| 63 | + { |
|
| 62 | 64 | self::assertEqualsWithDelta(1.0, $item->getQuality(), PHP_FLOAT_EPSILON); |
| 63 | 65 | } |
| 64 | 66 | |
| 65 | - if ($quality < 0) { |
|
| 67 | + if ($quality < 0) |
|
| 68 | + { |
|
| 66 | 69 | self::assertEqualsWithDelta(0.0, $item->getQuality(), PHP_FLOAT_EPSILON); |
| 67 | 70 | } |
| 68 | 71 | |
@@ -73,7 +76,8 @@ discard block |
||
| 73 | 76 | public static function qualityBoundariesProvider(): iterable |
| 74 | 77 | { |
| 75 | 78 | $qualities = [-1, 0, 0.5, 1, 2]; |
| 76 | - foreach ($qualities as $quality) { |
|
| 79 | + foreach ($qualities as $quality) |
|
| 80 | + { |
|
| 77 | 81 | yield from [ |
| 78 | 82 | [$quality, AcceptHeaderItem::fromString("*;q=$quality")], |
| 79 | 83 | [$quality, AcceptHeaderItem::fromString("*;Q=$quality")], |
@@ -106,9 +110,11 @@ discard block |
||
| 106 | 110 | ] |
| 107 | 111 | ]; |
| 108 | 112 | |
| 109 | - foreach ($set as $params) { |
|
| 113 | + foreach ($set as $params) |
|
| 114 | + { |
|
| 110 | 115 | $formattedParams = []; |
| 111 | - foreach ($params['passed'] as $k => $v) { |
|
| 116 | + foreach ($params['passed'] as $k => $v) |
|
| 117 | + { |
|
| 112 | 118 | $formattedParams[] = "$k=$v"; |
| 113 | 119 | } |
| 114 | 120 | |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | $rValue = 'return-value'; |
| 100 | 100 | $stream = $this->createStream(self::DEFAULT_SEQUENCE, $rValue); |
| 101 | 101 | |
| 102 | - $result = (string) $stream; |
|
| 102 | + $result = (string)$stream; |
|
| 103 | 103 | |
| 104 | - self::assertSame(self::DEFAULT_CONTENT_RESULT . $rValue, $result); |
|
| 104 | + self::assertSame(self::DEFAULT_CONTENT_RESULT.$rValue, $result); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | public function testToStringWithReturnOnly(): void |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | $rValue = 'return-value'; |
| 110 | 110 | $stream = $this->createStream([], $rValue); |
| 111 | 111 | |
| 112 | - $result = (string) $stream; |
|
| 112 | + $result = (string)$stream; |
|
| 113 | 113 | |
| 114 | 114 | self::assertSame($rValue, $result); |
| 115 | 115 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $stream = $this->createStream(); |
| 120 | 120 | $stream->close(); |
| 121 | 121 | |
| 122 | - self::assertSame('', (string) $stream); |
|
| 122 | + self::assertSame('', (string)$stream); |
|
| 123 | 123 | |
| 124 | 124 | $this->expectException(RuntimeException::class); |
| 125 | 125 | $this->expectExceptionMessage('Unable to read stream contents.'); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | $this->container->bind(ServerRequestInterface::class, $request); |
| 169 | 169 | |
| 170 | - self::assertSame(['PATH' => 'sample',], $this->input->server->__debugInfo()); |
|
| 170 | + self::assertSame(['PATH' => 'sample', ], $this->input->server->__debugInfo()); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | public function testIterator(): void |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | $this->container->bind(ServerRequestInterface::class, $request); |
| 182 | 182 | |
| 183 | - self::assertSame(['PATH' => 'sample',], iterator_to_array($this->input->server)); |
|
| 183 | + self::assertSame(['PATH' => 'sample', ], iterator_to_array($this->input->server)); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | public function testSetAndExceptions(): void |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $headers = $acceptHeader->getAll(); |
| 90 | 90 | self::assertCount(count($expected), $headers); |
| 91 | 91 | |
| 92 | - foreach ($expected as $i => $value) { |
|
| 92 | + foreach ($expected as $i => $value){ |
|
| 93 | 93 | self::assertSame($value, $headers[$i]->getValue()); |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $headers = $acceptHeader->getAll(); |
| 127 | 127 | self::assertCount(count($expected), $headers); |
| 128 | 128 | |
| 129 | - foreach ($expected as $i => $value) { |
|
| 129 | + foreach ($expected as $i => $value){ |
|
| 130 | 130 | self::assertSame($value, (string)$headers[$i]); |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -89,7 +89,8 @@ discard block |
||
| 89 | 89 | $headers = $acceptHeader->getAll(); |
| 90 | 90 | self::assertCount(count($expected), $headers); |
| 91 | 91 | |
| 92 | - foreach ($expected as $i => $value) { |
|
| 92 | + foreach ($expected as $i => $value) |
|
| 93 | + { |
|
| 93 | 94 | self::assertSame($value, $headers[$i]->getValue()); |
| 94 | 95 | } |
| 95 | 96 | } |
@@ -126,7 +127,8 @@ discard block |
||
| 126 | 127 | $headers = $acceptHeader->getAll(); |
| 127 | 128 | self::assertCount(count($expected), $headers); |
| 128 | 129 | |
| 129 | - foreach ($expected as $i => $value) { |
|
| 130 | + foreach ($expected as $i => $value) |
|
| 131 | + { |
|
| 130 | 132 | self::assertSame($value, (string)$headers[$i]); |
| 131 | 133 | } |
| 132 | 134 | } |