Annotations in Symfony 4

15,051

I found the issue and how to fix it

As you can see on my screen I wrote

/**
* @Route('/')
*/

However to work we have to put " instead of '

/**
* @Route("/")
*/
Share:
15,051
N.Jourdan
Author by

N.Jourdan

Updated on June 17, 2022

Comments

  • N.Jourdan
    N.Jourdan almost 2 years

    I try to develop with Symfony 4 so I follow the tutorial on symfony.com

    I've got an error when I try to access at :

    http://localhost:8000/
    

    This is the error :

    [Syntax Error] Expected PlainValue, got ''' at position 7 in method App\Controller\HomeController::home() in /Users//Documents/ProjetSymfo4/my-project/config/routes/../../src/Controller/ (which is being imported from "/Users//Documents/ProjetSymfo4/my-project/config/routes/annotations.yaml"). Make sure annotations are installed and enabled.

    I already ran

    composer require annotations

    And it is installed

    In composer.json : 
    
    "require": {
        "php": "^7.1.3",
        "ext-iconv": "*",
        "sensio/framework-extra-bundle": "^5.1",
    

    This is my project :

    enter image description here

  • Cerad
    Cerad about 6 years
    And I suspect you added a use statement as well.
  • Arleigh Hix
    Arleigh Hix about 6 years
    You should accept this answer if it corrected the problem
  • Aris
    Aris over 3 years
    thanks. symfony should not be so quote sensitive.