phpsymfonyannotationsdoctrinephp-carbon

The annotation "@mixin" in class Carbon\\Carbon was never imported


I migrated my Symfony project from 5.2 to 5.4 with PHP 8.1. I use Carbon nesbot/carbon.

I have the error.

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

In my Kernel, I add in Kernel::configureContainer

AnnotationReader::addGlobalIgnoredName('mixin');
AnnotationReader::addGlobalIgnoredName('alias');

Why do I still get the error when these annotations should be disabled?


Solution

  • I found the problem. It was the Symfony serializer. I created a normalizer/denormalizer, and now everything works.