src/ExceptionHandler/DefaultHandler.php
Avoid using undefined variables such as '$statusTexts' which will lead to PHP notices. Open
Open
['error' => $e->getStatusCode() . ' ' . Response::$statusTexts[$e->getStatusCode()] ],
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$statusTexts' which will lead to PHP notices. Open
Open
$e->getStatusCode() . ' ' . Response::$statusTexts[$e->getStatusCode()],
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Returning type \Circuit\ExceptionHandler\JsonResponse
but handle()
is declared to return \Symfony\Component\HttpFoundation\Response
Open
Open
return new JsonResponse(
- Exclude checks
Avoid variables with short names like $e. Configured minimum length is 3. Open
Open
public function handle(Exception $e, Request $request) : Response
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}