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

Compatibility issues with Symfony\Component\Routing\Router functions #253

Open
atjsd opened this issue Dec 9, 2021 · 0 comments
Open

Compatibility issues with Symfony\Component\Routing\Router functions #253

atjsd opened this issue Dec 9, 2021 · 0 comments

Comments

@atjsd
Copy link

atjsd commented Dec 9, 2021

In an effort to try and fix deprecation warnings after upgrading my project to Symfony 5.4, I was able to replace the deprecated Router Annotations from the FrameworkExtraBundle with the Symfony\Component\Routing\Annotation\Route from the sensio/framework-bundle.

However, doing so causes issues with this bundle:

PHP Fatal error: Declaration of JMS\I18nRoutingBundle\Router\I18nRouter::generate(string $name, $parameters = [], $referenceType = self::ABSOLUTE_PATH) must be compatible with Symfony\Component\Routing\Router::generate(string $name, array $parameters = [], int $referenceType = self::ABSOLUTE_PATH): string in /var/www/atjwp/vendor/jms/i18n-routing-bundle/JMS/I18nRoutingBundle/Router/I18nRouter.php on line 100
Symfony\Component\ErrorHandler\Error\FatalError

Declaration of JMS\I18nRoutingBundle\Router\I18nRouter::match($url) must be compatible with Symfony\Component\Routing\Router::match(string $pathinfo): array

Declaration of JMS\I18nRoutingBundle\Router\I18nRouter::matchRequest(Symfony\Component\HttpFoundation\Request $request) must be compatible with Symfony\Component\Routing\Router::matchRequest(Symfony\Component\HttpFoundation\Request $request): array

The fix is relatively straightforward, and I have managed to get it to work locally. The fix involves adding return types and types for the function arguments to the generate(), match() and matchRequest() functions.

However, I am not sure if there might be a valid reason why these fixes weren't implemented yet? If not, I have created a PR (#254), but I can't seem to find a way to link it to this issue.

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

1 participant