Completed
Push — master ( d1a5ed...e723cc )
by Andreas
04:00 queued 13s
created
lib/Doctrine/Common/Annotations/DocParser.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
                     'type'      =>'array',
181 181
                     'required'  =>true,
182 182
                     'array_type'=>Annotation\Attribute::class,
183
-                    'value'     =>'array<' . Annotation\Attribute::class . '>'
183
+                    'value'     =>'array<'.Annotation\Attribute::class.'>'
184 184
                 ]
185 185
              ],
186 186
         ],
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
      */
374 374
     private function match($token)
375 375
     {
376
-        if ( ! $this->lexer->isNextToken($token) ) {
376
+        if (!$this->lexer->isNextToken($token)) {
377 377
             $this->syntaxError($this->lexer->getLiteral($token));
378 378
         }
379 379
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
      */
393 393
     private function matchAny(array $tokens)
394 394
     {
395
-        if ( ! $this->lexer->isNextTokenAny($tokens)) {
395
+        if (!$this->lexer->isNextTokenAny($tokens)) {
396 396
             $this->syntaxError(implode(' or ', array_map([$this->lexer, 'getLiteral'], $tokens)));
397 397
         }
398 398
 
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
             : sprintf("'%s' at position %s", $token['value'], $token['position']);
422 422
 
423 423
         if (strlen($this->context)) {
424
-            $message .= ' in ' . $this->context;
424
+            $message .= ' in '.$this->context;
425 425
         }
426 426
 
427 427
         $message .= '.';
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
         if ($metadata['is_annotation']) {
500 500
             self::$metadataParser->setTarget(Target::TARGET_CLASS);
501 501
 
502
-            foreach (self::$metadataParser->parse($docComment, 'class @' . $name) as $annotation) {
502
+            foreach (self::$metadataParser->parse($docComment, 'class @'.$name) as $annotation) {
503 503
                 if ($annotation instanceof Target) {
504 504
                     $metadata['targets']         = $annotation->targets;
505 505
                     $metadata['targets_literal'] = $annotation->literal;
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 
529 529
                     $attribute->required = (false !== strpos($propertyComment, '@Required'));
530 530
                     $attribute->name     = $property->name;
531
-                    $attribute->type     = (false !== strpos($propertyComment, '@var') && preg_match('/@var\s+([^\s]+)/',$propertyComment, $matches))
531
+                    $attribute->type     = (false !== strpos($propertyComment, '@var') && preg_match('/@var\s+([^\s]+)/', $propertyComment, $matches))
532 532
                         ? $matches[1]
533 533
                         : 'mixed';
534 534
 
@@ -536,17 +536,17 @@  discard block
 block discarded – undo
536 536
 
537 537
                     // checks if the property has @Enum
538 538
                     if (false !== strpos($propertyComment, '@Enum')) {
539
-                        $context = 'property ' . $class->name . "::\$" . $property->name;
539
+                        $context = 'property '.$class->name."::\$".$property->name;
540 540
 
541 541
                         self::$metadataParser->setTarget(Target::TARGET_PROPERTY);
542 542
 
543 543
                         foreach (self::$metadataParser->parse($propertyComment, $context) as $annotation) {
544
-                            if ( ! $annotation instanceof Enum) {
544
+                            if (!$annotation instanceof Enum) {
545 545
                                 continue;
546 546
                             }
547 547
 
548 548
                             $metadata['enum'][$property->name]['value']   = $annotation->value;
549
-                            $metadata['enum'][$property->name]['literal'] = ( ! empty($annotation->literal))
549
+                            $metadata['enum'][$property->name]['literal'] = (!empty($annotation->literal))
550 550
                                 ? $annotation->literal
551 551
                                 : $annotation->value;
552 552
                         }
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 
682 682
         if ('\\' !== $name[0]) {
683 683
             $pos = strpos($name, '\\');
684
-            $alias = (false === $pos)? $name : substr($name, 0, $pos);
684
+            $alias = (false === $pos) ? $name : substr($name, 0, $pos);
685 685
             $found = false;
686 686
             $loweredAlias = strtolower($alias);
687 687
 
@@ -696,20 +696,20 @@  discard block
 block discarded – undo
696 696
             } elseif (isset($this->imports[$loweredAlias])) {
697 697
                 $namespace = ltrim($this->imports[$loweredAlias], '\\');
698 698
                 $name = (false !== $pos)
699
-                    ? $namespace . substr($name, $pos)
699
+                    ? $namespace.substr($name, $pos)
700 700
                     : $namespace;
701 701
                 $found = $this->classExists($name);
702
-            } elseif ( ! isset($this->ignoredAnnotationNames[$name])
702
+            } elseif (!isset($this->ignoredAnnotationNames[$name])
703 703
                 && isset($this->imports['__NAMESPACE__'])
704
-                && $this->classExists($this->imports['__NAMESPACE__'] . '\\' . $name)
704
+                && $this->classExists($this->imports['__NAMESPACE__'].'\\'.$name)
705 705
             ) {
706 706
                 $name  = $this->imports['__NAMESPACE__'].'\\'.$name;
707 707
                 $found = true;
708
-            } elseif (! isset($this->ignoredAnnotationNames[$name]) && $this->classExists($name)) {
708
+            } elseif (!isset($this->ignoredAnnotationNames[$name]) && $this->classExists($name)) {
709 709
                 $found = true;
710 710
             }
711 711
 
712
-            if ( ! $found) {
712
+            if (!$found) {
713 713
                 if ($this->isIgnoredAnnotation($name)) {
714 714
                     return false;
715 715
                 }
@@ -718,9 +718,9 @@  discard block
 block discarded – undo
718 718
             }
719 719
         }
720 720
 
721
-        $name = ltrim($name,'\\');
721
+        $name = ltrim($name, '\\');
722 722
 
723
-        if ( ! $this->classExists($name)) {
723
+        if (!$this->classExists($name)) {
724 724
             throw AnnotationException::semanticalError(sprintf('The annotation "@%s" in %s does not exist, or could not be auto-loaded.', $name, $this->context));
725 725
         }
726 726
 
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 
731 731
 
732 732
         // collects the metadata annotation only if there is not yet
733
-        if ( ! isset(self::$annotationMetadata[$name])) {
733
+        if (!isset(self::$annotationMetadata[$name])) {
734 734
             $this->collectAnnotationMetadata($name);
735 735
         }
736 736
 
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
             // checks all declared attributes
764 764
             foreach (self::$annotationMetadata[$name]['enum'] as $property => $enum) {
765 765
                 // checks if the attribute is a valid enumerator
766
-                if (isset($values[$property]) && ! in_array($values[$property], $enum['value'])) {
766
+                if (isset($values[$property]) && !in_array($values[$property], $enum['value'])) {
767 767
                     throw AnnotationException::enumeratorError($property, $name, $this->context, $enum['literal'], $values[$property]);
768 768
                 }
769 769
             }
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 
788 788
             if ($type['type'] === 'array') {
789 789
                 // handle the case of a single value
790
-                if ( ! is_array($values[$property])) {
790
+                if (!is_array($values[$property])) {
791 791
                     $values[$property] = [$values[$property]];
792 792
                 }
793 793
 
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
                 }
820 820
 
821 821
                 // handle the case if the property has no annotations
822
-                if ( ! $property = self::$annotationMetadata[$name]['default_property']) {
822
+                if (!$property = self::$annotationMetadata[$name]['default_property']) {
823 823
                     throw AnnotationException::creationError(sprintf('The annotation @%s declared on %s does not accept any values, but got %s.', $originalName, $this->context, json_encode($values)));
824 824
                 }
825 825
             }
@@ -839,13 +839,13 @@  discard block
 block discarded – undo
839 839
     {
840 840
         $values = [];
841 841
 
842
-        if ( ! $this->lexer->isNextToken(DocLexer::T_OPEN_PARENTHESIS)) {
842
+        if (!$this->lexer->isNextToken(DocLexer::T_OPEN_PARENTHESIS)) {
843 843
             return $values;
844 844
         }
845 845
 
846 846
         $this->match(DocLexer::T_OPEN_PARENTHESIS);
847 847
 
848
-        if ( ! $this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) {
848
+        if (!$this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) {
849 849
             $values = $this->Values();
850 850
         }
851 851
 
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
             $token = $this->lexer->lookahead;
874 874
             $value = $this->Value();
875 875
 
876
-            if ( ! is_object($value) && ! is_array($value)) {
876
+            if (!is_object($value) && !is_array($value)) {
877 877
                 $this->syntaxError('Value', $token);
878 878
             }
879 879
 
@@ -883,10 +883,10 @@  discard block
 block discarded – undo
883 883
         foreach ($values as $k => $value) {
884 884
             if (is_object($value) && $value instanceof \stdClass) {
885 885
                 $values[$value->name] = $value->value;
886
-            } else if ( ! isset($values['value'])){
886
+            } else if (!isset($values['value'])) {
887 887
                 $values['value'] = $value;
888 888
             } else {
889
-                if ( ! is_array($values['value'])) {
889
+                if (!is_array($values['value'])) {
890 890
                     $values['value'] = [$values['value']];
891 891
                 }
892 892
 
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
     {
911 911
         $identifier = $this->Identifier();
912 912
 
913
-        if ( ! defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) {
913
+        if (!defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) {
914 914
             list($className, $const) = explode('::', $identifier);
915 915
 
916 916
             $pos = strpos($className, '\\');
@@ -932,12 +932,12 @@  discard block
 block discarded – undo
932 932
                 case isset($this->imports[$loweredAlias]):
933 933
                     $found     = true;
934 934
                     $className = (false !== $pos)
935
-                        ? $this->imports[$loweredAlias] . substr($className, $pos)
935
+                        ? $this->imports[$loweredAlias].substr($className, $pos)
936 936
                         : $this->imports[$loweredAlias];
937 937
                     break;
938 938
 
939 939
                 default:
940
-                    if(isset($this->imports['__NAMESPACE__'])) {
940
+                    if (isset($this->imports['__NAMESPACE__'])) {
941 941
                         $ns = $this->imports['__NAMESPACE__'];
942 942
 
943 943
                         if (class_exists($ns.'\\'.$className) || interface_exists($ns.'\\'.$className)) {
@@ -949,14 +949,14 @@  discard block
 block discarded – undo
949 949
             }
950 950
 
951 951
             if ($found) {
952
-                 $identifier = $className . '::' . $const;
952
+                 $identifier = $className.'::'.$const;
953 953
             }
954 954
         }
955 955
 
956 956
         /**
957 957
          * Checks if identifier ends with ::class and remove the leading backslash if it exists.
958 958
          */
959
-        if ($this->identifierEndsWithClassConstant($identifier) && ! $this->identifierStartsWithBackslash($identifier)) {
959
+        if ($this->identifierEndsWithClassConstant($identifier) && !$this->identifierStartsWithBackslash($identifier)) {
960 960
             return substr($identifier, 0, $this->getClassConstantPositionInIdentifier($identifier));
961 961
         }
962 962
         if ($this->identifierEndsWithClassConstant($identifier) && $this->identifierStartsWithBackslash($identifier)) {
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
     private function Identifier()
997 997
     {
998 998
         // check if we have an annotation
999
-        if ( ! $this->lexer->isNextTokenAny(self::$classIdentifiers)) {
999
+        if (!$this->lexer->isNextTokenAny(self::$classIdentifiers)) {
1000 1000
             $this->syntaxError('namespace separator or identifier');
1001 1001
         }
1002 1002
 
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
             $this->match(DocLexer::T_NAMESPACE_SEPARATOR);
1013 1013
             $this->matchAny(self::$classIdentifiers);
1014 1014
 
1015
-            $className .= '\\' . $this->lexer->token['value'];
1015
+            $className .= '\\'.$this->lexer->token['value'];
1016 1016
         }
1017 1017
 
1018 1018
         return $className;
@@ -1060,11 +1060,11 @@  discard block
 block discarded – undo
1060 1060
 
1061 1061
             case DocLexer::T_INTEGER:
1062 1062
                 $this->match(DocLexer::T_INTEGER);
1063
-                return (int)$this->lexer->token['value'];
1063
+                return (int) $this->lexer->token['value'];
1064 1064
 
1065 1065
             case DocLexer::T_FLOAT:
1066 1066
                 $this->match(DocLexer::T_FLOAT);
1067
-                return (float)$this->lexer->token['value'];
1067
+                return (float) $this->lexer->token['value'];
1068 1068
 
1069 1069
             case DocLexer::T_TRUE:
1070 1070
                 $this->match(DocLexer::T_TRUE);
@@ -1192,9 +1192,9 @@  discard block
 block discarded – undo
1192 1192
         }
1193 1193
 
1194 1194
         foreach (array_keys($this->ignoredAnnotationNamespaces) as $ignoredAnnotationNamespace) {
1195
-            $ignoredAnnotationNamespace = rtrim($ignoredAnnotationNamespace, '\\') . '\\';
1195
+            $ignoredAnnotationNamespace = rtrim($ignoredAnnotationNamespace, '\\').'\\';
1196 1196
 
1197
-            if (0 === stripos(rtrim($name, '\\') . '\\', $ignoredAnnotationNamespace)) {
1197
+            if (0 === stripos(rtrim($name, '\\').'\\', $ignoredAnnotationNamespace)) {
1198 1198
                 return true;
1199 1199
             }
1200 1200
         }
Please login to merge, or discard this patch.
lib/Doctrine/Common/Annotations/AnnotationReader.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class));
142 142
         $this->parser->setIgnoredAnnotationNamespaces(self::$globalIgnoredNamespaces);
143 143
 
144
-        return $this->parser->parse($class->getDocComment(), 'class ' . $class->getName());
144
+        return $this->parser->parse($class->getDocComment(), 'class '.$class->getName());
145 145
     }
146 146
 
147 147
     /**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     public function getPropertyAnnotations(ReflectionProperty $property)
167 167
     {
168 168
         $class   = $property->getDeclaringClass();
169
-        $context = 'property ' . $class->getName() . "::\$" . $property->getName();
169
+        $context = 'property '.$class->getName()."::\$".$property->getName();
170 170
 
171 171
         $this->parser->setTarget(Target::TARGET_PROPERTY);
172 172
         $this->parser->setImports($this->getPropertyImports($property));
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
     public function getMethodAnnotations(ReflectionMethod $method)
199 199
     {
200 200
         $class   = $method->getDeclaringClass();
201
-        $context = 'method ' . $class->getName() . '::' . $method->getName() . '()';
201
+        $context = 'method '.$class->getName().'::'.$method->getName().'()';
202 202
 
203 203
         $this->parser->setTarget(Target::TARGET_METHOD);
204 204
         $this->parser->setImports($this->getMethodImports($method));
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
     private function collectParsingMetadata(ReflectionClass $class)
319 319
     {
320 320
         $ignoredAnnotationNames = self::$globalIgnoredNames;
321
-        $annotations            = $this->preParser->parse($class->getDocComment(), 'class ' . $class->name);
321
+        $annotations            = $this->preParser->parse($class->getDocComment(), 'class '.$class->name);
322 322
 
323 323
         foreach ($annotations as $annotation) {
324 324
             if ($annotation instanceof IgnoreAnnotation) {
Please login to merge, or discard this patch.