Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NetBeans/Symfony2 gives "unused use statement" warnings when using FOSRestBundle namespaces

I have the following set up on my PC, Ubuntu: 13.10, NetBeans: 8.0, Symfony: 2.4.3, FOSRestBundle: 1.3.0,

and I have a "false" warning "unused use statement" in my code:

use FOS\RestBundle\Controller\Annotations;

where later I have,

/**
/* @Annotations\View()
*/
public function someFunction(){}

The code is working, if I just ignore the warning; however, If I use NetBeans feature "Fix Uses (CTRL+SHIFT+I), the required use statement would be deleted.

I found a relevant bug archive here: https://netbeans.org/bugzilla/show_bug.cgi?id=212932 but the bug has status as resolved.

Other Symfony annotations work fine, e.g. the @Route annotation from Sensio\Bundle\FrameworkExtraBundle\Configuration\Route

I would like to know if there is any way to remove the "false" warning on my use statement.

like image 581
d.chen Avatar asked Apr 15 '14 04:04

d.chen


1 Answers

You must check an option in NetBeans :

Tools -> Options -> PHP -> Annotations -> Treat unknown annotation as Type Annotation

(after you check, close your file, then reopen it)

like image 191
griotteau Avatar answered Oct 15 '22 03:10

griotteau