I am using PhpStorm 2019.2 In the Symfony controller, methods are highlighted as not being used. Xdebug, then I get an error
I read on https://youtrack.jetbrains.com that this is possibly a bug, the new version of the IDE does not work correctly with annotations
C:\OpenServer\OSPanel\modules\php\PHP_7.2\php.exe -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9090 -dxdebug.remote_host=127.0.0.1 C:\OpenServer\OSPanel\domains\myblog.loc\src\Controller\IndexController.php
Fatal error: Class 'Symfony\Bundle\FrameworkBundle\Controller\Controller' not found in C:\OpenServer\OSPanel\domains\myblog.loc\src\Controller\IndexController.php on line 18
Call Stack:
0.0679 382496 1. {main}() C:\OpenServer\OSPanel\domains\myblog.loc\src\Controller\IndexController.php:0
Dump $_SERVER
$_SERVER['REMOTE_ADDR'] is undefined
$_SERVER['REQUEST_METHOD'] is undefined
Dump $_SESSION
$_SESSION['*'] is undefined
Dump $_REQUEST
Process finished with exit code 255
Some Controller
class ContactController extends Controller
{
/**
* @Route("/contact", name="contact_view")
* @return \Symfony\Component\HttpFoundation\Response
*/
public function contactView()
{
return $this->render('contact/contact.html.twig', [
]);
}
}
At the moment, the class and its action are marked as unused in the controller, what should I do?
You can add your controllers and their actions as entry points. This way, those classes and methods will not be reported as dead code.
If your controllers are in src/Controller
and your action methods have the -Action
suffix, you can add these two rules as entry points in Settings| Editor | Inspections
:
Class Member
/Controller/*Controller *Action
/Controller/*Controller
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With