Passed
Push — master ( 893d1e...31005e )
by Kirill
03:35
created
src/Tokenizer/src/ClassLocator.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,20 +23,20 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function getClasses($target = null): array
25 25
     {
26
-        if (!empty($target) && (is_object($target) || is_string($target))) {
26
+        if (!empty($target) && (is_object($target) || is_string($target))){
27 27
             $target = new \ReflectionClass($target);
28 28
         }
29 29
 
30 30
         $result = [];
31
-        foreach ($this->availableClasses() as $class) {
32
-            try {
31
+        foreach ($this->availableClasses() as $class){
32
+            try{
33 33
                 $reflection = $this->classReflection($class);
34
-            } catch (LocatorException $e) {
34
+            }catch (LocatorException $e){
35 35
                 //Ignoring
36 36
                 continue;
37 37
             }
38 38
 
39
-            if (!$this->isTargeted($reflection, $target) || $reflection->isInterface()) {
39
+            if (!$this->isTargeted($reflection, $target) || $reflection->isInterface()){
40 40
                 continue;
41 41
             }
42 42
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     {
56 56
         $classes = [];
57 57
 
58
-        foreach ($this->availableReflections() as $reflection) {
58
+        foreach ($this->availableReflections() as $reflection){
59 59
             $classes = array_merge($classes, $reflection->getClasses());
60 60
         }
61 61
 
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
      */
72 72
     protected function isTargeted(\ReflectionClass $class, \ReflectionClass $target = null): bool
73 73
     {
74
-        if (empty($target)) {
74
+        if (empty($target)){
75 75
             return true;
76 76
         }
77 77
 
78
-        if (!$target->isTrait()) {
78
+        if (!$target->isTrait()){
79 79
             //Target is interface or class
80 80
             return $class->isSubclassOf($target) || $class->getName() == $target->getName();
81 81
         }
Please login to merge, or discard this patch.
src/Tokenizer/src/Tokenizer.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function createInjection(\ReflectionClass $class, string $context = null)
79 79
     {
80
-        if ($class->isSubclassOf(ClassesInterface::class)) {
80
+        if ($class->isSubclassOf(ClassesInterface::class)){
81 81
             return $this->classLocator();
82
-        } elseif ($class->isSubclassOf(InvocationsInterface::class)) {
82
+        } elseif ($class->isSubclassOf(InvocationsInterface::class)){
83 83
             return $this->invocationLocator();
84 84
         }
85 85
 
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
         $tokens = token_get_all(file_get_contents($filename));
98 98
 
99 99
         $line = 0;
100
-        foreach ($tokens as &$token) {
101
-            if (isset($token[self::LINE])) {
100
+        foreach ($tokens as &$token){
101
+            if (isset($token[self::LINE])){
102 102
                 $line = $token[self::LINE];
103 103
             }
104 104
 
105
-            if (!is_array($token)) {
105
+            if (!is_array($token)){
106 106
                 $token = [$token, $token, $line];
107 107
             }
108 108
 
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
     {
123 123
         $finder = new Finder();
124 124
 
125
-        if (empty($directories)) {
125
+        if (empty($directories)){
126 126
             $directories = $this->config->getDirectories();
127 127
         }
128 128
 
129
-        if (empty($exclude)) {
129
+        if (empty($exclude)){
130 130
             $exclude = $this->config->getExcludes();
131 131
         }
132 132
 
Please login to merge, or discard this patch.
src/Tokenizer/src/AbstractLocator.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
         /**
51 51
          * @var SplFileInfo
52 52
          */
53
-        foreach ($this->finder->getIterator() as $file) {
53
+        foreach ($this->finder->getIterator() as $file){
54 54
             $reflection = new ReflectionFile((string)$file);
55 55
 
56
-            if ($reflection->hasIncludes()) {
56
+            if ($reflection->hasIncludes()){
57 57
                 //We are not analyzing files which has includes, it's not safe to require such reflections
58 58
                 $this->getLogger()->warning(
59 59
                     sprintf("File `%s` has includes and excluded from analysis", $file),
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
      */
81 81
     protected function classReflection(string $class): \ReflectionClass
82 82
     {
83
-        $loader = function ($class) {
84
-            if ($class == LocatorException::class) {
83
+        $loader = function ($class){
84
+            if ($class == LocatorException::class){
85 85
                 return;
86 86
             }
87 87
 
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
         //To suspend class dependency exception
92 92
         spl_autoload_register($loader);
93 93
 
94
-        try {
94
+        try{
95 95
             //In some cases reflection can thrown an exception if class invalid or can not be loaded,
96 96
             //we are going to handle such exception and convert it soft exception
97 97
             return new \ReflectionClass($class);
98
-        } catch (\Throwable $e) {
99
-            if ($e instanceof LocatorException && $e->getPrevious() != null) {
98
+        }catch (\Throwable $e){
99
+            if ($e instanceof LocatorException && $e->getPrevious() != null){
100 100
                 $e = $e->getPrevious();
101 101
             }
102 102
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
             );
113 113
 
114 114
             throw new LocatorException($e->getMessage(), $e->getCode(), $e);
115
-        } finally {
115
+        }finally{
116 116
             spl_autoload_unregister($loader);
117 117
         }
118 118
     }
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
     {
129 129
         $traits = [];
130 130
 
131
-        while ($class) {
131
+        while ($class){
132 132
             $traits = array_merge(class_uses($class), $traits);
133 133
             $class = get_parent_class($class);
134 134
         }
135 135
 
136 136
         //Traits from traits
137
-        foreach (array_flip($traits) as $trait) {
137
+        foreach (array_flip($traits) as $trait){
138 138
             $traits = array_merge(class_uses($trait), $traits);
139 139
         }
140 140
 
Please login to merge, or discard this patch.
src/Tokenizer/src/InvocationLocator.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
     public function getInvocations(\ReflectionFunctionAbstract $function): array
29 29
     {
30 30
         $result = [];
31
-        foreach ($this->availableInvocations($function->getName()) as $invocation) {
32
-            if ($this->isTargeted($invocation, $function)) {
31
+        foreach ($this->availableInvocations($function->getName()) as $invocation){
32
+            if ($this->isTargeted($invocation, $function)){
33 33
                 $result[] = $invocation;
34 34
             }
35 35
         }
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
     protected function availableInvocations(string $signature = ''): \Generator
47 47
     {
48 48
         $signature = strtolower(trim($signature, '\\'));
49
-        foreach ($this->availableReflections() as $reflection) {
50
-            foreach ($reflection->getInvocations() as $invocation) {
49
+        foreach ($this->availableReflections() as $reflection){
50
+            foreach ($reflection->getInvocations() as $invocation){
51 51
                 if (
52 52
                     !empty($signature)
53 53
                     && strtolower(trim($invocation->getName(), '\\')) != $signature
54
-                ) {
54
+                ){
55 55
                     continue;
56 56
                 }
57 57
 
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
      */
69 69
     protected function isTargeted(ReflectionInvocation $invocation, \ReflectionFunctionAbstract $function): bool
70 70
     {
71
-        if ($function instanceof \ReflectionFunction) {
71
+        if ($function instanceof \ReflectionFunction){
72 72
             return !$invocation->isMethod();
73 73
         }
74 74
 
75
-        try {
75
+        try{
76 76
             $reflection = $this->classReflection($invocation->getClass());
77
-        } catch (LocatorException $e) {
77
+        }catch (LocatorException $e){
78 78
             return false;
79 79
         }
80 80
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
          */
84 84
         $target = $function->getDeclaringClass();
85 85
 
86
-        if ($target->isTrait()) {
86
+        if ($target->isTrait()){
87 87
             //Let's compare traits
88 88
             return in_array($target->getName(), $this->fetchTraits($invocation->getClass()));
89 89
         }
Please login to merge, or discard this patch.
src/Tokenizer/src/Reflection/ReflectionFile.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
      */
169 169
     public function getClasses(): array
170 170
     {
171
-        if (!isset($this->declarations['T_CLASS'])) {
171
+        if (!isset($this->declarations['T_CLASS'])){
172 172
             return [];
173 173
         }
174 174
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      */
183 183
     public function getTraits(): array
184 184
     {
185
-        if (!isset($this->declarations['T_TRAIT'])) {
185
+        if (!isset($this->declarations['T_TRAIT'])){
186 186
             return [];
187 187
         }
188 188
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
      */
197 197
     public function getInterfaces(): array
198 198
     {
199
-        if (!isset($this->declarations['T_INTERFACE'])) {
199
+        if (!isset($this->declarations['T_INTERFACE'])){
200 200
             return [];
201 201
         }
202 202
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
      */
232 232
     public function getInvocations(): array
233 233
     {
234
-        if (empty($this->invocations)) {
234
+        if (empty($this->invocations)){
235 235
             $this->locateInvocations($this->getTokens());
236 236
         }
237 237
 
@@ -263,12 +263,12 @@  discard block
 block discarded – undo
263 263
      */
264 264
     protected function locateDeclarations()
265 265
     {
266
-        foreach ($this->getTokens() as $tokenID => $token) {
267
-            if (!in_array($token[self::TOKEN_TYPE], self::$processTokens)) {
266
+        foreach ($this->getTokens() as $tokenID => $token){
267
+            if (!in_array($token[self::TOKEN_TYPE], self::$processTokens)){
268 268
                 continue;
269 269
             }
270 270
 
271
-            switch ($token[self::TOKEN_TYPE]) {
271
+            switch ($token[self::TOKEN_TYPE]){
272 272
                 case T_NAMESPACE:
273 273
                     $this->registerNamespace($tokenID);
274 274
                     break;
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
                 case T_CLASS:
285 285
                 case T_TRAIT:
286 286
                 case T_INTERFACE:
287
-                    if ($this->isClassNameConst($tokenID)) {
287
+                    if ($this->isClassNameConst($tokenID)){
288 288
                         //PHP5.5 ClassName::class constant
289 289
                         continue 2;
290 290
                     }
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
         }
302 302
 
303 303
         //Dropping empty namespace
304
-        if (isset($this->namespaces[''])) {
304
+        if (isset($this->namespaces[''])){
305 305
             $this->namespaces['\\'] = $this->namespaces[''];
306 306
             unset($this->namespaces['']);
307 307
         }
@@ -317,14 +317,14 @@  discard block
 block discarded – undo
317 317
         $namespace = '';
318 318
         $localID = $tokenID + 1;
319 319
 
320
-        do {
320
+        do{
321 321
             $token = $this->tokens[$localID++];
322
-            if ($token[self::TOKEN_CODE] == '{') {
322
+            if ($token[self::TOKEN_CODE] == '{'){
323 323
                 break;
324 324
             }
325 325
 
326 326
             $namespace .= $token[self::TOKEN_CODE];
327
-        } while (
327
+        }while (
328 328
             isset($this->tokens[$localID])
329 329
             && $this->tokens[$localID][self::TOKEN_CODE] != '{'
330 330
             && $this->tokens[$localID][self::TOKEN_CODE] != ';'
@@ -334,13 +334,13 @@  discard block
 block discarded – undo
334 334
         $namespace = trim($namespace);
335 335
 
336 336
         $uses = [];
337
-        if (isset($this->namespaces[$namespace])) {
337
+        if (isset($this->namespaces[$namespace])){
338 338
             $uses = $this->namespaces[$namespace];
339 339
         }
340 340
 
341
-        if ($this->tokens[$localID][self::TOKEN_CODE] == ';') {
341
+        if ($this->tokens[$localID][self::TOKEN_CODE] == ';'){
342 342
             $endingID = count($this->tokens) - 1;
343
-        } else {
343
+        }else{
344 344
             $endingID = $this->endingToken($tokenID);
345 345
         }
346 346
 
@@ -362,20 +362,20 @@  discard block
 block discarded – undo
362 362
 
363 363
         $class = '';
364 364
         $localAlias = null;
365
-        for ($localID = $tokenID + 1; $this->tokens[$localID][self::TOKEN_CODE] != ';'; ++$localID) {
366
-            if ($this->tokens[$localID][self::TOKEN_TYPE] == T_AS) {
365
+        for ($localID = $tokenID + 1; $this->tokens[$localID][self::TOKEN_CODE] != ';'; ++$localID){
366
+            if ($this->tokens[$localID][self::TOKEN_TYPE] == T_AS){
367 367
                 $localAlias = '';
368 368
                 continue;
369 369
             }
370 370
 
371
-            if ($localAlias === null) {
371
+            if ($localAlias === null){
372 372
                 $class .= $this->tokens[$localID][self::TOKEN_CODE];
373
-            } else {
373
+            }else{
374 374
                 $localAlias .= $this->tokens[$localID][self::TOKEN_CODE];
375 375
             }
376 376
         }
377 377
 
378
-        if (empty($localAlias)) {
378
+        if (empty($localAlias)){
379 379
             $names = explode('\\', $class);
380 380
             $localAlias = end($names);
381 381
         }
@@ -390,9 +390,9 @@  discard block
 block discarded – undo
390 390
      */
391 391
     private function registerFunction(int $tokenID)
392 392
     {
393
-        foreach ($this->declarations as $declarations) {
394
-            foreach ($declarations as $location) {
395
-                if ($tokenID >= $location[self::O_TOKEN] && $tokenID <= $location[self::C_TOKEN]) {
393
+        foreach ($this->declarations as $declarations){
394
+            foreach ($declarations as $location){
395
+                if ($tokenID >= $location[self::O_TOKEN] && $tokenID <= $location[self::C_TOKEN]){
396 396
                     //We are inside class, function is method
397 397
                     return;
398 398
                 }
@@ -400,14 +400,14 @@  discard block
 block discarded – undo
400 400
         }
401 401
 
402 402
         $localID = $tokenID + 1;
403
-        while ($this->tokens[$localID][self::TOKEN_TYPE] != T_STRING) {
403
+        while ($this->tokens[$localID][self::TOKEN_TYPE] != T_STRING){
404 404
             //Fetching function name
405 405
             ++$localID;
406 406
         }
407 407
 
408 408
         $name = $this->tokens[$localID][self::TOKEN_CODE];
409
-        if (!empty($namespace = $this->activeNamespace($tokenID))) {
410
-            $name = $namespace . self::NS_SEPARATOR . $name;
409
+        if (!empty($namespace = $this->activeNamespace($tokenID))){
410
+            $name = $namespace.self::NS_SEPARATOR.$name;
411 411
         }
412 412
 
413 413
         $this->functions[$name] = [
@@ -426,13 +426,13 @@  discard block
 block discarded – undo
426 426
     private function registerDeclaration(int $tokenID, int $tokenType)
427 427
     {
428 428
         $localID = $tokenID + 1;
429
-        while ($this->tokens[$localID][self::TOKEN_TYPE] != T_STRING) {
429
+        while ($this->tokens[$localID][self::TOKEN_TYPE] != T_STRING){
430 430
             ++$localID;
431 431
         }
432 432
 
433 433
         $name = $this->tokens[$localID][self::TOKEN_CODE];
434
-        if (!empty($namespace = $this->activeNamespace($tokenID))) {
435
-            $name = $namespace . self::NS_SEPARATOR . $name;
434
+        if (!empty($namespace = $this->activeNamespace($tokenID))){
435
+            $name = $namespace.self::NS_SEPARATOR.$name;
436 436
         }
437 437
 
438 438
         $this->declarations[token_name($tokenType)][$name] = [
@@ -480,24 +480,24 @@  discard block
 block discarded – undo
480 480
 
481 481
         //Tokens used to re-enable token detection
482 482
         $stopTokens = [T_STRING, T_WHITESPACE, T_DOUBLE_COLON, T_OBJECT_OPERATOR, T_NS_SEPARATOR];
483
-        foreach ($tokens as $tokenID => $token) {
483
+        foreach ($tokens as $tokenID => $token){
484 484
             $tokenType = $token[self::TOKEN_TYPE];
485 485
 
486 486
             //We are not indexing function declarations or functions called from $objects.
487
-            if (in_array($tokenType, [T_FUNCTION, T_OBJECT_OPERATOR, T_NEW])) {
487
+            if (in_array($tokenType, [T_FUNCTION, T_OBJECT_OPERATOR, T_NEW])){
488 488
                 if (
489 489
                     empty($argumentsTID)
490 490
                     && (
491 491
                         empty($invocationTID)
492 492
                         || $this->getSource($invocationTID, $tokenID - 1) != '$this'
493 493
                     )
494
-                ) {
494
+                ){
495 495
                     //Not a call, function declaration, or object method
496 496
                     $ignore = true;
497 497
                     continue;
498 498
                 }
499
-            } elseif ($ignore) {
500
-                if (!in_array($tokenType, $stopTokens)) {
499
+            } elseif ($ignore){
500
+                if (!in_array($tokenType, $stopTokens)){
501 501
                     //Returning to search
502 502
                     $ignore = false;
503 503
                 }
@@ -505,13 +505,13 @@  discard block
 block discarded – undo
505 505
             }
506 506
 
507 507
             //We are inside function, and there is "(", indexing arguments.
508
-            if (!empty($invocationTID) && ($tokenType == '(' || $tokenType == '[')) {
509
-                if (empty($argumentsTID)) {
508
+            if (!empty($invocationTID) && ($tokenType == '(' || $tokenType == '[')){
509
+                if (empty($argumentsTID)){
510 510
                     $argumentsTID = $tokenID;
511 511
                 }
512 512
 
513 513
                 ++$level;
514
-                if ($level != 1) {
514
+                if ($level != 1){
515 515
                     //Not arguments beginning, but arguments part
516 516
                     $arguments[$tokenID] = $token;
517 517
                 }
@@ -520,16 +520,16 @@  discard block
 block discarded – undo
520 520
             }
521 521
 
522 522
             //We are inside function arguments and ")" met.
523
-            if (!empty($invocationTID) && ($tokenType == ')' || $tokenType == ']')) {
523
+            if (!empty($invocationTID) && ($tokenType == ')' || $tokenType == ']')){
524 524
                 --$level;
525
-                if ($level == -1) {
525
+                if ($level == -1){
526 526
                     $invocationTID = false;
527 527
                     $level = 0;
528 528
                     continue;
529 529
                 }
530 530
 
531 531
                 //Function fully indexed, we can process it now.
532
-                if ($level == 0) {
532
+                if ($level == 0){
533 533
                     $this->registerInvocation(
534 534
                         $invocationTID,
535 535
                         $argumentsTID,
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
                     //Closing search
542 542
                     $arguments = [];
543 543
                     $argumentsTID = $invocationTID = false;
544
-                } else {
544
+                }else{
545 545
                     //Not arguments beginning, but arguments part
546 546
                     $arguments[$tokenID] = $token;
547 547
                 }
@@ -550,13 +550,13 @@  discard block
 block discarded – undo
550 550
             }
551 551
 
552 552
             //Still inside arguments.
553
-            if (!empty($invocationTID) && !empty($level)) {
553
+            if (!empty($invocationTID) && !empty($level)){
554 554
                 $arguments[$tokenID] = $token;
555 555
                 continue;
556 556
             }
557 557
 
558 558
             //Nothing valuable to remember, will be parsed later.
559
-            if (!empty($invocationTID) && in_array($tokenType, $stopTokens)) {
559
+            if (!empty($invocationTID) && in_array($tokenType, $stopTokens)){
560 560
                 continue;
561 561
             }
562 562
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
                 || $tokenType == T_STATIC
567 567
                 || $tokenType == T_NS_SEPARATOR
568 568
                 || ($tokenType == T_VARIABLE && $token[self::TOKEN_CODE] == '$this')
569
-            ) {
569
+            ){
570 570
                 $invocationTID = $tokenID;
571 571
                 $level = 0;
572 572
 
@@ -595,13 +595,13 @@  discard block
 block discarded – undo
595 595
         int $endID,
596 596
         array $arguments,
597 597
         int $invocationLevel
598
-    ) {
598
+    ){
599 599
         //Nested invocations
600 600
         $this->locateInvocations($arguments, $invocationLevel + 1);
601 601
 
602 602
         list($class, $operator, $name) = $this->fetchContext($invocationID, $argumentsID);
603 603
 
604
-        if (!empty($operator) && empty($class)) {
604
+        if (!empty($operator) && empty($class)){
605 605
             //Non detectable
606 606
             return;
607 607
         }
@@ -632,17 +632,17 @@  discard block
 block discarded – undo
632 632
         $name = trim($this->getSource($invocationTID, $argumentsTID), '( ');
633 633
 
634 634
         //Let's try to fetch all information we need
635
-        if (strpos($name, '->') !== false) {
635
+        if (strpos($name, '->') !== false){
636 636
             $operator = '->';
637
-        } elseif (strpos($name, '::') !== false) {
637
+        } elseif (strpos($name, '::') !== false){
638 638
             $operator = '::';
639 639
         }
640 640
 
641
-        if (!empty($operator)) {
641
+        if (!empty($operator)){
642 642
             list($class, $name) = explode($operator, $name);
643 643
 
644 644
             //We now have to clarify class name
645
-            if (in_array($class, ['self', 'static', '$this'])) {
645
+            if (in_array($class, ['self', 'static', '$this'])){
646 646
                 $class = $this->activeDeclaration($invocationTID);
647 647
             }
648 648
         }
@@ -659,9 +659,9 @@  discard block
 block discarded – undo
659 659
      */
660 660
     private function activeDeclaration(int $tokenID): string
661 661
     {
662
-        foreach ($this->declarations as $declarations) {
663
-            foreach ($declarations as $name => $position) {
664
-                if ($tokenID >= $position[self::O_TOKEN] && $tokenID <= $position[self::C_TOKEN]) {
662
+        foreach ($this->declarations as $declarations){
663
+            foreach ($declarations as $name => $position){
664
+                if ($tokenID >= $position[self::O_TOKEN] && $tokenID <= $position[self::C_TOKEN]){
665 665
                     return $name;
666 666
                 }
667 667
             }
@@ -680,8 +680,8 @@  discard block
 block discarded – undo
680 680
      */
681 681
     private function activeNamespace(int $tokenID): string
682 682
     {
683
-        foreach ($this->namespaces as $namespace => $position) {
684
-            if ($tokenID >= $position[self::O_TOKEN] && $tokenID <= $position[self::C_TOKEN]) {
683
+        foreach ($this->namespaces as $namespace => $position){
684
+            if ($tokenID >= $position[self::O_TOKEN] && $tokenID <= $position[self::C_TOKEN]){
685 685
                 return $namespace;
686 686
             }
687 687
         }
@@ -706,18 +706,18 @@  discard block
 block discarded – undo
706 706
     private function endingToken(int $tokenID): int
707 707
     {
708 708
         $level = null;
709
-        for ($localID = $tokenID; $localID < $this->countTokens; ++$localID) {
709
+        for ($localID = $tokenID; $localID < $this->countTokens; ++$localID){
710 710
             $token = $this->tokens[$localID];
711
-            if ($token[self::TOKEN_CODE] == '{') {
711
+            if ($token[self::TOKEN_CODE] == '{'){
712 712
                 ++$level;
713 713
                 continue;
714 714
             }
715 715
 
716
-            if ($token[self::TOKEN_CODE] == '}') {
716
+            if ($token[self::TOKEN_CODE] == '}'){
717 717
                 --$level;
718 718
             }
719 719
 
720
-            if ($level === 0) {
720
+            if ($level === 0){
721 721
                 break;
722 722
             }
723 723
         }
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
      */
735 735
     private function lineNumber(int $tokenID): int
736 736
     {
737
-        while (empty($this->tokens[$tokenID][self::TOKEN_LINE])) {
737
+        while (empty($this->tokens[$tokenID][self::TOKEN_LINE])){
738 738
             --$tokenID;
739 739
         }
740 740
 
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
     private function getSource(int $startID, int $endID): string
753 753
     {
754 754
         $result = '';
755
-        for ($tokenID = $startID; $tokenID <= $endID; ++$tokenID) {
755
+        for ($tokenID = $startID; $tokenID <= $endID; ++$tokenID){
756 756
             //Collecting function usage src
757 757
             $result .= $this->tokens[$tokenID][self::TOKEN_CODE];
758 758
         }
Please login to merge, or discard this patch.
src/Tokenizer/src/Reflection/ReflectionInvocation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         array $arguments,
70 70
         string $source,
71 71
         int $level
72
-    ) {
72
+    ){
73 73
         $this->filename = $filename;
74 74
         $this->line = $line;
75 75
         $this->class = $class;
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
      */
180 180
     public function getArgument(int $index): ReflectionArgument
181 181
     {
182
-        if (!isset($this->arguments[$index])) {
182
+        if (!isset($this->arguments[$index])){
183 183
             throw new ReflectionException("No such argument with index '{$index}'");
184 184
         }
185 185
 
Please login to merge, or discard this patch.
src/Tokenizer/src/Reflection/ReflectionArgument.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
     /**
22 22
      * Argument types.
23 23
      */
24
-    public const CONSTANT   = 'constant';   //Scalar constant and not variable.
25
-    public const VARIABLE   = 'variable';   //PHP variable
24
+    public const CONSTANT   = 'constant'; //Scalar constant and not variable.
25
+    public const VARIABLE   = 'variable'; //PHP variable
26 26
     public const EXPRESSION = 'expression'; //PHP code (expression).
27
-    public const STRING     = 'string';     //Simple scalar string, can be fetched using stringValue().
27
+    public const STRING     = 'string'; //Simple scalar string, can be fetched using stringValue().
28 28
 
29 29
     /** @var string */
30 30
     private $type;
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      */
70 70
     public function stringValue(): string
71 71
     {
72
-        if ($this->type != self::STRING) {
72
+        if ($this->type != self::STRING){
73 73
             throw new ReflectionException(
74 74
                 "Unable to represent value as string, value type is '{$this->type}'"
75 75
             );
@@ -91,19 +91,19 @@  discard block
 block discarded – undo
91 91
         $level = 0;
92 92
 
93 93
         $result = [];
94
-        foreach ($tokens as $token) {
95
-            if ($token[ReflectionFile::TOKEN_TYPE] == T_WHITESPACE) {
94
+        foreach ($tokens as $token){
95
+            if ($token[ReflectionFile::TOKEN_TYPE] == T_WHITESPACE){
96 96
                 continue;
97 97
             }
98 98
 
99
-            if (empty($definition)) {
99
+            if (empty($definition)){
100 100
                 $definition = ['type' => self::EXPRESSION, 'value' => '', 'tokens' => []];
101 101
             }
102 102
 
103 103
             if (
104 104
                 $token[ReflectionFile::TOKEN_TYPE] == '('
105 105
                 || $token[ReflectionFile::TOKEN_TYPE] == '['
106
-            ) {
106
+            ){
107 107
                 ++$level;
108 108
                 $definition['value'] .= $token[ReflectionFile::TOKEN_CODE];
109 109
                 continue;
@@ -112,18 +112,18 @@  discard block
 block discarded – undo
112 112
             if (
113 113
                 $token[ReflectionFile::TOKEN_TYPE] == ')'
114 114
                 || $token[ReflectionFile::TOKEN_TYPE] == ']'
115
-            ) {
115
+            ){
116 116
                 --$level;
117 117
                 $definition['value'] .= $token[ReflectionFile::TOKEN_CODE];
118 118
                 continue;
119 119
             }
120 120
 
121
-            if ($level) {
121
+            if ($level){
122 122
                 $definition['value'] .= $token[ReflectionFile::TOKEN_CODE];
123 123
                 continue;
124 124
             }
125 125
 
126
-            if ($token[ReflectionFile::TOKEN_TYPE] == ',') {
126
+            if ($token[ReflectionFile::TOKEN_TYPE] == ','){
127 127
                 $result[] = self::createArgument($definition);
128 128
                 $definition = null;
129 129
                 continue;
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
         }
135 135
 
136 136
         //Last argument
137
-        if (is_array($definition)) {
137
+        if (is_array($definition)){
138 138
             $definition = self::createArgument($definition);
139
-            if (!empty($definition->getType())) {
139
+            if (!empty($definition->getType())){
140 140
                 $result[] = $definition;
141 141
             }
142 142
         }
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
     {
156 156
         $result = new static(self::EXPRESSION, $definition['value']);
157 157
 
158
-        if (count($definition['tokens']) == 1) {
158
+        if (count($definition['tokens']) == 1){
159 159
             //If argument represent by one token we can try to resolve it's type more precisely
160
-            switch ($definition['tokens'][0][0]) {
160
+            switch ($definition['tokens'][0][0]){
161 161
                 case T_VARIABLE:
162 162
                     $result->type = self::VARIABLE;
163 163
                     break;
Please login to merge, or discard this patch.
src/Tokenizer/tests/InvocationsTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
     protected function someFunction()
20 20
     {
21 21
         $result = $this->sampleMethod('hello world');
22
-        print_r(self::sampleMethod($result . 'plus'));
22
+        print_r(self::sampleMethod($result.'plus'));
23 23
     }
24 24
 
25 25
     public function testInstance()
Please login to merge, or discard this patch.
src/Tokenizer/tests/ReflectionFileTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@
 block discarded – undo
22 22
         $this->assertContains(TestTrait::class, $reflection->getTraits());
23 23
         $this->assertContains(TestInterface::class, $reflection->getInterfaces());
24 24
 
25
-        $this->assertSame([__NAMESPACE__ . '\hello'], $reflection->getFunctions());
25
+        $this->assertSame([__NAMESPACE__.'\hello'], $reflection->getFunctions());
26 26
 
27 27
         $functionA = null;
28 28
         $functionB = null;
29 29
 
30
-        foreach ($reflection->getInvocations() as $invocation) {
31
-            if ($invocation->getName() == 'test_function_a') {
30
+        foreach ($reflection->getInvocations() as $invocation){
31
+            if ($invocation->getName() == 'test_function_a'){
32 32
                 $functionA = $invocation;
33 33
             }
34 34
 
35
-            if ($invocation->getName() == 'test_function_b') {
35
+            if ($invocation->getName() == 'test_function_b'){
36 36
                 $functionB = $invocation;
37 37
             }
38 38
         }
Please login to merge, or discard this patch.