Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declaration must be compatible #708

Closed
ThomasTr opened this issue Dec 13, 2018 · 6 comments
Closed

Declaration must be compatible #708

ThomasTr opened this issue Dec 13, 2018 · 6 comments

Comments

@ThomasTr
Copy link

Hi,

get this error after upgrade to latest version:

Compile Error: Declaration of JMS\Serializer\XmlSerializationVisitor::startVisitingObject(JMS\Serializer\Metadata\ClassMetadata $metadata, JMS\Serializer\object $data, array $type): void must be compatible with JMS\Serializer\Visitor\SerializationVisitorInterface::startVisitingObject(JMS\Serializer\Metadata\ClassMetadata $metadata, JMS\Serializer\Visitor\object $data, array $type): void

Stacktrace

  at vendor/jms/serializer/src/XmlSerializationVisitor.php:18
  at vendor/symfony/debug/DebugClassLoader.php:151
  at Symfony\Component\Debug\DebugClassLoader->loadClass()
     (vendor/jms/serializer/src/Visitor/Factory/XmlSerializationVisitorFactory.php:42)
  at spl_autoload_call()
     (vendor/jms/serializer/src/Visitor/Factory/XmlSerializationVisitorFactory.php:42)
  at JMS\Serializer\Visitor\Factory\XmlSerializationVisitorFactory->getVisitor()
     (vendor/jms/serializer/src/Serializer.php:145)
  at JMS\Serializer\Serializer->getVisitor()
     (vendor/jms/serializer/src/Serializer.php:157)
  at JMS\Serializer\Serializer->serialize()
     (src/Controller/ExportController.php:58)
  at App\Controller\ExportController->exportServiceReportAction()
     (vendor/symfony/http-kernel/HttpKernel.php:150)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:67)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:198)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (public/index.php:34)
  at {main}()
     (public/index.php:0)

The Part in the exportServiceReportAction()

        $xml = $serializer->serialize($rma, 'xml', SerializationContext::create()->setGroups(['exportServiceReport']));

Installed versions:
jms/serializer 2.0.2
jms/serializer-bundle 3.0.1

@goetas
Copy link
Collaborator

goetas commented Dec 13, 2018

which PHP version are you running?

@goetas
Copy link
Collaborator

goetas commented Dec 13, 2018

It looks you are running php < 7.2

@ThomasTr
Copy link
Author

Hi, thank you for your hint. Have multiple php versions installed an this project was running on 7.1.8.
Switched to 7.2 and it works fine.

You can close this issue.

@goetas
Copy link
Collaborator

goetas commented Dec 13, 2018

👍

@goetas goetas closed this as completed Dec 13, 2018
@LesovoyRoman
Copy link

👍

@mustapha-ghlissi
Copy link

Solution is to update you PHP to the version required by JMS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants