@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | public function testEnsureDirectory(): void |
26 | 26 | { |
27 | 27 | $files = new Files(); |
28 | - $directory = self::FIXTURE_DIRECTORY . 'directory/'; |
|
28 | + $directory = self::FIXTURE_DIRECTORY.'directory/'; |
|
29 | 29 | |
30 | 30 | self::assertFalse($files->exists($directory)); |
31 | 31 | self::assertFalse($files->isDirectory($directory)); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | public function testEnsureExistedDirectory(): void |
40 | 40 | { |
41 | 41 | $files = new Files(); |
42 | - $directory = self::FIXTURE_DIRECTORY . 'directory/'; |
|
42 | + $directory = self::FIXTURE_DIRECTORY.'directory/'; |
|
43 | 43 | |
44 | 44 | self::assertFalse($files->exists($directory)); |
45 | 45 | self::assertFalse($files->isDirectory($directory)); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | public function testEnsureNestedDirectory(): void |
59 | 59 | { |
60 | 60 | $files = new Files(); |
61 | - $directory = self::FIXTURE_DIRECTORY . 'directory/sub/other'; |
|
61 | + $directory = self::FIXTURE_DIRECTORY.'directory/sub/other'; |
|
62 | 62 | |
63 | 63 | self::assertFalse($files->exists($directory)); |
64 | 64 | self::assertFalse($files->isDirectory($directory)); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | public function testEnsureNestedDirectoryNoRecursivePermissions(): void |
73 | 73 | { |
74 | 74 | $files = new Files(); |
75 | - $directory = self::FIXTURE_DIRECTORY . 'directory/sub/other'; |
|
75 | + $directory = self::FIXTURE_DIRECTORY.'directory/sub/other'; |
|
76 | 76 | |
77 | 77 | self::assertFalse($files->exists($directory)); |
78 | 78 | self::assertFalse($files->isDirectory($directory)); |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | public function testEnsureExistedNestedDirectory(): void |
87 | 87 | { |
88 | 88 | $files = new Files(); |
89 | - $directory = self::FIXTURE_DIRECTORY . 'directory/sub/other'; |
|
89 | + $directory = self::FIXTURE_DIRECTORY.'directory/sub/other'; |
|
90 | 90 | |
91 | 91 | self::assertFalse($files->exists($directory)); |
92 | 92 | self::assertFalse($files->isDirectory($directory)); |
93 | 93 | |
94 | - mkdir(self::FIXTURE_DIRECTORY . 'directory'); |
|
95 | - mkdir(self::FIXTURE_DIRECTORY . 'directory/sub'); |
|
96 | - mkdir(self::FIXTURE_DIRECTORY . 'directory/sub/other'); |
|
94 | + mkdir(self::FIXTURE_DIRECTORY.'directory'); |
|
95 | + mkdir(self::FIXTURE_DIRECTORY.'directory/sub'); |
|
96 | + mkdir(self::FIXTURE_DIRECTORY.'directory/sub/other'); |
|
97 | 97 | |
98 | 98 | self::assertTrue($files->exists($directory)); |
99 | 99 | self::assertTrue($files->isDirectory($directory)); |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | public function testDeleteDirectoryContent(): void |
108 | 108 | { |
109 | 109 | $files = new Files(); |
110 | - $baseDirectory = self::FIXTURE_DIRECTORY . 'directory/'; |
|
111 | - $directory = $baseDirectory . 'sub/other'; |
|
110 | + $baseDirectory = self::FIXTURE_DIRECTORY.'directory/'; |
|
111 | + $directory = $baseDirectory.'sub/other'; |
|
112 | 112 | |
113 | 113 | $filenames = [ |
114 | - $baseDirectory . 'test.file', |
|
115 | - $directory . 'other.file', |
|
116 | - $directory . '.sample', |
|
114 | + $baseDirectory.'test.file', |
|
115 | + $directory.'other.file', |
|
116 | + $directory.'.sample', |
|
117 | 117 | ]; |
118 | 118 | |
119 | 119 | self::assertFalse($files->exists($baseDirectory)); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | self::assertTrue($files->exists($directory)); |
131 | 131 | self::assertTrue($files->isDirectory($directory)); |
132 | 132 | |
133 | - foreach ($filenames as $filename) { |
|
133 | + foreach ($filenames as $filename){ |
|
134 | 134 | self::assertFalse($files->exists($filename)); |
135 | 135 | $files->write($filename, 'random-data'); |
136 | 136 | self::assertTrue($files->exists($filename)); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | self::assertFalse($files->exists($directory)); |
145 | 145 | self::assertFalse($files->isDirectory($directory)); |
146 | 146 | |
147 | - foreach ($filenames as $filename) { |
|
147 | + foreach ($filenames as $filename){ |
|
148 | 148 | self::assertFalse($files->exists($filename)); |
149 | 149 | } |
150 | 150 | } |
@@ -152,13 +152,13 @@ discard block |
||
152 | 152 | public function testDeleteDirectory(): void |
153 | 153 | { |
154 | 154 | $files = new Files(); |
155 | - $baseDirectory = self::FIXTURE_DIRECTORY . 'directory/'; |
|
156 | - $directory = $baseDirectory . 'sub/other'; |
|
155 | + $baseDirectory = self::FIXTURE_DIRECTORY.'directory/'; |
|
156 | + $directory = $baseDirectory.'sub/other'; |
|
157 | 157 | |
158 | 158 | $filenames = [ |
159 | - $baseDirectory . 'test.file', |
|
160 | - $directory . 'other.file', |
|
161 | - $directory . '.sample', |
|
159 | + $baseDirectory.'test.file', |
|
160 | + $directory.'other.file', |
|
161 | + $directory.'.sample', |
|
162 | 162 | ]; |
163 | 163 | |
164 | 164 | self::assertFalse($files->exists($baseDirectory)); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | self::assertTrue($files->exists($directory)); |
176 | 176 | self::assertTrue($files->isDirectory($directory)); |
177 | 177 | |
178 | - foreach ($filenames as $filename) { |
|
178 | + foreach ($filenames as $filename){ |
|
179 | 179 | self::assertFalse($files->exists($filename)); |
180 | 180 | $files->write($filename, 'random-data'); |
181 | 181 | self::assertTrue($files->exists($filename)); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | self::assertFalse($files->exists($directory)); |
190 | 190 | self::assertFalse($files->isDirectory($directory)); |
191 | 191 | |
192 | - foreach ($filenames as $filename) { |
|
192 | + foreach ($filenames as $filename){ |
|
193 | 193 | self::assertFalse($files->exists($filename)); |
194 | 194 | } |
195 | 195 | } |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | |
201 | 201 | $files = new Files(); |
202 | 202 | |
203 | - $files->write(self::FIXTURE_DIRECTORY . 'test', 'data'); |
|
204 | - $files->deleteDirectory(self::FIXTURE_DIRECTORY . 'test'); |
|
203 | + $files->write(self::FIXTURE_DIRECTORY.'test', 'data'); |
|
204 | + $files->deleteDirectory(self::FIXTURE_DIRECTORY.'test'); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | public function testGetFiles(): void |
@@ -130,7 +130,8 @@ discard block |
||
130 | 130 | self::assertTrue($files->exists($directory)); |
131 | 131 | self::assertTrue($files->isDirectory($directory)); |
132 | 132 | |
133 | - foreach ($filenames as $filename) { |
|
133 | + foreach ($filenames as $filename) |
|
134 | + { |
|
134 | 135 | self::assertFalse($files->exists($filename)); |
135 | 136 | $files->write($filename, 'random-data'); |
136 | 137 | self::assertTrue($files->exists($filename)); |
@@ -144,7 +145,8 @@ discard block |
||
144 | 145 | self::assertFalse($files->exists($directory)); |
145 | 146 | self::assertFalse($files->isDirectory($directory)); |
146 | 147 | |
147 | - foreach ($filenames as $filename) { |
|
148 | + foreach ($filenames as $filename) |
|
149 | + { |
|
148 | 150 | self::assertFalse($files->exists($filename)); |
149 | 151 | } |
150 | 152 | } |
@@ -175,7 +177,8 @@ discard block |
||
175 | 177 | self::assertTrue($files->exists($directory)); |
176 | 178 | self::assertTrue($files->isDirectory($directory)); |
177 | 179 | |
178 | - foreach ($filenames as $filename) { |
|
180 | + foreach ($filenames as $filename) |
|
181 | + { |
|
179 | 182 | self::assertFalse($files->exists($filename)); |
180 | 183 | $files->write($filename, 'random-data'); |
181 | 184 | self::assertTrue($files->exists($filename)); |
@@ -189,7 +192,8 @@ discard block |
||
189 | 192 | self::assertFalse($files->exists($directory)); |
190 | 193 | self::assertFalse($files->isDirectory($directory)); |
191 | 194 | |
192 | - foreach ($filenames as $filename) { |
|
195 | + foreach ($filenames as $filename) |
|
196 | + { |
|
193 | 197 | self::assertFalse($files->exists($filename)); |
194 | 198 | } |
195 | 199 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | $files = new Files(); |
29 | 29 | |
30 | - $filename = self::FIXTURE_DIRECTORY . '/test.txt'; |
|
30 | + $filename = self::FIXTURE_DIRECTORY.'/test.txt'; |
|
31 | 31 | self::assertFalse($files->exists($filename)); |
32 | 32 | |
33 | 33 | $files->write($filename, 'some-data'); |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | { |
41 | 41 | $files = new Files(); |
42 | 42 | |
43 | - $directory = self::FIXTURE_DIRECTORY . '/directory/abc/'; |
|
44 | - $filename = $directory . 'test.txt'; |
|
43 | + $directory = self::FIXTURE_DIRECTORY.'/directory/abc/'; |
|
44 | + $filename = $directory.'test.txt'; |
|
45 | 45 | |
46 | 46 | self::assertFalse($files->exists($directory)); |
47 | 47 | self::assertFalse($files->exists($filename)); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | { |
60 | 60 | $files = new Files(); |
61 | 61 | |
62 | - $filename = self::FIXTURE_DIRECTORY . '/test.txt'; |
|
62 | + $filename = self::FIXTURE_DIRECTORY.'/test.txt'; |
|
63 | 63 | self::assertFalse($files->exists($filename)); |
64 | 64 | |
65 | 65 | $files->write($filename, 'some-data'); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | $files = new Files(); |
77 | 77 | |
78 | - $filename = self::FIXTURE_DIRECTORY . '/test.txt'; |
|
78 | + $filename = self::FIXTURE_DIRECTORY.'/test.txt'; |
|
79 | 79 | self::assertFalse($files->exists($filename)); |
80 | 80 | |
81 | 81 | $files->read($filename); |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | $this->expectException(FileNotFoundException::class); |
95 | 95 | |
96 | 96 | $files = new Files(); |
97 | - $files->getPermissions(self::FIXTURE_DIRECTORY . '/missing'); |
|
97 | + $files->getPermissions(self::FIXTURE_DIRECTORY.'/missing'); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | public function testAppend(): void |
101 | 101 | { |
102 | 102 | $files = new Files(); |
103 | 103 | |
104 | - $filename = self::FIXTURE_DIRECTORY . '/test.txt'; |
|
104 | + $filename = self::FIXTURE_DIRECTORY.'/test.txt'; |
|
105 | 105 | self::assertFalse($files->exists($filename)); |
106 | 106 | |
107 | 107 | $files->append($filename, 'some-data'); |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | { |
118 | 118 | $files = new Files(); |
119 | 119 | |
120 | - $directory = self::FIXTURE_DIRECTORY . '/directory/abc/'; |
|
121 | - $filename = $directory . 'test.txt'; |
|
120 | + $directory = self::FIXTURE_DIRECTORY.'/directory/abc/'; |
|
121 | + $filename = $directory.'test.txt'; |
|
122 | 122 | |
123 | 123 | self::assertFalse($files->exists($directory)); |
124 | 124 | self::assertFalse($files->exists($filename)); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | { |
140 | 140 | $files = new Files(); |
141 | 141 | |
142 | - $filename = self::FIXTURE_DIRECTORY . '/test.txt'; |
|
142 | + $filename = self::FIXTURE_DIRECTORY.'/test.txt'; |
|
143 | 143 | |
144 | 144 | self::assertFalse($files->exists($filename)); |
145 | 145 | $files->touch($filename); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | public function testDelete(): void |
150 | 150 | { |
151 | 151 | $files = new Files(); |
152 | - $filename = self::FIXTURE_DIRECTORY . '/test.txt'; |
|
152 | + $filename = self::FIXTURE_DIRECTORY.'/test.txt'; |
|
153 | 153 | |
154 | 154 | self::assertFalse($files->exists($filename)); |
155 | 155 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | public function testDeleteMissingFile(): void |
164 | 164 | { |
165 | 165 | $files = new Files(); |
166 | - $filename = self::FIXTURE_DIRECTORY . '/test.txt'; |
|
166 | + $filename = self::FIXTURE_DIRECTORY.'/test.txt'; |
|
167 | 167 | |
168 | 168 | self::assertFalse($files->exists($filename)); |
169 | 169 | $files->delete($filename); |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | public function testCopy(): void |
173 | 173 | { |
174 | 174 | $files = new Files(); |
175 | - $filename = self::FIXTURE_DIRECTORY . '/test.txt'; |
|
176 | - $destination = self::FIXTURE_DIRECTORY . '/new.txt'; |
|
175 | + $filename = self::FIXTURE_DIRECTORY.'/test.txt'; |
|
176 | + $destination = self::FIXTURE_DIRECTORY.'/new.txt'; |
|
177 | 177 | |
178 | 178 | self::assertFalse($files->exists($filename)); |
179 | 179 | $files->write($filename, 'some-data'); |
@@ -196,8 +196,8 @@ discard block |
||
196 | 196 | $this->expectException(FileNotFoundException::class); |
197 | 197 | |
198 | 198 | $files = new Files(); |
199 | - $filename = self::FIXTURE_DIRECTORY . '/test.txt'; |
|
200 | - $destination = self::FIXTURE_DIRECTORY . '/new.txt'; |
|
199 | + $filename = self::FIXTURE_DIRECTORY.'/test.txt'; |
|
200 | + $destination = self::FIXTURE_DIRECTORY.'/new.txt'; |
|
201 | 201 | |
202 | 202 | self::assertFalse($files->exists($filename)); |
203 | 203 | $files->copy($filename, $destination); |
@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | public function testMove(): void |
207 | 207 | { |
208 | 208 | $files = new Files(); |
209 | - $filename = self::FIXTURE_DIRECTORY . '/test.txt'; |
|
210 | - $destination = self::FIXTURE_DIRECTORY . '/new.txt'; |
|
209 | + $filename = self::FIXTURE_DIRECTORY.'/test.txt'; |
|
210 | + $destination = self::FIXTURE_DIRECTORY.'/new.txt'; |
|
211 | 211 | |
212 | 212 | self::assertFalse($files->exists($filename)); |
213 | 213 | $files->write($filename, 'some-data'); |
@@ -230,8 +230,8 @@ discard block |
||
230 | 230 | $this->expectException(FileNotFoundException::class); |
231 | 231 | |
232 | 232 | $files = new Files(); |
233 | - $filename = self::FIXTURE_DIRECTORY . '/test.txt'; |
|
234 | - $destination = self::FIXTURE_DIRECTORY . '/new.txt'; |
|
233 | + $filename = self::FIXTURE_DIRECTORY.'/test.txt'; |
|
234 | + $destination = self::FIXTURE_DIRECTORY.'/new.txt'; |
|
235 | 235 | |
236 | 236 | self::assertFalse($files->exists($filename)); |
237 | 237 | $files->move($filename, $destination); |
@@ -48,7 +48,7 @@ |
||
48 | 48 | |
49 | 49 | self::assertFalse($files->isDirectory($directory)); |
50 | 50 | |
51 | - $files->write($filename, 'some-data', FilesInterface::READONLY, true); |
|
51 | + $files->write($filename, 'some-data', FilesInterface::readonly, true); |
|
52 | 52 | |
53 | 53 | self::assertTrue($files->isDirectory($directory)); |
54 | 54 | self::assertTrue($files->exists($filename)); |
@@ -119,7 +119,7 @@ |
||
119 | 119 | -o, --id[=ID] Id option description. (multiple values allowed) |
120 | 120 | -Q, --quit Quit option description. |
121 | 121 | --naf[=NAF] Naf option description. [default: "default"] |
122 | -HELP, $core->run(command: 'help', input: ['command_name' => 'foo:bar'])->getOutput()->fetch()); |
|
122 | +help, $core->run(command: 'help', input: ['command_name' => 'foo:bar'])->getOutput()->fetch()); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | public function testDescriptionFromConstant(): void |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | self::assertCount(0, $routes->getCollection()); |
19 | 19 | |
20 | - $routes->import(\dirname(__DIR__, 2) . '/Fixtures/file.php'); |
|
20 | + $routes->import(\dirname(__DIR__, 2).'/Fixtures/file.php'); |
|
21 | 21 | |
22 | 22 | self::assertCount(3, $routes->getCollection()); |
23 | 23 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | self::assertCount(0, $routes->getCollection()); |
30 | 30 | |
31 | - $routes->import(\dirname(__DIR__, 2) . '/Fixtures/file.php', 'php'); |
|
31 | + $routes->import(\dirname(__DIR__, 2).'/Fixtures/file.php', 'php'); |
|
32 | 32 | |
33 | 33 | self::assertCount(3, $routes->getCollection()); |
34 | 34 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | self::assertCount(0, $routes->getCollection()); |
41 | 41 | |
42 | - $routes->import(\dirname(__DIR__, 2) . '/Fixtures/file.php', 'yaml'); |
|
42 | + $routes->import(\dirname(__DIR__, 2).'/Fixtures/file.php', 'yaml'); |
|
43 | 43 | |
44 | 44 | self::assertCount(0, $routes->getCollection()); |
45 | 45 | } |
@@ -29,12 +29,12 @@ |
||
29 | 29 | { |
30 | 30 | $loader = new PhpFileLoader($this->container, $this->container); |
31 | 31 | |
32 | - $routes = $loader->load(\dirname(__DIR__) . '/Fixtures/file.php'); |
|
32 | + $routes = $loader->load(\dirname(__DIR__).'/Fixtures/file.php'); |
|
33 | 33 | self::assertInstanceOf(RouteCollection::class, $routes); |
34 | 34 | self::assertCount(3, $routes); |
35 | 35 | |
36 | 36 | $this->expectException(LoaderLoadException::class); |
37 | - $loader->load(\dirname(__DIR__) . '/Fixtures/unknown.php'); |
|
37 | + $loader->load(\dirname(__DIR__).'/Fixtures/unknown.php'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | public function testSupports(): void |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $dispatcher |
55 | 55 | ->expects(self::exactly(2)) |
56 | 56 | ->method('dispatch') |
57 | - ->with($this->callback(static fn (Routing|RouteMatched $event): bool => $event->request instanceof ServerRequest)); |
|
57 | + ->with($this->callback(static fn (Routing | RouteMatched $event): bool => $event->request instanceof ServerRequest)); |
|
58 | 58 | |
59 | 59 | $router = $this->makeRouter('', $dispatcher); |
60 | 60 | $router->setDefault($route); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $router->import($configurator); |
91 | 91 | $this->getContainer()->get(GroupRegistry::class)->registerRoutes($router); |
92 | 92 | |
93 | - $uri = (string) $router->uri('foo', ['host' => 'some']); |
|
93 | + $uri = (string)$router->uri('foo', ['host' => 'some']); |
|
94 | 94 | self::assertSame('some/register', $uri); |
95 | 95 | self::assertFalse(\str_contains('https://host.com', $uri)); |
96 | 96 | } |
@@ -96,9 +96,9 @@ |
||
96 | 96 | self::assertSame('echoed', (string)$response->getBody()); |
97 | 97 | |
98 | 98 | $e = null; |
99 | - try { |
|
99 | + try{ |
|
100 | 100 | $router->handle(new ServerRequest('GET', new Uri('/test'))); |
101 | - } catch (UndefinedRouteException $e) { |
|
101 | + }catch (UndefinedRouteException $e){ |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | self::assertNotNull($e, 'Autofill not fired'); |
@@ -96,9 +96,12 @@ |
||
96 | 96 | self::assertSame('echoed', (string)$response->getBody()); |
97 | 97 | |
98 | 98 | $e = null; |
99 | - try { |
|
99 | + try |
|
100 | + { |
|
100 | 101 | $router->handle(new ServerRequest('GET', new Uri('/test'))); |
101 | - } catch (UndefinedRouteException $e) { |
|
102 | + } |
|
103 | + catch (UndefinedRouteException $e) |
|
104 | + { |
|
102 | 105 | } |
103 | 106 | |
104 | 107 | self::assertNotNull($e, 'Autofill not fired'); |
@@ -150,7 +150,7 @@ |
||
150 | 150 | $route = $this->router->getRoute('name'); |
151 | 151 | self::assertNotNull($route->match(new ServerRequest('GET', '/api/blog'))); |
152 | 152 | |
153 | - self::assertSame('/api/blog', (string) $route->uri()); |
|
153 | + self::assertSame('/api/blog', (string)$route->uri()); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | public static function routePrefixDataProvider(): iterable |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | $doc = $this->parse('<a href="url"></a>'); |
33 | 33 | |
34 | 34 | $t = new Traverser(); |
35 | - $t->addVisitor(new class() implements VisitorInterface { |
|
35 | + $t->addVisitor(new class() implements VisitorInterface{ |
|
36 | 36 | public function enterNode(mixed $node, VisitorContext $ctx): mixed |
37 | 37 | { |
38 | - if ($node instanceof Tag && $node->name === 'a') { |
|
38 | + if ($node instanceof Tag && $node->name === 'a'){ |
|
39 | 39 | $node->name = 'b'; |
40 | 40 | } |
41 | 41 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $doc = $this->parse('<a href="url"></a>'); |
59 | 59 | |
60 | 60 | $t = new Traverser(); |
61 | - $t->addVisitor(new class() implements VisitorInterface { |
|
61 | + $t->addVisitor(new class() implements VisitorInterface{ |
|
62 | 62 | public function enterNode(mixed $node, VisitorContext $ctx): mixed |
63 | 63 | { |
64 | 64 | return null; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | public function leaveNode(mixed $node, VisitorContext $ctx): mixed |
68 | 68 | { |
69 | - if ($node instanceof Tag && $node->name === 'a') { |
|
69 | + if ($node instanceof Tag && $node->name === 'a'){ |
|
70 | 70 | $new = new Tag(); |
71 | 71 | $new->name = 'link'; |
72 | 72 | $new->void = true; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $doc = $this->parse('<a href="url"><b></b>hello</a>'); |
89 | 89 | |
90 | 90 | $t = new Traverser(); |
91 | - $t->addVisitor(new class() implements VisitorInterface { |
|
91 | + $t->addVisitor(new class() implements VisitorInterface{ |
|
92 | 92 | public function enterNode(mixed $node, VisitorContext $ctx): mixed |
93 | 93 | { |
94 | 94 | return null; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | public function leaveNode(mixed $node, VisitorContext $ctx): mixed |
98 | 98 | { |
99 | - if ($node instanceof Tag && $node->name === 'b') { |
|
99 | + if ($node instanceof Tag && $node->name === 'b'){ |
|
100 | 100 | return VisitorInterface::REMOVE_NODE; |
101 | 101 | } |
102 | 102 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | public function enterNode(mixed $node, VisitorContext $ctx): mixed |
125 | 125 | { |
126 | - if ($ctx->getCurrentNode() instanceof Raw) { |
|
126 | + if ($ctx->getCurrentNode() instanceof Raw){ |
|
127 | 127 | self::assertInstanceOf(Tag::class, $ctx->getParentNode()); |
128 | 128 | self::assertSame('b', $ctx->getParentNode()->name); |
129 | 129 |
@@ -32,10 +32,12 @@ discard block |
||
32 | 32 | $doc = $this->parse('<a href="url"></a>'); |
33 | 33 | |
34 | 34 | $t = new Traverser(); |
35 | - $t->addVisitor(new class() implements VisitorInterface { |
|
35 | + $t->addVisitor(new class() implements VisitorInterface |
|
36 | + { |
|
36 | 37 | public function enterNode(mixed $node, VisitorContext $ctx): mixed |
37 | 38 | { |
38 | - if ($node instanceof Tag && $node->name === 'a') { |
|
39 | + if ($node instanceof Tag && $node->name === 'a') |
|
40 | + { |
|
39 | 41 | $node->name = 'b'; |
40 | 42 | } |
41 | 43 | |
@@ -58,7 +60,8 @@ discard block |
||
58 | 60 | $doc = $this->parse('<a href="url"></a>'); |
59 | 61 | |
60 | 62 | $t = new Traverser(); |
61 | - $t->addVisitor(new class() implements VisitorInterface { |
|
63 | + $t->addVisitor(new class() implements VisitorInterface |
|
64 | + { |
|
62 | 65 | public function enterNode(mixed $node, VisitorContext $ctx): mixed |
63 | 66 | { |
64 | 67 | return null; |
@@ -66,7 +69,8 @@ discard block |
||
66 | 69 | |
67 | 70 | public function leaveNode(mixed $node, VisitorContext $ctx): mixed |
68 | 71 | { |
69 | - if ($node instanceof Tag && $node->name === 'a') { |
|
72 | + if ($node instanceof Tag && $node->name === 'a') |
|
73 | + { |
|
70 | 74 | $new = new Tag(); |
71 | 75 | $new->name = 'link'; |
72 | 76 | $new->void = true; |
@@ -88,7 +92,8 @@ discard block |
||
88 | 92 | $doc = $this->parse('<a href="url"><b></b>hello</a>'); |
89 | 93 | |
90 | 94 | $t = new Traverser(); |
91 | - $t->addVisitor(new class() implements VisitorInterface { |
|
95 | + $t->addVisitor(new class() implements VisitorInterface |
|
96 | + { |
|
92 | 97 | public function enterNode(mixed $node, VisitorContext $ctx): mixed |
93 | 98 | { |
94 | 99 | return null; |
@@ -96,7 +101,8 @@ discard block |
||
96 | 101 | |
97 | 102 | public function leaveNode(mixed $node, VisitorContext $ctx): mixed |
98 | 103 | { |
99 | - if ($node instanceof Tag && $node->name === 'b') { |
|
104 | + if ($node instanceof Tag && $node->name === 'b') |
|
105 | + { |
|
100 | 106 | return VisitorInterface::REMOVE_NODE; |
101 | 107 | } |
102 | 108 | |
@@ -123,7 +129,8 @@ discard block |
||
123 | 129 | |
124 | 130 | public function enterNode(mixed $node, VisitorContext $ctx): mixed |
125 | 131 | { |
126 | - if ($ctx->getCurrentNode() instanceof Raw) { |
|
132 | + if ($ctx->getCurrentNode() instanceof Raw) |
|
133 | + { |
|
127 | 134 | self::assertInstanceOf(Tag::class, $ctx->getParentNode()); |
128 | 135 | self::assertSame('b', $ctx->getParentNode()->name); |
129 | 136 |