dustin10 / VichUploaderBundle

A simple Symfony bundle to ease file uploads with ORM entities and ODM documents.
MIT License
1.85k stars 519 forks source link

Update return types. #1242

Closed laurentmuller closed 2 years ago

laurentmuller commented 2 years ago

BC Break Report

Q A
BC Break No
Version 1.18.0

Summary

I have a project that use this bundle with symfony version 5.4. When I run PHP unit tests. A warning is output:

1x: Method "Symfony\Component\Form\DataTransformerInterface::reverseTransform()" might add "mixed" as a native return type declaration in the future. Do the same in implementation "Vich\UploaderBundle\Form\DataTransformer\FileTransformer" now to avoid errors or add an explicit @return annotation to suppress this message.

To stop all this warnings, just modify code to add a return type. For example for FileTransformer warning:

Before:

 /**
   * {@inheritdoc}
   */
  public function reverseTransform()
  {
      ...
  }

After:

 /**
   * {@inheritdoc}
   */
  public function reverseTransform(): ?UploadedFile
  {
      ...
  }

Or

 /**
   * {@inheritdoc}
   * 
   * @return UploadedFile|null
   */
  public function reverseTransform()
  {
      ...
  }
garak commented 2 years ago

Fixed in 35c80f2c5daf286abf1a04bc4f8e3eccabf7cd03

laurentmuller commented 2 years ago

Sorry, I didn't see this fix.