for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Common;
use Rudra\Exceptions\RouterException;
trait HttpErrors
{
public function handle404($data, string $type = 'db', array $page = [])
if ($type == 'db') {
if (count($data) < 1 || !$data) {
throw new RouterException('404');
}
} elseif ($type == 'pagination') {
if ($page['id'] > count($data)) {
public function error404()
$this->redirect()->responseCode('404');
return $this->twig('errors/404.html.twig', [
$this->twig('errors/404.... $this->data('title')))
App\Common\HttpErrors::twig()
This check looks for function or method calls that always return null and whose return value is used.
class A { function getObject() { return null; } } $a = new A(); if ($a->getObject()) {
The method getObject() can return nothing but null, so it makes no sense to use the return value.
getObject()
The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.
'title' => '404 Page Not Found :: ' . $this->data('title'),
$this->data('title')
array|string
concatenation
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
ignore-type
'title' => '404 Page Not Found :: ' . /** @scrutinizer ignore-type */ $this->data('title'),
]);
public function error503()
$this->redirect()->responseCode('503');
return $this->twig('errors/503.html.twig', [
$this->twig('errors/503.... $this->data('title')))
'title' => '503 Service Unavailable :: ' . $this->data('title'),
'title' => '503 Service Unavailable :: ' . /** @scrutinizer ignore-type */ $this->data('title'),
public function error500()
/**
* @param null $target
$target
null
*
* @return mixed
*/
public abstract function redirect($target = null);
* @param string $template
* @param array $params
public abstract function twig(string $template, array $params = []): void;
* @param string $key
* @return string|array
public abstract function data(string $key = null);
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.