for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace SumoCoders\FrameworkErrorBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Bundle\FrameworkBundle\Translation\Translator;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
class ExceptionController extends Controller
{
/**
* @param Request $request
* @param FlattenException $exception
* @param DebugLoggerInterface $logger
$logger
null|DebugLoggerInterface
This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.
@param
It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.
* @return \Symfony\Component\HttpFoundation\Response
*/
public function showExceptionAction(
Request $request,
$request
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
FlattenException $exception,
DebugLoggerInterface $logger = null
) {
/** @var Translator $translator */
$translator = $this->get('translator');
$message = $translator->trans('error.messages.generic');
// check if the error is whitelisted to overrule the message
if (in_array(
$exception->getClass(),
$this->container->getParameter('sumo_coders_framework_error.show_messages_for')
)) {
$message = $exception->getMessage();
}
// translate page not found messages
if ('Symfony\Component\HttpKernel\Exception\NotFoundHttpException' == $exception->getClass()) {
$message = $translator->trans('error.messages.noRouteFound');
return $this->render(
'::error.html.twig',
array(
'status_code' => $exception->getStatusCode(),
'status_text' => $message,
)
);
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.