@@ -44,9 +44,6 @@ class PhpDocParser
44
44
/** @var bool */
45
45
private $ preserveTypeAliasesWithInvalidTypes ;
46
46
47
- /** @var bool */
48
- private $ parseDoctrineAnnotations ;
49
-
50
47
/** @var bool */
51
48
private $ useLinesAttributes ;
52
49
@@ -65,7 +62,6 @@ public function __construct(
65
62
bool $ requireWhitespaceBeforeDescription = false ,
66
63
bool $ preserveTypeAliasesWithInvalidTypes = false ,
67
64
array $ usedAttributes = [],
68
- bool $ parseDoctrineAnnotations = false ,
69
65
bool $ textBetweenTagsBelongsToDescription = false
70
66
)
71
67
{
@@ -74,7 +70,6 @@ public function __construct(
74
70
$ this ->doctrineConstantExprParser = $ constantExprParser ->toDoctrine ();
75
71
$ this ->requireWhitespaceBeforeDescription = $ requireWhitespaceBeforeDescription ;
76
72
$ this ->preserveTypeAliasesWithInvalidTypes = $ preserveTypeAliasesWithInvalidTypes ;
77
- $ this ->parseDoctrineAnnotations = $ parseDoctrineAnnotations ;
78
73
$ this ->useLinesAttributes = $ usedAttributes ['lines ' ] ?? false ;
79
74
$ this ->useIndexAttributes = $ usedAttributes ['indexes ' ] ?? false ;
80
75
$ this ->textBetweenTagsBelongsToDescription = $ textBetweenTagsBelongsToDescription ;
@@ -88,44 +83,35 @@ public function parse(TokenIterator $tokens): Ast\PhpDoc\PhpDocNode
88
83
89
84
$ children = [];
90
85
91
- if ($ this ->parseDoctrineAnnotations ) {
92
- if (!$ tokens ->isCurrentTokenType (Lexer::TOKEN_CLOSE_PHPDOC )) {
93
- $ lastChild = $ this ->parseChild ($ tokens );
94
- $ children [] = $ lastChild ;
95
- while (!$ tokens ->isCurrentTokenType (Lexer::TOKEN_CLOSE_PHPDOC )) {
96
- if (
97
- $ lastChild instanceof Ast \PhpDoc \PhpDocTagNode
98
- && (
99
- $ lastChild ->value instanceof Doctrine \DoctrineTagValueNode
100
- || $ lastChild ->value instanceof Ast \PhpDoc \GenericTagValueNode
101
- )
102
- ) {
103
- $ tokens ->tryConsumeTokenType (Lexer::TOKEN_PHPDOC_EOL );
104
- if ($ tokens ->isCurrentTokenType (Lexer::TOKEN_CLOSE_PHPDOC )) {
105
- break ;
106
- }
107
- $ lastChild = $ this ->parseChild ($ tokens );
108
- $ children [] = $ lastChild ;
109
- continue ;
110
- }
111
-
112
- if (!$ tokens ->tryConsumeTokenType (Lexer::TOKEN_PHPDOC_EOL )) {
113
- break ;
114
- }
86
+ if (!$ tokens ->isCurrentTokenType (Lexer::TOKEN_CLOSE_PHPDOC )) {
87
+ $ lastChild = $ this ->parseChild ($ tokens );
88
+ $ children [] = $ lastChild ;
89
+ while (!$ tokens ->isCurrentTokenType (Lexer::TOKEN_CLOSE_PHPDOC )) {
90
+ if (
91
+ $ lastChild instanceof Ast \PhpDoc \PhpDocTagNode
92
+ && (
93
+ $ lastChild ->value instanceof Doctrine \DoctrineTagValueNode
94
+ || $ lastChild ->value instanceof Ast \PhpDoc \GenericTagValueNode
95
+ )
96
+ ) {
97
+ $ tokens ->tryConsumeTokenType (Lexer::TOKEN_PHPDOC_EOL );
115
98
if ($ tokens ->isCurrentTokenType (Lexer::TOKEN_CLOSE_PHPDOC )) {
116
99
break ;
117
100
}
118
-
119
101
$ lastChild = $ this ->parseChild ($ tokens );
120
102
$ children [] = $ lastChild ;
103
+ continue ;
121
104
}
122
- }
123
- } else {
124
- if (!$ tokens ->isCurrentTokenType (Lexer::TOKEN_CLOSE_PHPDOC )) {
125
- $ children [] = $ this ->parseChild ($ tokens );
126
- while ($ tokens ->tryConsumeTokenType (Lexer::TOKEN_PHPDOC_EOL ) && !$ tokens ->isCurrentTokenType (Lexer::TOKEN_CLOSE_PHPDOC )) {
127
- $ children [] = $ this ->parseChild ($ tokens );
105
+
106
+ if (!$ tokens ->tryConsumeTokenType (Lexer::TOKEN_PHPDOC_EOL )) {
107
+ break ;
128
108
}
109
+ if ($ tokens ->isCurrentTokenType (Lexer::TOKEN_CLOSE_PHPDOC )) {
110
+ break ;
111
+ }
112
+
113
+ $ lastChild = $ this ->parseChild ($ tokens );
114
+ $ children [] = $ lastChild ;
129
115
}
130
116
}
131
117
@@ -539,17 +525,11 @@ function ($tokens) {
539
525
break ;
540
526
541
527
default :
542
- if ($ this ->parseDoctrineAnnotations ) {
543
- if ($ tokens ->isCurrentTokenType (Lexer::TOKEN_OPEN_PARENTHESES )) {
544
- $ tagValue = $ this ->parseDoctrineTagValue ($ tokens , $ tag );
545
- } else {
546
- $ tagValue = new Ast \PhpDoc \GenericTagValueNode ($ this ->parseOptionalDescriptionAfterDoctrineTag ($ tokens ));
547
- }
548
- break ;
528
+ if ($ tokens ->isCurrentTokenType (Lexer::TOKEN_OPEN_PARENTHESES )) {
529
+ $ tagValue = $ this ->parseDoctrineTagValue ($ tokens , $ tag );
530
+ } else {
531
+ $ tagValue = new Ast \PhpDoc \GenericTagValueNode ($ this ->parseOptionalDescriptionAfterDoctrineTag ($ tokens ));
549
532
}
550
-
551
- $ tagValue = new Ast \PhpDoc \GenericTagValueNode ($ this ->parseOptionalDescription ($ tokens ));
552
-
553
533
break ;
554
534
}
555
535
0 commit comments