@@ -26,11 +26,11 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | $parsed = $this->tokens($source); |
| 28 | 28 | |
| 29 | - if (count($tokens) !== count($parsed)) { |
|
| 29 | + if (count($tokens) !== count($parsed)){ |
|
| 30 | 30 | $this->fail('Token count mismatch'); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - foreach ($tokens as $index => $token) { |
|
| 33 | + foreach ($tokens as $index => $token){ |
|
| 34 | 34 | self::assertSame($token->type, $parsed[$index]->type, 'Token type mismatch'); |
| 35 | 35 | self::assertSame($token->offset, $parsed[$index]->offset, 'Token offset mismatch'); |
| 36 | 36 | self::assertSame($token->content, $parsed[$index]->content, 'Token content mismatch'); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $lexer = new Lexer(); |
| 43 | 43 | |
| 44 | 44 | $tokens = []; |
| 45 | - foreach ($lexer->parse(new StringStream($source)) as $t) { |
|
| 45 | + foreach ($lexer->parse(new StringStream($source)) as $t){ |
|
| 46 | 46 | $tokens[] = $t; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -26,11 +26,13 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | $parsed = $this->tokens($source); |
| 28 | 28 | |
| 29 | - if (count($tokens) !== count($parsed)) { |
|
| 29 | + if (count($tokens) !== count($parsed)) |
|
| 30 | + { |
|
| 30 | 31 | $this->fail('Token count mismatch'); |
| 31 | 32 | } |
| 32 | 33 | |
| 33 | - foreach ($tokens as $index => $token) { |
|
| 34 | + foreach ($tokens as $index => $token) |
|
| 35 | + { |
|
| 34 | 36 | self::assertSame($token->type, $parsed[$index]->type, 'Token type mismatch'); |
| 35 | 37 | self::assertSame($token->offset, $parsed[$index]->offset, 'Token offset mismatch'); |
| 36 | 38 | self::assertSame($token->content, $parsed[$index]->content, 'Token content mismatch'); |
@@ -42,7 +44,8 @@ discard block |
||
| 42 | 44 | $lexer = new Lexer(); |
| 43 | 45 | |
| 44 | 46 | $tokens = []; |
| 45 | - foreach ($lexer->parse(new StringStream($source)) as $t) { |
|
| 47 | + foreach ($lexer->parse(new StringStream($source)) as $t) |
|
| 48 | + { |
|
| 46 | 49 | $tokens[] = $t; |
| 47 | 50 | } |
| 48 | 51 | |
@@ -16,11 +16,11 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $parsed = $this->tokens($source); |
| 18 | 18 | |
| 19 | - if (count($tokens) !== count($parsed)) { |
|
| 19 | + if (count($tokens) !== count($parsed)){ |
|
| 20 | 20 | $this->fail('Token count mismatch'); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - foreach ($tokens as $index => $token) { |
|
| 23 | + foreach ($tokens as $index => $token){ |
|
| 24 | 24 | self::assertSame($token->type, $parsed[$index]->type, 'Token type mismatch'); |
| 25 | 25 | self::assertSame($token->offset, $parsed[$index]->offset, 'Token offset mismatch'); |
| 26 | 26 | self::assertSame($token->content, $parsed[$index]->content, 'Token content mismatch'); |
@@ -30,12 +30,12 @@ discard block |
||
| 30 | 30 | protected function tokens(string $source): array |
| 31 | 31 | { |
| 32 | 32 | $lexer = new Lexer(); |
| 33 | - foreach (static::GRAMMARS as $grammar) { |
|
| 33 | + foreach (static::GRAMMARS as $grammar){ |
|
| 34 | 34 | $lexer->addGrammar(new $grammar()); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | $tokens = []; |
| 38 | - foreach ($lexer->parse(new StringStream($source)) as $t) { |
|
| 38 | + foreach ($lexer->parse(new StringStream($source)) as $t){ |
|
| 39 | 39 | $tokens[] = $t; |
| 40 | 40 | } |
| 41 | 41 | |
@@ -16,11 +16,13 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $parsed = $this->tokens($source); |
| 18 | 18 | |
| 19 | - if (count($tokens) !== count($parsed)) { |
|
| 19 | + if (count($tokens) !== count($parsed)) |
|
| 20 | + { |
|
| 20 | 21 | $this->fail('Token count mismatch'); |
| 21 | 22 | } |
| 22 | 23 | |
| 23 | - foreach ($tokens as $index => $token) { |
|
| 24 | + foreach ($tokens as $index => $token) |
|
| 25 | + { |
|
| 24 | 26 | self::assertSame($token->type, $parsed[$index]->type, 'Token type mismatch'); |
| 25 | 27 | self::assertSame($token->offset, $parsed[$index]->offset, 'Token offset mismatch'); |
| 26 | 28 | self::assertSame($token->content, $parsed[$index]->content, 'Token content mismatch'); |
@@ -30,12 +32,14 @@ discard block |
||
| 30 | 32 | protected function tokens(string $source): array |
| 31 | 33 | { |
| 32 | 34 | $lexer = new Lexer(); |
| 33 | - foreach (static::GRAMMARS as $grammar) { |
|
| 35 | + foreach (static::GRAMMARS as $grammar) |
|
| 36 | + { |
|
| 34 | 37 | $lexer->addGrammar(new $grammar()); |
| 35 | 38 | } |
| 36 | 39 | |
| 37 | 40 | $tokens = []; |
| 38 | - foreach ($lexer->parse(new StringStream($source)) as $t) { |
|
| 41 | + foreach ($lexer->parse(new StringStream($source)) as $t) |
|
| 42 | + { |
|
| 39 | 43 | $tokens[] = $t; |
| 40 | 44 | } |
| 41 | 45 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | public function testVerbatim4(): void |
| 68 | 68 | { |
| 69 | - self::assertSame('<script>alert(<?php echo json_encode' . |
|
| 69 | + self::assertSame('<script>alert(<?php echo json_encode'. |
|
| 70 | 70 | '("hello\' \'world", JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT, 512); ?>)</script>', $res = $this->compile('<script>alert({{ "hello\' \'world" }})</script>')->getContent()); |
| 71 | 71 | |
| 72 | 72 | self::assertSame('<script>alert("hello\u0027 \u0027world")</script>', $this->eval($res)); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | ob_start(); |
| 86 | 86 | |
| 87 | - eval('?>' . $body); |
|
| 87 | + eval('?>'.$body); |
|
| 88 | 88 | |
| 89 | 89 | return ob_get_clean(); |
| 90 | 90 | } |
@@ -97,9 +97,9 @@ discard block |
||
| 97 | 97 | ->with($name, 'bar', []) |
| 98 | 98 | ->willThrowException(new TestRetryException()); |
| 99 | 99 | |
| 100 | - try { |
|
| 100 | + try{ |
|
| 101 | 101 | $this->interceptor->process($name, 'bar', [], $this->core); |
| 102 | - } catch (RetryException $e) { |
|
| 102 | + }catch (RetryException $e){ |
|
| 103 | 103 | self::assertSame(1, $e->getOptions()->getDelay()); |
| 104 | 104 | self::assertSame(['attempts' => ['1']], $e->getOptions()->getHeaders()); |
| 105 | 105 | } |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | retryPolicy: new \Spiral\Queue\RetryPolicy(maxAttempts: 2, delay: 4) |
| 119 | 119 | )); |
| 120 | 120 | |
| 121 | - try { |
|
| 121 | + try{ |
|
| 122 | 122 | $this->interceptor->process($name, 'bar', [], $this->core); |
| 123 | - } catch (RetryException $e) { |
|
| 123 | + }catch (RetryException $e){ |
|
| 124 | 124 | self::assertSame(4, $e->getOptions()->getDelay()); |
| 125 | 125 | self::assertSame(['attempts' => ['1']], $e->getOptions()->getHeaders()); |
| 126 | 126 | } |
@@ -139,14 +139,14 @@ discard block |
||
| 139 | 139 | ->with($name, 'bar', ['headers' => ['attempts' => ['1']]]) |
| 140 | 140 | ->willThrowException(new TestRetryException()); |
| 141 | 141 | |
| 142 | - try { |
|
| 142 | + try{ |
|
| 143 | 143 | $this->interceptor->process( |
| 144 | 144 | $name, |
| 145 | 145 | 'bar', |
| 146 | 146 | ['headers' => ['attempts' => ['1']]], |
| 147 | 147 | $this->core |
| 148 | 148 | ); |
| 149 | - } catch (RetryException $e) { |
|
| 149 | + }catch (RetryException $e){ |
|
| 150 | 150 | self::assertSame(8, $e->getOptions()->getDelay()); |
| 151 | 151 | self::assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders()); |
| 152 | 152 | } |
@@ -167,14 +167,14 @@ discard block |
||
| 167 | 167 | retryPolicy: new \Spiral\Queue\RetryPolicy(maxAttempts: 3, delay: 4, multiplier: 2) |
| 168 | 168 | )); |
| 169 | 169 | |
| 170 | - try { |
|
| 170 | + try{ |
|
| 171 | 171 | $this->interceptor->process( |
| 172 | 172 | $name, |
| 173 | 173 | 'bar', |
| 174 | 174 | ['headers' => ['attempts' => ['1']]], |
| 175 | 175 | $this->core |
| 176 | 176 | ); |
| 177 | - } catch (RetryException $e) { |
|
| 177 | + }catch (RetryException $e){ |
|
| 178 | 178 | self::assertSame(8, $e->getOptions()->getDelay()); |
| 179 | 179 | self::assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders()); |
| 180 | 180 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | ->method('callAction') |
| 193 | 193 | ->with($name, 'bar', ['headers' => ['attempts' => ['1']]]) |
| 194 | 194 | ->willThrowException(new TestRetryException( |
| 195 | - retryPolicy: new class implements RetryPolicyInterface { |
|
| 195 | + retryPolicy: new class implements RetryPolicyInterface{ |
|
| 196 | 196 | public function isRetryable(\Throwable $exception, int $attempts = 0): bool |
| 197 | 197 | { |
| 198 | 198 | return true; |
@@ -205,14 +205,14 @@ discard block |
||
| 205 | 205 | } |
| 206 | 206 | )); |
| 207 | 207 | |
| 208 | - try { |
|
| 208 | + try{ |
|
| 209 | 209 | $this->interceptor->process( |
| 210 | 210 | $name, |
| 211 | 211 | 'bar', |
| 212 | 212 | ['headers' => ['attempts' => ['1']]], |
| 213 | 213 | $this->core |
| 214 | 214 | ); |
| 215 | - } catch (RetryException $e) { |
|
| 215 | + }catch (RetryException $e){ |
|
| 216 | 216 | self::assertSame(5, $e->getOptions()->getDelay()); |
| 217 | 217 | self::assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders()); |
| 218 | 218 | } |
@@ -235,14 +235,14 @@ discard block |
||
| 235 | 235 | ) |
| 236 | 236 | )); |
| 237 | 237 | |
| 238 | - try { |
|
| 238 | + try{ |
|
| 239 | 239 | $this->interceptor->process( |
| 240 | 240 | $name, |
| 241 | 241 | 'bar', |
| 242 | 242 | ['headers' => ['attempts' => ['1']]], |
| 243 | 243 | $this->core |
| 244 | 244 | ); |
| 245 | - } catch (RetryException $e) { |
|
| 245 | + }catch (RetryException $e){ |
|
| 246 | 246 | self::assertSame(8, $e->getOptions()->getDelay()); |
| 247 | 247 | self::assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders()); |
| 248 | 248 | } |
@@ -97,9 +97,12 @@ discard block |
||
| 97 | 97 | ->with($name, 'bar', []) |
| 98 | 98 | ->willThrowException(new TestRetryException()); |
| 99 | 99 | |
| 100 | - try { |
|
| 100 | + try |
|
| 101 | + { |
|
| 101 | 102 | $this->interceptor->process($name, 'bar', [], $this->core); |
| 102 | - } catch (RetryException $e) { |
|
| 103 | + } |
|
| 104 | + catch (RetryException $e) |
|
| 105 | + { |
|
| 103 | 106 | self::assertSame(1, $e->getOptions()->getDelay()); |
| 104 | 107 | self::assertSame(['attempts' => ['1']], $e->getOptions()->getHeaders()); |
| 105 | 108 | } |
@@ -118,9 +121,12 @@ discard block |
||
| 118 | 121 | retryPolicy: new \Spiral\Queue\RetryPolicy(maxAttempts: 2, delay: 4) |
| 119 | 122 | )); |
| 120 | 123 | |
| 121 | - try { |
|
| 124 | + try |
|
| 125 | + { |
|
| 122 | 126 | $this->interceptor->process($name, 'bar', [], $this->core); |
| 123 | - } catch (RetryException $e) { |
|
| 127 | + } |
|
| 128 | + catch (RetryException $e) |
|
| 129 | + { |
|
| 124 | 130 | self::assertSame(4, $e->getOptions()->getDelay()); |
| 125 | 131 | self::assertSame(['attempts' => ['1']], $e->getOptions()->getHeaders()); |
| 126 | 132 | } |
@@ -139,14 +145,17 @@ discard block |
||
| 139 | 145 | ->with($name, 'bar', ['headers' => ['attempts' => ['1']]]) |
| 140 | 146 | ->willThrowException(new TestRetryException()); |
| 141 | 147 | |
| 142 | - try { |
|
| 148 | + try |
|
| 149 | + { |
|
| 143 | 150 | $this->interceptor->process( |
| 144 | 151 | $name, |
| 145 | 152 | 'bar', |
| 146 | 153 | ['headers' => ['attempts' => ['1']]], |
| 147 | 154 | $this->core |
| 148 | 155 | ); |
| 149 | - } catch (RetryException $e) { |
|
| 156 | + } |
|
| 157 | + catch (RetryException $e) |
|
| 158 | + { |
|
| 150 | 159 | self::assertSame(8, $e->getOptions()->getDelay()); |
| 151 | 160 | self::assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders()); |
| 152 | 161 | } |
@@ -167,14 +176,17 @@ discard block |
||
| 167 | 176 | retryPolicy: new \Spiral\Queue\RetryPolicy(maxAttempts: 3, delay: 4, multiplier: 2) |
| 168 | 177 | )); |
| 169 | 178 | |
| 170 | - try { |
|
| 179 | + try |
|
| 180 | + { |
|
| 171 | 181 | $this->interceptor->process( |
| 172 | 182 | $name, |
| 173 | 183 | 'bar', |
| 174 | 184 | ['headers' => ['attempts' => ['1']]], |
| 175 | 185 | $this->core |
| 176 | 186 | ); |
| 177 | - } catch (RetryException $e) { |
|
| 187 | + } |
|
| 188 | + catch (RetryException $e) |
|
| 189 | + { |
|
| 178 | 190 | self::assertSame(8, $e->getOptions()->getDelay()); |
| 179 | 191 | self::assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders()); |
| 180 | 192 | } |
@@ -192,7 +204,8 @@ discard block |
||
| 192 | 204 | ->method('callAction') |
| 193 | 205 | ->with($name, 'bar', ['headers' => ['attempts' => ['1']]]) |
| 194 | 206 | ->willThrowException(new TestRetryException( |
| 195 | - retryPolicy: new class implements RetryPolicyInterface { |
|
| 207 | + retryPolicy: new class implements RetryPolicyInterface |
|
| 208 | + { |
|
| 196 | 209 | public function isRetryable(\Throwable $exception, int $attempts = 0): bool |
| 197 | 210 | { |
| 198 | 211 | return true; |
@@ -205,14 +218,17 @@ discard block |
||
| 205 | 218 | } |
| 206 | 219 | )); |
| 207 | 220 | |
| 208 | - try { |
|
| 221 | + try |
|
| 222 | + { |
|
| 209 | 223 | $this->interceptor->process( |
| 210 | 224 | $name, |
| 211 | 225 | 'bar', |
| 212 | 226 | ['headers' => ['attempts' => ['1']]], |
| 213 | 227 | $this->core |
| 214 | 228 | ); |
| 215 | - } catch (RetryException $e) { |
|
| 229 | + } |
|
| 230 | + catch (RetryException $e) |
|
| 231 | + { |
|
| 216 | 232 | self::assertSame(5, $e->getOptions()->getDelay()); |
| 217 | 233 | self::assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders()); |
| 218 | 234 | } |
@@ -235,14 +251,17 @@ discard block |
||
| 235 | 251 | ) |
| 236 | 252 | )); |
| 237 | 253 | |
| 238 | - try { |
|
| 254 | + try |
|
| 255 | + { |
|
| 239 | 256 | $this->interceptor->process( |
| 240 | 257 | $name, |
| 241 | 258 | 'bar', |
| 242 | 259 | ['headers' => ['attempts' => ['1']]], |
| 243 | 260 | $this->core |
| 244 | 261 | ); |
| 245 | - } catch (RetryException $e) { |
|
| 262 | + } |
|
| 263 | + catch (RetryException $e) |
|
| 264 | + { |
|
| 246 | 265 | self::assertSame(8, $e->getOptions()->getDelay()); |
| 247 | 266 | self::assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders()); |
| 248 | 267 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | { |
| 22 | 22 | $i = new Injector(); |
| 23 | 23 | |
| 24 | - $filename = __DIR__ . '/Fixtures/TestClass.php'; |
|
| 24 | + $filename = __DIR__.'/Fixtures/TestClass.php'; |
|
| 25 | 25 | $r = $i->injectDependencies( |
| 26 | 26 | file_get_contents($filename), |
| 27 | 27 | $this->getDefinition( |
@@ -34,10 +34,10 @@ discard block |
||
| 34 | 34 | ) |
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | - self::assertStringContainsString(Fixtures\Some::class . ';', $r); |
|
| 38 | - self::assertStringContainsString(Fixtures\SubFolder\Some::class . ' as Some2;', $r); |
|
| 39 | - self::assertStringNotContainsString(Fixtures\SubFolder\Some::class . ';', $r); |
|
| 40 | - self::assertStringContainsString(Fixtures\ATest3::class . ';', $r); |
|
| 37 | + self::assertStringContainsString(Fixtures\Some::class.';', $r); |
|
| 38 | + self::assertStringContainsString(Fixtures\SubFolder\Some::class.' as Some2;', $r); |
|
| 39 | + self::assertStringNotContainsString(Fixtures\SubFolder\Some::class.';', $r); |
|
| 40 | + self::assertStringContainsString(Fixtures\ATest3::class.';', $r); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $i = new Injector(); |
| 49 | 49 | |
| 50 | - $filename = __DIR__ . '/Fixtures/TestClassWithImports.php'; |
|
| 50 | + $filename = __DIR__.'/Fixtures/TestClassWithImports.php'; |
|
| 51 | 51 | $r = $i->injectDependencies( |
| 52 | 52 | file_get_contents($filename), |
| 53 | 53 | $this->getDefinition( |
@@ -60,12 +60,12 @@ discard block |
||
| 60 | 60 | ) |
| 61 | 61 | ); |
| 62 | 62 | |
| 63 | - self::assertStringContainsString(Fixtures\Some::class . ' as FTest;', $r); |
|
| 64 | - self::assertStringNotContainsString(Fixtures\Some::class . ';', $r); |
|
| 65 | - self::assertStringContainsString(Fixtures\SubFolder\Some::class . ' as TestAlias;', $r); |
|
| 66 | - self::assertStringNotContainsString(Fixtures\SubFolder\Some::class . ';', $r); |
|
| 67 | - self::assertStringContainsString(Fixtures\ATest3::class . ' as ATest;', $r); |
|
| 68 | - self::assertStringNotContainsString(Fixtures\ATest3::class . ';', $r); |
|
| 63 | + self::assertStringContainsString(Fixtures\Some::class.' as FTest;', $r); |
|
| 64 | + self::assertStringNotContainsString(Fixtures\Some::class.';', $r); |
|
| 65 | + self::assertStringContainsString(Fixtures\SubFolder\Some::class.' as TestAlias;', $r); |
|
| 66 | + self::assertStringNotContainsString(Fixtures\SubFolder\Some::class.';', $r); |
|
| 67 | + self::assertStringContainsString(Fixtures\ATest3::class.' as ATest;', $r); |
|
| 68 | + self::assertStringNotContainsString(Fixtures\ATest3::class.';', $r); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | { |
| 76 | 76 | $i = new Injector(); |
| 77 | 77 | |
| 78 | - $filename = __DIR__ . '/Fixtures/ChildClass.php'; |
|
| 78 | + $filename = __DIR__.'/Fixtures/ChildClass.php'; |
|
| 79 | 79 | $r = $i->injectDependencies( |
| 80 | 80 | file_get_contents($filename), |
| 81 | 81 | $this->getDefinition( |
@@ -88,18 +88,18 @@ discard block |
||
| 88 | 88 | ) |
| 89 | 89 | ); |
| 90 | 90 | |
| 91 | - self::assertStringContainsString(Fixtures\Some::class . ';', $r); |
|
| 92 | - self::assertStringContainsString(Fixtures\SubFolder\Some::class . ' as Some2;', $r); |
|
| 93 | - self::assertStringNotContainsString(Fixtures\SubFolder\Some::class . ';', $r); |
|
| 94 | - self::assertStringContainsString(Fixtures\ATest3::class . ' as ATestAlias;', $r); |
|
| 95 | - self::assertStringNotContainsString(Fixtures\ATest3::class . ';', $r); |
|
| 91 | + self::assertStringContainsString(Fixtures\Some::class.';', $r); |
|
| 92 | + self::assertStringContainsString(Fixtures\SubFolder\Some::class.' as Some2;', $r); |
|
| 93 | + self::assertStringNotContainsString(Fixtures\SubFolder\Some::class.';', $r); |
|
| 94 | + self::assertStringContainsString(Fixtures\ATest3::class.' as ATestAlias;', $r); |
|
| 95 | + self::assertStringNotContainsString(Fixtures\ATest3::class.';', $r); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | public function testDuplicateProperty(): void |
| 99 | 99 | { |
| 100 | 100 | $i = new Injector(); |
| 101 | 101 | |
| 102 | - $filename = __DIR__ . '/Fixtures/DuplicatePropertyClass.php'; |
|
| 102 | + $filename = __DIR__.'/Fixtures/DuplicatePropertyClass.php'; |
|
| 103 | 103 | $r = $i->injectDependencies( |
| 104 | 104 | file_get_contents($filename), |
| 105 | 105 | $this->getDefinition( |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | ) |
| 111 | 111 | ); |
| 112 | 112 | |
| 113 | - self::assertStringContainsString(Fixtures\Some::class . ';', $r); |
|
| 113 | + self::assertStringContainsString(Fixtures\Some::class.';', $r); |
|
| 114 | 114 | self::assertStringContainsString('__construct(private readonly Some $test)', $r); |
| 115 | 115 | } |
| 116 | 116 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $source = file_get_contents($filename); |
| 35 | 35 | self::assertStringContainsString('use PrototypeTrait;', $source); |
| 36 | 36 | |
| 37 | - try { |
|
| 37 | + try{ |
|
| 38 | 38 | $this->app->bindApp(); |
| 39 | 39 | |
| 40 | 40 | $inp = new ArrayInput(['--remove' => true]); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $this->app->get(Console::class)->run('prototype:inject', $inp, $out); |
| 43 | 43 | |
| 44 | 44 | self::assertStringNotContainsString('use PrototypeTrait;', file_get_contents($filename)); |
| 45 | - } finally { |
|
| 45 | + }finally{ |
|
| 46 | 46 | file_put_contents($filename, $source); |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -34,7 +34,8 @@ discard block |
||
| 34 | 34 | $source = file_get_contents($filename); |
| 35 | 35 | self::assertStringContainsString('use PrototypeTrait;', $source); |
| 36 | 36 | |
| 37 | - try { |
|
| 37 | + try |
|
| 38 | + { |
|
| 38 | 39 | $this->app->bindApp(); |
| 39 | 40 | |
| 40 | 41 | $inp = new ArrayInput(['--remove' => true]); |
@@ -42,7 +43,9 @@ discard block |
||
| 42 | 43 | $this->app->get(Console::class)->run('prototype:inject', $inp, $out); |
| 43 | 44 | |
| 44 | 45 | self::assertStringNotContainsString('use PrototypeTrait;', file_get_contents($filename)); |
| 45 | - } finally { |
|
| 46 | + } |
|
| 47 | + finally |
|
| 48 | + { |
|
| 46 | 49 | file_put_contents($filename, $source); |
| 47 | 50 | } |
| 48 | 51 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | $e = new PropertyExtractor(); |
| 15 | 15 | |
| 16 | 16 | $expected = ['test', 'test2', 'test3', 'testClass']; |
| 17 | - $prototypes = $e->getPrototypeProperties(file_get_contents(__DIR__ . '/Fixtures/TestClass.php')); |
|
| 17 | + $prototypes = $e->getPrototypeProperties(file_get_contents(__DIR__.'/Fixtures/TestClass.php')); |
|
| 18 | 18 | sort($prototypes); |
| 19 | 19 | self::assertSame($expected, $prototypes); |
| 20 | 20 | } |
@@ -22,6 +22,6 @@ discard block |
||
| 22 | 22 | public function testExtractNone(): void |
| 23 | 23 | { |
| 24 | 24 | $e = new PropertyExtractor(); |
| 25 | - self::assertSame([], $e->getPrototypeProperties(file_get_contents(__DIR__ . '/Fixtures/HydratedClass.php'))); |
|
| 25 | + self::assertSame([], $e->getPrototypeProperties(file_get_contents(__DIR__.'/Fixtures/HydratedClass.php'))); |
|
| 26 | 26 | } |
| 27 | 27 | } |
@@ -142,7 +142,7 @@ |
||
| 142 | 142 | $file->addUse('Foo\\Bar'); |
| 143 | 143 | $file->addClass('Test')->addImplement('Foo\\Bar'); |
| 144 | 144 | |
| 145 | - self::assertStringContainsString('use Foo\\Bar;', (string) $file); |
|
| 145 | + self::assertStringContainsString('use Foo\\Bar;', (string)$file); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | public function testStrictTypes(): void |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | public function testStatic(): void |
| 174 | 174 | { |
| 175 | - $method = new Method('test');; |
|
| 175 | + $method = new Method('test'); ; |
|
| 176 | 176 | |
| 177 | 177 | self::assertFalse($method->isStatic()); |
| 178 | 178 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | public function testFinal(): void |
| 190 | 190 | { |
| 191 | - $method = new Method('test');; |
|
| 191 | + $method = new Method('test'); ; |
|
| 192 | 192 | |
| 193 | 193 | self::assertFalse($method->isFinal()); |
| 194 | 194 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | public function testAbstract(): void |
| 206 | 206 | { |
| 207 | - $method = new Method('test');; |
|
| 207 | + $method = new Method('test'); ; |
|
| 208 | 208 | |
| 209 | 209 | self::assertFalse($method->isAbstract()); |
| 210 | 210 | |
@@ -133,38 +133,38 @@ |
||
| 133 | 133 | $method = new Method('test'); |
| 134 | 134 | self::assertNull($method->getVisibility()); |
| 135 | 135 | |
| 136 | - $method->setVisibility(Visibility::PUBLIC); |
|
| 137 | - self::assertSame(Visibility::PUBLIC, $method->getVisibility()); |
|
| 136 | + $method->setVisibility(Visibility::public); |
|
| 137 | + self::assertSame(Visibility::public, $method->getVisibility()); |
|
| 138 | 138 | self::assertTrue($method->isPublic()); |
| 139 | 139 | self::assertFalse($method->isProtected()); |
| 140 | 140 | self::assertFalse($method->isPrivate()); |
| 141 | 141 | |
| 142 | - $method->setVisibility(Visibility::PROTECTED); |
|
| 143 | - self::assertSame(Visibility::PROTECTED, $method->getVisibility()); |
|
| 142 | + $method->setVisibility(Visibility::protected); |
|
| 143 | + self::assertSame(Visibility::protected, $method->getVisibility()); |
|
| 144 | 144 | self::assertFalse($method->isPublic()); |
| 145 | 145 | self::assertTrue($method->isProtected()); |
| 146 | 146 | self::assertFalse($method->isPrivate()); |
| 147 | 147 | |
| 148 | - $method->setVisibility(Visibility::PRIVATE); |
|
| 149 | - self::assertSame(Visibility::PRIVATE, $method->getVisibility()); |
|
| 148 | + $method->setVisibility(Visibility::private); |
|
| 149 | + self::assertSame(Visibility::private, $method->getVisibility()); |
|
| 150 | 150 | self::assertFalse($method->isPublic()); |
| 151 | 151 | self::assertFalse($method->isProtected()); |
| 152 | 152 | self::assertTrue($method->isPrivate()); |
| 153 | 153 | |
| 154 | 154 | $method->setPublic(); |
| 155 | - self::assertSame(Visibility::PUBLIC, $method->getVisibility()); |
|
| 155 | + self::assertSame(Visibility::public, $method->getVisibility()); |
|
| 156 | 156 | self::assertTrue($method->isPublic()); |
| 157 | 157 | self::assertFalse($method->isProtected()); |
| 158 | 158 | self::assertFalse($method->isPrivate()); |
| 159 | 159 | |
| 160 | 160 | $method->setProtected(); |
| 161 | - self::assertSame(Visibility::PROTECTED, $method->getVisibility()); |
|
| 161 | + self::assertSame(Visibility::protected, $method->getVisibility()); |
|
| 162 | 162 | self::assertFalse($method->isPublic()); |
| 163 | 163 | self::assertTrue($method->isProtected()); |
| 164 | 164 | self::assertFalse($method->isPrivate()); |
| 165 | 165 | |
| 166 | 166 | $method->setPrivate(); |
| 167 | - self::assertSame(Visibility::PRIVATE, $method->getVisibility()); |
|
| 167 | + self::assertSame(Visibility::private, $method->getVisibility()); |
|
| 168 | 168 | self::assertFalse($method->isPublic()); |
| 169 | 169 | self::assertFalse($method->isProtected()); |
| 170 | 170 | self::assertTrue($method->isPrivate()); |