lhapaipai / vite-bundle

Integration with your Symfony app & Vite

Home Page:https://symfony-vite.pentatrion.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Symfony/asset v4.4 Support

MustaRohmanMVF opened this issue · comments

Hi,

When I was attempting to install this package, I came across this error:

PHP Fatal error:  Declaration of Pentatrion\ViteBundle\Asset\ViteAssetVersionStrategy::getVersion(string $path): string must be compatible with Symfony\Component\Asset\VersionStrategy\VersionStrategyInterface::getVersion($path) in /var/www/vendor/pentatrion/vite-bundle/src/Asset/ViteAssetVersionStrategy.php on line 46

In ViteAssetVersionStrategy.php line 46:
                                                                               
  Compile Error: Declaration of Pentatrion\ViteBundle\Asset\ViteAssetVersionS  
  trategy::getVersion(string $path): string must be compatible with Symfony\C  
  omponent\Asset\VersionStrategy\VersionStrategyInterface::getVersion($path) 

This appears to be because the version of symfony/asset (4.4) I have installed has some slight type differences as can be seen here https://github.com/symfony/asset/blob/4.4/VersionStrategy/VersionStrategyInterface.php.

Are there any plans for supporting symfony/asset 4.4?

Many thanks!

Hi @MustaRohmanMVF.
To tell you the truth, I won't really see how to do it because if I make VersionStrategyInterface compatible with symfony 4.4 and 5.x, I will no longer be compatible with the VersionStrategyInterface of Symfony 6.x...
Have you got any idea ?

Otherwise, this class is independent from the rest of the bundle so you can very well copy and paste the class into your project and use your modified class?

Hi @MustaRohmanMVF. To tell you the truth, I won't really see how to do it because if I make VersionStrategyInterface compatible with symfony 4.4 and 5.x, I will no longer be compatible with the VersionStrategyInterface of Symfony 6.x... Have you got any idea ?

Otherwise, this class is independent from the rest of the bundle so you can very well copy and paste the class into your project and use your modified class?

Hi @lhapaipai, thanks for the response! Unfortunately, I do not see any other way to do it at this time but creating a modified version of the class might be the simplest way forward. I will give that a go, thanks for your help!