Test Failed
Pull Request — master (#947)
by
unknown
08:47 queued 01:08
created
src/Tokenizer/src/InterfacesInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,5 +21,5 @@
 block discarded – undo
21 21
      *                                  results.
22 22
      * @return array<class-string, ReflectionClass>
23 23
      */
24
-    public function getInterfaces(string|null $target = null): array;
24
+    public function getInterfaces(string | null $target = null): array;
25 25
 }
Please login to merge, or discard this patch.
src/Tokenizer/src/Listener/CachedInterfacesLoader.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
         private readonly InterfaceLocatorByTarget $locator,
18 18
         private readonly ListenerInvoker $invoker,
19 19
         private readonly bool $readCache = true,
20
-    ) {
20
+    ){
21 21
     }
22 22
 
23 23
     public function loadInterfaces(TokenizationListenerInterface $listener): bool
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         $targets = \iterator_to_array($this->parseAttributes($listener));
26 26
 
27 27
         // If there are no targets, then listener can't be cached.
28
-        if ($targets === []) {
28
+        if ($targets === []){
29 29
             return false;
30 30
         }
31 31
 
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
         // We decided to load classes for each target separately.
35 35
         // It allows us to cache classes for each target separately and if we reuse the
36 36
         // same target in multiple listeners, we will not have to load classes for the same target.
37
-        foreach ($targets as $target) {
38
-            $cacheKey = 'interfaces-' . $target;
37
+        foreach ($targets as $target){
38
+            $cacheKey = 'interfaces-'.$target;
39 39
 
40 40
             $interfaces = $this->readCache ? $this->memory->loadData($cacheKey) : null;
41
-            if ($interfaces === null) {
41
+            if ($interfaces === null){
42 42
                 $this->memory->saveData(
43 43
                     $cacheKey,
44 44
                     $interfaces = $this->locator->getInterfaces($target),
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,8 @@  discard block
 block discarded – undo
25 25
         $targets = \iterator_to_array($this->parseAttributes($listener));
26 26
 
27 27
         // If there are no targets, then listener can't be cached.
28
-        if ($targets === []) {
28
+        if ($targets === [])
29
+        {
29 30
             return false;
30 31
         }
31 32
 
@@ -34,11 +35,13 @@  discard block
 block discarded – undo
34 35
         // We decided to load classes for each target separately.
35 36
         // It allows us to cache classes for each target separately and if we reuse the
36 37
         // same target in multiple listeners, we will not have to load classes for the same target.
37
-        foreach ($targets as $target) {
38
+        foreach ($targets as $target)
39
+        {
38 40
             $cacheKey = 'interfaces-' . $target;
39 41
 
40 42
             $interfaces = $this->readCache ? $this->memory->loadData($cacheKey) : null;
41
-            if ($interfaces === null) {
43
+            if ($interfaces === null)
44
+            {
42 45
                 $this->memory->saveData(
43 46
                     $cacheKey,
44 47
                     $interfaces = $this->locator->getInterfaces($target),
Please login to merge, or discard this patch.
src/Tokenizer/src/Listener/InterfaceLocatorByTarget.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
     public function __construct(
19 19
         private readonly InterfacesInterface $interfaces,
20 20
         private readonly ScopedInterfacesInterface $scopedInterfaces,
21
-    ) {
21
+    ){
22 22
     }
23 23
 
24 24
     /**
Please login to merge, or discard this patch.
src/Tokenizer/src/InterfaceLocator.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -13,18 +13,18 @@  discard block
 block discarded – undo
13 13
 {
14 14
     public const INJECTOR = InterfaceLocatorInjector::class;
15 15
 
16
-    public function getInterfaces(string|null $target = null): array
16
+    public function getInterfaces(string | null $target = null): array
17 17
     {
18
-        if (! empty($target)) {
18
+        if (!empty($target)){
19 19
             $target = new \ReflectionClass($target);
20 20
         }
21 21
 
22 22
         $result = [];
23
-        foreach ($this->availableInterfaces() as $interface) {
24
-            try {
23
+        foreach ($this->availableInterfaces() as $interface){
24
+            try{
25 25
                 $reflection = $this->classReflection($interface);
26
-            } catch (LocatorException $e) {
27
-                if ($this->debug) {
26
+            }catch (LocatorException $e){
27
+                if ($this->debug){
28 28
                     throw $e;
29 29
                 }
30 30
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
                 continue;
33 33
             }
34 34
 
35
-            if (! $this->isTargeted($reflection, $target)) {
35
+            if (!$this->isTargeted($reflection, $target)){
36 36
                 continue;
37 37
             }
38 38
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     {
52 52
         $interfaces = [];
53 53
 
54
-        foreach ($this->availableReflections() as $reflection) {
54
+        foreach ($this->availableReflections() as $reflection){
55 55
             $interfaces = \array_merge($interfaces, $reflection->getInterfaces());
56 56
         }
57 57
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     protected function isTargeted(\ReflectionClass $class, \ReflectionClass $target = null): bool
67 67
     {
68
-        if (empty($target)) {
68
+        if (empty($target)){
69 69
             return true;
70 70
         }
71 71
 
Please login to merge, or discard this patch.
Braces   +17 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,16 +15,22 @@  discard block
 block discarded – undo
15 15
 
16 16
     public function getInterfaces(string|null $target = null): array
17 17
     {
18
-        if (! empty($target)) {
18
+        if (! empty($target))
19
+        {
19 20
             $target = new \ReflectionClass($target);
20 21
         }
21 22
 
22 23
         $result = [];
23
-        foreach ($this->availableInterfaces() as $interface) {
24
-            try {
24
+        foreach ($this->availableInterfaces() as $interface)
25
+        {
26
+            try
27
+            {
25 28
                 $reflection = $this->classReflection($interface);
26
-            } catch (LocatorException $e) {
27
-                if ($this->debug) {
29
+            }
30
+            catch (LocatorException $e)
31
+            {
32
+                if ($this->debug)
33
+                {
28 34
                     throw $e;
29 35
                 }
30 36
 
@@ -32,7 +38,8 @@  discard block
 block discarded – undo
32 38
                 continue;
33 39
             }
34 40
 
35
-            if (! $this->isTargeted($reflection, $target)) {
41
+            if (! $this->isTargeted($reflection, $target))
42
+            {
36 43
                 continue;
37 44
             }
38 45
 
@@ -51,7 +58,8 @@  discard block
 block discarded – undo
51 58
     {
52 59
         $interfaces = [];
53 60
 
54
-        foreach ($this->availableReflections() as $reflection) {
61
+        foreach ($this->availableReflections() as $reflection)
62
+        {
55 63
             $interfaces = \array_merge($interfaces, $reflection->getInterfaces());
56 64
         }
57 65
 
@@ -65,7 +73,8 @@  discard block
 block discarded – undo
65 73
      */
66 74
     protected function isTargeted(\ReflectionClass $class, \ReflectionClass $target = null): bool
67 75
     {
68
-        if (empty($target)) {
76
+        if (empty($target))
77
+        {
69 78
             return true;
70 79
         }
71 80
 
Please login to merge, or discard this patch.
src/Tokenizer/src/ScopedInterfacesInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,5 +17,5 @@
 block discarded – undo
17 17
      *                            results.
18 18
      * @return \ReflectionClass[]
19 19
      */
20
-    public function getScopedInterfaces(string $scope, string|null $target = null): array;
20
+    public function getScopedInterfaces(string $scope, string | null $target = null): array;
21 21
 }
Please login to merge, or discard this patch.
src/Tokenizer/src/ScopedInterfaceLocator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@
 block discarded – undo
8 8
 {
9 9
     public function __construct(
10 10
         private readonly Tokenizer $tokenizer
11
-    ) {
11
+    ){
12 12
     }
13 13
 
14
-    public function getScopedInterfaces(string $scope, string|null $target = null): array
14
+    public function getScopedInterfaces(string $scope, string | null $target = null): array
15 15
     {
16 16
         return $this->tokenizer->scopedInterfaceLocator($scope)->getInterfaces($target);
17 17
     }
Please login to merge, or discard this patch.
src/Tokenizer/src/Bootloader/TokenizerListenerBootloader.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -59,15 +59,15 @@  discard block
 block discarded – undo
59 59
 
60 60
     public function boot(AbstractKernel $kernel, TokenizerConfig $config): void
61 61
     {
62
-        if ($config->isLoadClassesEnabled()) {
62
+        if ($config->isLoadClassesEnabled()){
63 63
             $kernel->booted($this->loadClasses(...));
64 64
         }
65 65
 
66
-        if ($config->isLoadEnumsEnabled()) {
66
+        if ($config->isLoadEnumsEnabled()){
67 67
             $kernel->booted($this->loadEnums(...));
68 68
         }
69 69
 
70
-        if ($config->isLoadInterfacesEnabled()) {
70
+        if ($config->isLoadInterfacesEnabled()){
71 71
             $kernel->booted($this->loadInterfaces(...));
72 72
         }
73 73
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         // In this case the classes will be stored in a cache on every bootstrap, but not read from there.
86 86
         return $factory->make(CachedClassesLoader::class, [
87 87
             'memory' => $factory->make(Memory::class, [
88
-                'directory' => $config->getCacheDirectory() ?? $dirs->get('runtime') . 'cache/listeners',
88
+                'directory' => $config->getCacheDirectory() ?? $dirs->get('runtime').'cache/listeners',
89 89
             ]),
90 90
             'readCache' => \filter_var(
91 91
                 $env->get('TOKENIZER_CACHE_TARGETS', $config->isCacheEnabled()),
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         // In this case the enums will be stored in a cache on every bootstrap, but not read from there.
106 106
         return $factory->make(CachedEnumsLoader::class, [
107 107
             'memory' => $factory->make(Memory::class, [
108
-                'directory' => $config->getCacheDirectory() ?? $dirs->get('runtime') . 'cache/listeners',
108
+                'directory' => $config->getCacheDirectory() ?? $dirs->get('runtime').'cache/listeners',
109 109
             ]),
110 110
             'readCache' => \filter_var(
111 111
                 $env->get('TOKENIZER_CACHE_TARGETS', $config->isCacheEnabled()),
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         // In this case the interfaces will be stored in a cache on every bootstrap, but not read from there.
126 126
         return $factory->make(CachedInterfacesLoader::class, [
127 127
             'memory' => $factory->make(Memory::class, [
128
-                'directory' => $config->getCacheDirectory() ?? $dirs->get('runtime') . 'cache/listeners',
128
+                'directory' => $config->getCacheDirectory() ?? $dirs->get('runtime').'cache/listeners',
129 129
             ]),
130 130
             'readCache' => \filter_var(
131 131
                 $env->get('TOKENIZER_CACHE_TARGETS', $config->isCacheEnabled()),
@@ -143,15 +143,15 @@  discard block
 block discarded – undo
143 143
 
144 144
         // First, we check if the listener has been cached. If it has, we will load the classes
145 145
         // from the cache.
146
-        foreach ($listeners as $i => $listener) {
147
-            if ($loader->loadClasses($listener)) {
146
+        foreach ($listeners as $i => $listener){
147
+            if ($loader->loadClasses($listener)){
148 148
                 unset($listeners[$i]);
149 149
             }
150 150
         }
151 151
 
152 152
         // If there are no listeners left, we don't need to use static analysis at all and save
153 153
         // valuable time.
154
-        if ($listeners === []) {
154
+        if ($listeners === []){
155 155
             return;
156 156
         }
157 157
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         // Please note that this is a very expensive operation and should be avoided if possible.
160 160
         // Use #[TargetClass] or #[TargetAttribute] attributes in your listeners to cache the classes.
161 161
         $classes = $classes->getClasses();
162
-        foreach ($listeners as $listener) {
162
+        foreach ($listeners as $listener){
163 163
             $invoker->invoke($listener, $classes);
164 164
         }
165 165
     }
@@ -173,15 +173,15 @@  discard block
 block discarded – undo
173 173
 
174 174
         // First, we check if the listener has been cached. If it has, we will load the enums
175 175
         // from the cache.
176
-        foreach ($listeners as $i => $listener) {
177
-            if ($loader->loadEnums($listener)) {
176
+        foreach ($listeners as $i => $listener){
177
+            if ($loader->loadEnums($listener)){
178 178
                 unset($listeners[$i]);
179 179
             }
180 180
         }
181 181
 
182 182
         // If there are no listeners left, we don't need to use static analysis at all and save
183 183
         // valuable time.
184
-        if ($listeners === []) {
184
+        if ($listeners === []){
185 185
             return;
186 186
         }
187 187
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         // Please note that this is a very expensive operation and should be avoided if possible.
190 190
         // Use #[TargetClass] or #[TargetAttribute] attributes in your listeners to cache the enums.
191 191
         $enums = $enums->getEnums();
192
-        foreach ($listeners as $listener) {
192
+        foreach ($listeners as $listener){
193 193
             $invoker->invoke($listener, $enums);
194 194
         }
195 195
     }
@@ -203,15 +203,15 @@  discard block
 block discarded – undo
203 203
 
204 204
         // First, we check if the listener has been cached. If it has, we will load the interfaces
205 205
         // from the cache.
206
-        foreach ($listeners as $i => $listener) {
207
-            if ($loader->loadInterfaces($listener)) {
206
+        foreach ($listeners as $i => $listener){
207
+            if ($loader->loadInterfaces($listener)){
208 208
                 unset($listeners[$i]);
209 209
             }
210 210
         }
211 211
 
212 212
         // If there are no listeners left, we don't need to use static analysis at all and save
213 213
         // valuable time.
214
-        if ($listeners === []) {
214
+        if ($listeners === []){
215 215
             return;
216 216
         }
217 217
 
@@ -219,14 +219,14 @@  discard block
 block discarded – undo
219 219
         // Please note that this is a very expensive operation and should be avoided if possible.
220 220
         // Use #[TargetClass] or #[TargetAttribute] attributes in your listeners to cache the interfaces.
221 221
         $interfaces = $interfaces->getInterfaces();
222
-        foreach ($listeners as $listener) {
222
+        foreach ($listeners as $listener){
223 223
             $invoker->invoke($listener, $interfaces);
224 224
         }
225 225
     }
226 226
 
227 227
     private function finalizeListeners(): void
228 228
     {
229
-        foreach ($this->listeners as $listener) {
229
+        foreach ($this->listeners as $listener){
230 230
             $listener->finalize();
231 231
         }
232 232
         // We don't need the listeners anymore, so we will clear them from memory.
Please login to merge, or discard this patch.
Braces   +32 added lines, -16 removed lines patch added patch discarded remove patch
@@ -59,15 +59,18 @@  discard block
 block discarded – undo
59 59
 
60 60
     public function boot(AbstractKernel $kernel, TokenizerConfig $config): void
61 61
     {
62
-        if ($config->isLoadClassesEnabled()) {
62
+        if ($config->isLoadClassesEnabled())
63
+        {
63 64
             $kernel->booted($this->loadClasses(...));
64 65
         }
65 66
 
66
-        if ($config->isLoadEnumsEnabled()) {
67
+        if ($config->isLoadEnumsEnabled())
68
+        {
67 69
             $kernel->booted($this->loadEnums(...));
68 70
         }
69 71
 
70
-        if ($config->isLoadInterfacesEnabled()) {
72
+        if ($config->isLoadInterfacesEnabled())
73
+        {
71 74
             $kernel->booted($this->loadInterfaces(...));
72 75
         }
73 76
 
@@ -143,15 +146,18 @@  discard block
 block discarded – undo
143 146
 
144 147
         // First, we check if the listener has been cached. If it has, we will load the classes
145 148
         // from the cache.
146
-        foreach ($listeners as $i => $listener) {
147
-            if ($loader->loadClasses($listener)) {
149
+        foreach ($listeners as $i => $listener)
150
+        {
151
+            if ($loader->loadClasses($listener))
152
+            {
148 153
                 unset($listeners[$i]);
149 154
             }
150 155
         }
151 156
 
152 157
         // If there are no listeners left, we don't need to use static analysis at all and save
153 158
         // valuable time.
154
-        if ($listeners === []) {
159
+        if ($listeners === [])
160
+        {
155 161
             return;
156 162
         }
157 163
 
@@ -159,7 +165,8 @@  discard block
 block discarded – undo
159 165
         // Please note that this is a very expensive operation and should be avoided if possible.
160 166
         // Use #[TargetClass] or #[TargetAttribute] attributes in your listeners to cache the classes.
161 167
         $classes = $classes->getClasses();
162
-        foreach ($listeners as $listener) {
168
+        foreach ($listeners as $listener)
169
+        {
163 170
             $invoker->invoke($listener, $classes);
164 171
         }
165 172
     }
@@ -173,15 +180,18 @@  discard block
 block discarded – undo
173 180
 
174 181
         // First, we check if the listener has been cached. If it has, we will load the enums
175 182
         // from the cache.
176
-        foreach ($listeners as $i => $listener) {
177
-            if ($loader->loadEnums($listener)) {
183
+        foreach ($listeners as $i => $listener)
184
+        {
185
+            if ($loader->loadEnums($listener))
186
+            {
178 187
                 unset($listeners[$i]);
179 188
             }
180 189
         }
181 190
 
182 191
         // If there are no listeners left, we don't need to use static analysis at all and save
183 192
         // valuable time.
184
-        if ($listeners === []) {
193
+        if ($listeners === [])
194
+        {
185 195
             return;
186 196
         }
187 197
 
@@ -189,7 +199,8 @@  discard block
 block discarded – undo
189 199
         // Please note that this is a very expensive operation and should be avoided if possible.
190 200
         // Use #[TargetClass] or #[TargetAttribute] attributes in your listeners to cache the enums.
191 201
         $enums = $enums->getEnums();
192
-        foreach ($listeners as $listener) {
202
+        foreach ($listeners as $listener)
203
+        {
193 204
             $invoker->invoke($listener, $enums);
194 205
         }
195 206
     }
@@ -203,15 +214,18 @@  discard block
 block discarded – undo
203 214
 
204 215
         // First, we check if the listener has been cached. If it has, we will load the interfaces
205 216
         // from the cache.
206
-        foreach ($listeners as $i => $listener) {
207
-            if ($loader->loadInterfaces($listener)) {
217
+        foreach ($listeners as $i => $listener)
218
+        {
219
+            if ($loader->loadInterfaces($listener))
220
+            {
208 221
                 unset($listeners[$i]);
209 222
             }
210 223
         }
211 224
 
212 225
         // If there are no listeners left, we don't need to use static analysis at all and save
213 226
         // valuable time.
214
-        if ($listeners === []) {
227
+        if ($listeners === [])
228
+        {
215 229
             return;
216 230
         }
217 231
 
@@ -219,14 +233,16 @@  discard block
 block discarded – undo
219 233
         // Please note that this is a very expensive operation and should be avoided if possible.
220 234
         // Use #[TargetClass] or #[TargetAttribute] attributes in your listeners to cache the interfaces.
221 235
         $interfaces = $interfaces->getInterfaces();
222
-        foreach ($listeners as $listener) {
236
+        foreach ($listeners as $listener)
237
+        {
223 238
             $invoker->invoke($listener, $interfaces);
224 239
         }
225 240
     }
226 241
 
227 242
     private function finalizeListeners(): void
228 243
     {
229
-        foreach ($this->listeners as $listener) {
244
+        foreach ($this->listeners as $listener)
245
+        {
230 246
             $listener->finalize();
231 247
         }
232 248
         // We don't need the listeners anymore, so we will clear them from memory.
Please login to merge, or discard this patch.
src/Tokenizer/src/InterfaceLocatorInjector.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 {
17 17
     public function __construct(
18 18
         private readonly Tokenizer $tokenizer
19
-    ) {
19
+    ){
20 20
     }
21 21
 
22 22
     /**
Please login to merge, or discard this patch.