webmozarts / assert

Assertions to validate method input/output with nice error messages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@mixin breaks Doctrine Annotations parsing

ruudk opened this issue · comments

After upgrading from 1.8.0 to 1.9.1 I'm getting an error with JMS Serializer:

  [Doctrine\Common\Annotations\AnnotationException]
  [Semantical Error] The annotation "@mixin" in class Webmozart\Assert\Assert was never imported. Did you maybe forget to add a "use" statement for this annotation?

This seems to originate from PR #126

I found 2 issues at Doctrine Annotations that explain that they cannot fix this:
doctrine/annotations#293
doctrine/annotations#154

Out of curiosity - what do you serialise?

Nothing, it happens during cache warmup where JMS Serializer scans some annotations.

So the issue comes from JMS using Doctrine Annotations that trips on this mixin annotation.

What platform/framework do you use? Is it symfony?

These are my dependencies:

doctrine/annotations                             1.11.1
jms/metadata                                     2.4.0
jms/serializer                                   3.10.0 
jms/serializer-bundle                            3.7.0
webmozart/assert                                 1.9.1
symfony/*                                        v5.2.0

The @mixin annotation is removed in 1.10.0. We use a real trait instead.

Can you confirm this issue is resolved?

I'm not sure where I experienced this problem. I see that our projects already use 1.9.0 so I expect the problem was fixed in another way. Sorry for not being able to provide more info. Thanks for fixing it anyway :)