for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Authorization\Controller;
use FOS\OAuthServerBundle\Controller\AuthorizeController;
use Nelmio\ApiDocBundle\Annotation\Operation;
use Swagger\Annotations as SWG;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
/**
* Class OAuthAuthorizeController
* @package App\Authorize\Controller
*
* {@inheritdoc}
*/
class OAuthAuthorizeController extends AuthorizeController {
* Authorize user
* @Route("/oauth/v2/auth")
* @Method({"POST","GET"})
* @Operation(
* tags={"OAuth"},
* summary="Authorize user",
* @SWG\Parameter(
* name="redirect_uri",
* in="formData",
* description="The redirect URI registered by the client",
* required=false,
* type="string"
* ),
* name="scope",
* description="The scope of the authorization",
* name="state",
* description="Any client state that needs to be passed on to the client request URI",
* @SWG\Response(
* response="200",
* description="Returned when successful"
* )
* @param Request $request
* @return \Symfony\Component\HttpFoundation\Response
public function authorize(Request $request)
$request
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function authorize(/** @scrutinizer ignore-unused */ Request $request)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
{
return new JsonResponse(['test']);
return parent::authorizeAction($request);
return parent::authorizeAction($request)
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.
return
die
exit
function fx() { try { doSomething(); return true; } catch (\Exception $e) { return false; } return false; }
In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.
return false
}
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.