@@ -26,7 +26,7 @@ |
||
26 | 26 | |
27 | 27 | protected function mapDirectories(array $directories): array |
28 | 28 | { |
29 | - $dir = \dirname(__DIR__) . '/Fixtures'; |
|
29 | + $dir = \dirname(__DIR__).'/Fixtures'; |
|
30 | 30 | |
31 | 31 | return $directories + ['config' => $dir, 'app' => $dir, 'resources' => $dir, 'runtime' => $dir]; |
32 | 32 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | |
27 | 27 | protected function mapDirectories(array $directories): array |
28 | 28 | { |
29 | - $dir = \dirname(__DIR__) . '/Fixtures'; |
|
29 | + $dir = \dirname(__DIR__).'/Fixtures'; |
|
30 | 30 | |
31 | 31 | return $directories + ['config' => $dir, 'app' => $dir, 'resources' => $dir, 'runtime' => $dir]; |
32 | 32 | } |
@@ -11,6 +11,6 @@ |
||
11 | 11 | { |
12 | 12 | public function init(TokenizerBootloader $tokenizer): void |
13 | 13 | { |
14 | - $tokenizer->addDirectory(\dirname(__DIR__, 2) . '/Fixtures/Bootloader'); |
|
14 | + $tokenizer->addDirectory(\dirname(__DIR__, 2).'/Fixtures/Bootloader'); |
|
15 | 15 | } |
16 | 16 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $env = m::mock(EnvironmentInterface::class); |
61 | 61 | $env->shouldReceive('get')->with('TOKENIZER_CACHE_TARGETS', false)->andReturnFalse(); |
62 | 62 | $config = new TokenizerConfig([ |
63 | - 'cache' => ['directory' => 'cache',], |
|
63 | + 'cache' => ['directory' => 'cache', ], |
|
64 | 64 | ]); |
65 | 65 | |
66 | 66 | $this->assertSame( |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $env = m::mock(EnvironmentInterface::class); |
109 | 109 | $env->shouldReceive('get')->with('TOKENIZER_CACHE_TARGETS', false)->andReturnTrue(); |
110 | 110 | |
111 | - $config = new TokenizerConfig(['cache' => ['directory' => 'cache',]]); |
|
111 | + $config = new TokenizerConfig(['cache' => ['directory' => 'cache', ]]); |
|
112 | 112 | |
113 | 113 | $this->assertSame( |
114 | 114 | $loader, |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $kernel->run(); |
277 | 277 | |
278 | 278 | $this->assertTrue(\in_array( |
279 | - \dirname(__DIR__) . '/Fixtures/Bootloader', |
|
279 | + \dirname(__DIR__).'/Fixtures/Bootloader', |
|
280 | 280 | $container->get(TokenizerConfig::class)->getDirectories() |
281 | 281 | )); |
282 | 282 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | // but not read from there. |
112 | 112 | return $factory->make($classLoader, [ |
113 | 113 | 'memory' => $factory->make(Memory::class, [ |
114 | - 'directory' => $config->getCacheDirectory() ?? $dirs->get('runtime') . 'cache/listeners', |
|
114 | + 'directory' => $config->getCacheDirectory() ?? $dirs->get('runtime').'cache/listeners', |
|
115 | 115 | ]), |
116 | 116 | 'readCache' => \filter_var( |
117 | 117 | $env->get('TOKENIZER_CACHE_TARGETS', $config->isCacheEnabled()), |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | ClassesLoaderInterface $loader, |
127 | 127 | ListenerInvoker $invoker, |
128 | 128 | ): void { |
129 | - if ($config->isLoadClassesEnabled()) { |
|
129 | + if ($config->isLoadClassesEnabled()){ |
|
130 | 130 | $this->loadReflections($invoker, $classes->getClasses(...), $loader->loadClasses(...)); |
131 | 131 | } |
132 | 132 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | EnumsLoaderInterface $loader, |
138 | 138 | ListenerInvoker $invoker, |
139 | 139 | ): void { |
140 | - if ($config->isLoadEnumsEnabled()) { |
|
140 | + if ($config->isLoadEnumsEnabled()){ |
|
141 | 141 | $this->loadReflections($invoker, $enums->getEnums(...), $loader->loadEnums(...)); |
142 | 142 | } |
143 | 143 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | InterfacesLoaderInterface $loader, |
149 | 149 | ListenerInvoker $invoker, |
150 | 150 | ): void { |
151 | - if ($config->isLoadInterfacesEnabled()) { |
|
151 | + if ($config->isLoadInterfacesEnabled()){ |
|
152 | 152 | $this->loadReflections($invoker, $interfaces->getInterfaces(...), $loader->loadInterfaces(...)); |
153 | 153 | } |
154 | 154 | } |
@@ -166,15 +166,15 @@ discard block |
||
166 | 166 | |
167 | 167 | // First, we check if the listener has been cached. If it has, we will load the classes/enums/interfaces |
168 | 168 | // from the cache. |
169 | - foreach ($listeners as $i => $listener) { |
|
170 | - if (call_user_func($loader, $listener)) { |
|
169 | + foreach ($listeners as $i => $listener){ |
|
170 | + if (call_user_func($loader, $listener)){ |
|
171 | 171 | unset($listeners[$i]); |
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
175 | 175 | // If there are no listeners left, we don't need to use static analysis at all and save |
176 | 176 | // valuable time. |
177 | - if ($listeners === []) { |
|
177 | + if ($listeners === []){ |
|
178 | 178 | return; |
179 | 179 | } |
180 | 180 | |
@@ -182,14 +182,14 @@ discard block |
||
182 | 182 | // Please note that this is a very expensive operation and should be avoided if possible. |
183 | 183 | // Use #[TargetClass] or #[TargetAttribute] attributes in your listeners to cache the classes/enums/interfaces. |
184 | 184 | $classes = call_user_func($reflections); |
185 | - foreach ($listeners as $listener) { |
|
185 | + foreach ($listeners as $listener){ |
|
186 | 186 | $invoker->invoke($listener, $classes); |
187 | 187 | } |
188 | 188 | } |
189 | 189 | |
190 | 190 | private function finalizeListeners(): void |
191 | 191 | { |
192 | - foreach ($this->listeners as $listener) { |
|
192 | + foreach ($this->listeners as $listener){ |
|
193 | 193 | $listener->finalize(); |
194 | 194 | } |
195 | 195 | // We don't need the listeners anymore, so we will clear them from memory. |
@@ -126,7 +126,8 @@ discard block |
||
126 | 126 | ClassesLoaderInterface $loader, |
127 | 127 | ListenerInvoker $invoker, |
128 | 128 | ): void { |
129 | - if ($config->isLoadClassesEnabled()) { |
|
129 | + if ($config->isLoadClassesEnabled()) |
|
130 | + { |
|
130 | 131 | $this->loadReflections($invoker, $classes->getClasses(...), $loader->loadClasses(...)); |
131 | 132 | } |
132 | 133 | } |
@@ -137,7 +138,8 @@ discard block |
||
137 | 138 | EnumsLoaderInterface $loader, |
138 | 139 | ListenerInvoker $invoker, |
139 | 140 | ): void { |
140 | - if ($config->isLoadEnumsEnabled()) { |
|
141 | + if ($config->isLoadEnumsEnabled()) |
|
142 | + { |
|
141 | 143 | $this->loadReflections($invoker, $enums->getEnums(...), $loader->loadEnums(...)); |
142 | 144 | } |
143 | 145 | } |
@@ -148,7 +150,8 @@ discard block |
||
148 | 150 | InterfacesLoaderInterface $loader, |
149 | 151 | ListenerInvoker $invoker, |
150 | 152 | ): void { |
151 | - if ($config->isLoadInterfacesEnabled()) { |
|
153 | + if ($config->isLoadInterfacesEnabled()) |
|
154 | + { |
|
152 | 155 | $this->loadReflections($invoker, $interfaces->getInterfaces(...), $loader->loadInterfaces(...)); |
153 | 156 | } |
154 | 157 | } |
@@ -166,15 +169,18 @@ discard block |
||
166 | 169 | |
167 | 170 | // First, we check if the listener has been cached. If it has, we will load the classes/enums/interfaces |
168 | 171 | // from the cache. |
169 | - foreach ($listeners as $i => $listener) { |
|
170 | - if (call_user_func($loader, $listener)) { |
|
172 | + foreach ($listeners as $i => $listener) |
|
173 | + { |
|
174 | + if (call_user_func($loader, $listener)) |
|
175 | + { |
|
171 | 176 | unset($listeners[$i]); |
172 | 177 | } |
173 | 178 | } |
174 | 179 | |
175 | 180 | // If there are no listeners left, we don't need to use static analysis at all and save |
176 | 181 | // valuable time. |
177 | - if ($listeners === []) { |
|
182 | + if ($listeners === []) |
|
183 | + { |
|
178 | 184 | return; |
179 | 185 | } |
180 | 186 | |
@@ -182,14 +188,16 @@ discard block |
||
182 | 188 | // Please note that this is a very expensive operation and should be avoided if possible. |
183 | 189 | // Use #[TargetClass] or #[TargetAttribute] attributes in your listeners to cache the classes/enums/interfaces. |
184 | 190 | $classes = call_user_func($reflections); |
185 | - foreach ($listeners as $listener) { |
|
191 | + foreach ($listeners as $listener) |
|
192 | + { |
|
186 | 193 | $invoker->invoke($listener, $classes); |
187 | 194 | } |
188 | 195 | } |
189 | 196 | |
190 | 197 | private function finalizeListeners(): void |
191 | 198 | { |
192 | - foreach ($this->listeners as $listener) { |
|
199 | + foreach ($this->listeners as $listener) |
|
200 | + { |
|
193 | 201 | $listener->finalize(); |
194 | 202 | } |
195 | 203 | // We don't need the listeners anymore, so we will clear them from memory. |