Search code examples
phpsymfonyannotations

JMSTranslationBundle The annotation "@optional" in property was never imported. Did you maybe forget to add a "use" statement for this annotation?


I try extract translations but have many errors

php bin/console translation:extract pt --dir=./src/ --output-dir=./app/Resources/translations

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

 [Semantical Error] The annotation "@optional" in property Ups\Entity\Tradeability\TariffInfo::$detailId was never imported. Did you maybe forget to add a "use" statement for this annotation?

is possible to ignore unknown annotations ?

 "jms/translation-bundle": "^1.3",
    "nikic/php-parser": "v1.4.1",

Solution

  • You can use https://packagist.org/packages/autumndev/jms-serializer-carbon

    just install it and use when creating builder

            SerializerBuilder::create()
            ->configureHandlers(
                function(HandlerRegistry $registry) {
                    $registry->registerSubscribingHandler(new \AutumnDev\JMS\CarbonHandler());
                }
            )
            ->build()
            ->deserialize($object)
            ;