Passed
Pull Request — master (#956)
by Maxim
08:33
created
src/Tokenizer/src/Bootloader/TokenizerListenerBootloader.php 1 patch
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -126,7 +126,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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.
Please login to merge, or discard this patch.