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

DocBlock empty when {id} in Route #222

Open
youpilai opened this issue Apr 1, 2022 · 1 comment
Open

DocBlock empty when {id} in Route #222

youpilai opened this issue Apr 1, 2022 · 1 comment

Comments

@youpilai
Copy link

youpilai commented Apr 1, 2022

First, apologize if it's a silly question, i'm new to VSCode

When providing Route with {id}, the generated block is empty :

/**
 * 
 */
#[Route('/pages/show/{id}', name: 'page.show', methods: ['GET'])]
public function show(PageRepository $repository, int $id): Response
{
    return $this->render('pages/admin/page.index.html.twig', [
        'controller_name' => 'TestController',
    ]);
}

As soon as i remove the {id} parameter, the block is generated as expected :

/**
 * Undocumented function
 *
 * @param PageRepository $repository
 * @param integer $id
 * @return Response
 */
#[Route('/pages/show', name: 'page.show', methods: ['GET'])]
public function show(PageRepository $repository, int $id): Response
{
    return $this->render('pages/admin/page.index.html.twig', [
        'controller_name' => 'TestController',
    ]);
}

tested in a fresh install of VSCode [v1.66] with only PHP Intelephense [v1.8.2] and PHP DocBlocker [v2.7.0] installed

Is there a setting to change to obtain the expected DocBlock ?

Thanks

@neild3r
Copy link
Owner

neild3r commented May 17, 2022

The plugin wasn't really designed to support the annotation you are using it expects that the function you are attempting to docblock is on the line below not two lines below which is why you are seeing unexpected behaviour.

Most frameworks have a way of doing route annotation inside a docblock perhaps there is an alternative way to declare it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants