@@ -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 | } |
@@ -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 |
@@ -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()); |
@@ -35,38 +35,38 @@ |
||
35 | 35 | $param = new PromotedParameter('test'); |
36 | 36 | self::assertNull($param->getVisibility()); |
37 | 37 | |
38 | - $param->setVisibility(Visibility::PUBLIC); |
|
39 | - self::assertSame(Visibility::PUBLIC, $param->getVisibility()); |
|
38 | + $param->setVisibility(Visibility::public); |
|
39 | + self::assertSame(Visibility::public, $param->getVisibility()); |
|
40 | 40 | self::assertTrue($param->isPublic()); |
41 | 41 | self::assertFalse($param->isProtected()); |
42 | 42 | self::assertFalse($param->isPrivate()); |
43 | 43 | |
44 | - $param->setVisibility(Visibility::PROTECTED); |
|
45 | - self::assertSame(Visibility::PROTECTED, $param->getVisibility()); |
|
44 | + $param->setVisibility(Visibility::protected); |
|
45 | + self::assertSame(Visibility::protected, $param->getVisibility()); |
|
46 | 46 | self::assertFalse($param->isPublic()); |
47 | 47 | self::assertTrue($param->isProtected()); |
48 | 48 | self::assertFalse($param->isPrivate()); |
49 | 49 | |
50 | - $param->setVisibility(Visibility::PRIVATE); |
|
51 | - self::assertSame(Visibility::PRIVATE, $param->getVisibility()); |
|
50 | + $param->setVisibility(Visibility::private); |
|
51 | + self::assertSame(Visibility::private, $param->getVisibility()); |
|
52 | 52 | self::assertFalse($param->isPublic()); |
53 | 53 | self::assertFalse($param->isProtected()); |
54 | 54 | self::assertTrue($param->isPrivate()); |
55 | 55 | |
56 | 56 | $param->setPublic(); |
57 | - self::assertSame(Visibility::PUBLIC, $param->getVisibility()); |
|
57 | + self::assertSame(Visibility::public, $param->getVisibility()); |
|
58 | 58 | self::assertTrue($param->isPublic()); |
59 | 59 | self::assertFalse($param->isProtected()); |
60 | 60 | self::assertFalse($param->isPrivate()); |
61 | 61 | |
62 | 62 | $param->setProtected(); |
63 | - self::assertSame(Visibility::PROTECTED, $param->getVisibility()); |
|
63 | + self::assertSame(Visibility::protected, $param->getVisibility()); |
|
64 | 64 | self::assertFalse($param->isPublic()); |
65 | 65 | self::assertTrue($param->isProtected()); |
66 | 66 | self::assertFalse($param->isPrivate()); |
67 | 67 | |
68 | 68 | $param->setPrivate(); |
69 | - self::assertSame(Visibility::PRIVATE, $param->getVisibility()); |
|
69 | + self::assertSame(Visibility::private, $param->getVisibility()); |
|
70 | 70 | self::assertFalse($param->isPublic()); |
71 | 71 | self::assertFalse($param->isProtected()); |
72 | 72 | self::assertTrue($param->isPrivate()); |