Skip to content

[5.3 beta1][Routing] Unknown property on i18n routes (@Route) #40860

@COil

Description

@COil

Symfony version(s) affected: 5.3.0 beta1

Description

I tried to update my blog to 5.3 beta1 (current version 5.2.6) and I get the following error :

Unknown property "en" on annotation "Symfony\Component\Routing\Annotation\Route" in /Users/coil/Sites/strangebuzz.com/config/routes/../../src/Controller/ (which is being imported from "/Users/coil/Sites/strangebuzz.com/config/routes/annotations.yaml"). Make sure to use PHP 8+ or that annotations are installed and enabled.

How to reproduce

The error seems to come from my i18n routes, for example:

 use Symfony\Component\Routing\Annotation\Route;

/**
 * App generic actions and locales root handling.
 */
final class AppController extends AbstractController
{
    /**
     * @Route({"en": "/en", "fr": "/fr"}, name="homepage")
     *
     * @param array<string,int> $goals
     */
public function homepage(string $_locale, array $goals, ArticleRepository $articleRepository): Response
{

Where we have the "en" parameter that is pointed out by the error message.

Possible Solution

Additional context

  • PHP 7.4.13

Route.php

    if (!method_exists($this, $method)) {
                throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, static::class));
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions