Cannot do such things :(
/**
* @var Collection|Answer[]
* @psalm-var Collection<int, Answer>&Selectable
*
* @ORM\OneToMany(targetEntity=Answer::class, mappedBy="question", fetch="EXTRA_LAZY")
*/
protected $answers;
AnnotationException [Semantical Error] The annotation "@psalm" in property App\Entity\QuestionPack\Question::$answers was never imported. Did you maybe forget to add a "use" statement for this annotation?
--
in AnnotationException.php line 54
at AnnotationException::semanticalError('The annotation "@psalm" in property App\\Entity\\QuestionPack\\Question::$answers was never imported. Did you maybe forget to add a "use" statement for this annotation?')in DocParser.php line 727
at DocParser->Annotation()in DocParser.php line 663
at DocParser->Annotations()in DocParser.php line 354
at DocParser->parse('/** * @var Collection\|Answer[] * @psalm-suppress \\stdClass * * @ORM\\OneToMany(targetEntity=Answer::class, mappedBy="question", fetch="EXTRA_LAZY") */', 'property App\\Entity\\QuestionPack\\Question::$answers')in AnnotationReader.php line 254
at AnnotationReader->getPropertyAnnotations(object(ReflectionProperty))in CachedReader.php line 113
at CachedReader->getPropertyAnnotations(object(ReflectionProperty))in CachedReader.php line 125
at CachedReader->getPropertyAnnotation(object(ReflectionProperty), 'Doctrine\\ORM\\Mapping\\Cache')in AnnotationDriver.php line 292
at AnnotationDriver->loadMetadataForClass('App\\Entity\\QuestionPack\\Question', object(ClassMetadata))in MappingDriverChain.php line 102
at MappingDriverChain->loadMetadataForClass('App\\Entity\\QuestionPack\\Question', object(ClassMetadata))in ClassMetadataFactory.php line 151
at ClassMetadataFactory->doLoadMetadata(object(ClassMetadata), null, false, array())in AbstractClassMetadataFactory.php line 333
at AbstractClassMetadataFactory->loadMetadata('App\\Entity\\QuestionPack\\Question')in ClassMetadataFactory.php line 78
at ClassMetadataFactory->loadMetadata('App\\Entity\\QuestionPack\\Question')in AbstractClassMetadataFactory.php line 217
at AbstractClassMetadataFactory->getMetadataFor('App\\Entity\\QuestionPack\\Question')in EntityManager.php line 282
at EntityManager->getClassMetadata('App\\Entity\\QuestionPack\\Question')in ContainerRepositoryFactory.php line 44
at ContainerRepositoryFactory->getRepository(object(EntityManager), 'App\\Entity\\QuestionPack\\Question')in EntityManager.php line 716
at EntityManager->getRepository('App\\Entity\\QuestionPack\\Question')in AbstractManagerRegistry.php line 242
at AbstractManagerRegistry->getRepository('App\\Entity\\QuestionPack\\Question')in srcDevDebugProjectContainer.php line 1635
at srcDevDebugProjectContainer->getQuestionRepositoryService()in srcDevDebugProjectContainer.php line 1623
at srcDevDebugProjectContainer->getDivisionRepositoryService()in srcDevDebugProjectContainer.php line 1527
at srcDevDebugProjectContainer->getTwigService()in getTwig_Form_RendererService.php line 15
at require('/var/www/var/cache/dev/ContainerVEIZAyC/getTwig_Form_RendererService.php')in srcDevDebugProjectContainer.php line 677
at srcDevDebugProjectContainer->load('getTwig_Form_RendererService.php')in getApiExceptionSubscriberService.php line 15
at require('/var/www/var/cache/dev/ContainerVEIZAyC/getApiExceptionSubscriberService.php')in srcDevDebugProjectContainer.php line 677
at srcDevDebugProjectContainer->load('getApiExceptionSubscriberService.php')in srcDevDebugProjectContainer.php line 936
at srcDevDebugProjectContainer->ContainerVEIZAyC\{closure}()in EventDispatcher.php line 229
at EventDispatcher->sortListeners('kernel.exception')in EventDispatcher.php line 61
at EventDispatcher->getListeners('kernel.exception')in TraceableEventDispatcher.php line 263
at TraceableEventDispatcher->preProcess('kernel.exception')in TraceableEventDispatcher.php line 136
at TraceableEventDispatcher->dispatch('kernel.exception', object(GetResponseForExceptionEvent))in HttpKernel.php line 219
at HttpKernel->handleException(object(AnnotationException), object(Request), 1)in HttpKernel.php line 77
at HttpKernel->handle(object(Request), 1, true)in Kernel.php line 188
at Kernel->handle(object(Request))in index.php line 34
Got some very useful advice on slack from @jakzal (thanks!)
kuba [12:26]
@ostrolucky https://www.doctrine-project.org/api/annotations/1.6/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.html
ostrolucky [12:27]
damn that's one well hidden feature
kuba [12:27]
i vaguely remember it was also possible to do via the annotation driver, but can鈥檛 be sure now
oh, here it is: `AnnotationReader::addGlobalIgnoredName('psalm');`
https://www.doctrine-project.org/projects/doctrine-annotations/en/1.6/annotations.html
I suggest to add solution to this problem to documentation
What can be done about this ?
adding solution to this problem to documentation
Do you try with latest doctrine/annotations?
AFAIK they are introduce ignore annotations with hyphen (-) to avoid this issues.
Upd: https://github.com/doctrine/annotations/releases/tag/v1.6.1
That indeed seems it should fix the issue. Gonna close now until someone reports otherwise
Most helpful comment
Do you try with latest doctrine/annotations?
AFAIK they are introduce ignore annotations with hyphen (
-) to avoid this issues.Upd: https://github.com/doctrine/annotations/releases/tag/v1.6.1