for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
*
* (c) Yaroslav Honcharuk <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Yarhon\RouteGuardBundle\Tests\Functional\Bundle\SensioSecurityBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
/**
* @author Yaroslav Honcharuk <[email protected]>
class Controller extends AbstractController
{
* @Route("/public_action", name="public_action")
public function publicAction()
return new Response('user action');
}
* @Route("/user_action", name="user_action")
* @IsGranted("ROLE_USER", subject="argument")
public function securedByIsGrantedAction($argument = 10)
$argument
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function securedByIsGrantedAction(/** @scrutinizer ignore-unused */ $argument = 10)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
* @Route("/admin_action", name="admin_action")
* @Security("is_granted('ROLE_ADMIN')")
public function securedBySecurityAction($argument)
public function securedBySecurityAction(/** @scrutinizer ignore-unused */ $argument)
return new Response('admin action');
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.