@@ -31,6 +31,9 @@ class NameResolver extends NodeVisitorAbstract
3131 /** @var bool Whether to replace resolved nodes in place, or to add resolvedNode attributes */
3232 protected $ replaceNodes ;
3333
34+ /** @var bool Whether to parse DocBlock Custom Annotations */
35+ protected $ parseCustomAnnotations ;
36+
3437 /**
3538 * Constructs a name resolution visitor.
3639 *
@@ -40,6 +43,7 @@ class NameResolver extends NodeVisitorAbstract
4043 * * replaceNodes (default true): Resolved names are replaced in-place. Otherwise, a
4144 * resolvedName attribute is added. (Names that cannot be statically resolved receive a
4245 * namespacedName attribute, as usual.)
46+ * * parseCustomAnnotations (default true): Whether to parse DocBlock Custom Annotations.
4347 *
4448 * @param ErrorHandler|null $errorHandler Error handler
4549 * @param array $options Options
@@ -49,6 +53,7 @@ public function __construct(ErrorHandler $errorHandler = null, array $options =
4953 $ this ->nameContext = new NameContext ($ errorHandler ?? new ErrorHandler \Throwing ());
5054 $ this ->preserveOriginalNames = $ options ['preserveOriginalNames ' ] ?? false ;
5155 $ this ->replaceNodes = $ options ['replaceNodes ' ] ?? true ;
56+ $ this ->parseCustomAnnotations = $ options ['parseCustomAnnotations ' ] ?? true ;
5257 }
5358
5459 /**
@@ -148,7 +153,7 @@ public function enterNode(Node $node)
148153 break ;
149154 }
150155
151- if (!($ node ->type instanceof FullyQualified)) {
156+ if ($ this -> parseCustomAnnotations && !($ node ->type instanceof FullyQualified)) {
152157 foreach ($ phpDocNode ->getTags () as $ tagValue ) {
153158 if ('@ ' === $ tagValue ->name [0 ] && false === strpos ($ tagValue ->name , '@var ' )) {
154159 $ customTag = str_replace ('@ ' , '' , $ tagValue ->name );
0 commit comments