You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ERROR] /Users/Aerendir/Documents/JooServer/Lab/Bundles/bundle-users/src/Command/AbstractUserCommand.php
Line: 23
Message: Could not parse class "SerendipityHQ\Bundle\UsersBundle\Command" for annotations. [Semantical Error]
The annotation "@Suppress" in property SerendipityHQ\Bundle\UsersBundle\Command\AbstractUserCommand::$user
was never imported. Did you maybe forget to add a "use" statement for this annotation?
try {
/** @var ClassMetadata $metadata */$metadata = $this->metadataFactory->getMetadataFor($name);
} catch (AnnotationException$e) {
if (false === strpos($e->getMessage(), '"@suppress"')) {
$this->addError($node, sprintf('Could not parse class "%s" for annotations. %s', $this->namespace, $e->getMessage()));
returnnull;
}
}
But obviously it doesn't work, as the variable $metadata is not created at all due to the exception:
In ValidationAnnotation.php line 86:
Notice: Undefined variable: metadata
So, it seems that is required to act on Doctrine DocParser...
Then, on Doctrine side, the DocParser has a useful option that permits to ignore some annotations: the ignored annotation don't throw any exception (Source: Doctrine/Common/Annotations/DocParser).
The question is: how to configure DocParser to ignore the @suppress annotation?
The text was updated successfully, but these errors were encountered:
Aerendir
changed the title
The annotation "@suppress" ... was never imported.
[BUG] translation:extract The annotation "@suppress" ... was never imported.
Sep 23, 2020
Complete error
The error is cause by the use of annotation
@suppress
that is used to suppress errors triggered by Phan (https://github.com/phan/phan/wiki/Annotating-Your-Source-Code#suppress).The annotation hasn't to be imported.
Trying to debug the error, it seems it is triggered by
Doctrine/Common/Annotations/DocParser
.It is finally added as error in PHPTranslation in
Translation\Extractor\Visitor\Php\Symfony\ValidationAnnotation
.I've tried to add a simple condition like this:
But obviously it doesn't work, as the variable
$metadata
is not created at all due to the exception:So, it seems that is required to act on Doctrine
DocParser
...Then, on Doctrine side, the
DocParser
has a useful option that permits to ignore some annotations: the ignored annotation don't throw any exception (Source:Doctrine/Common/Annotations/DocParser
).The question is: how to configure
DocParser
to ignore the@suppress
annotation?The text was updated successfully, but these errors were encountered: