for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Northwoods\Router;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Nyholm\Psr7\Response;
trait CanMockHandler
{
private function mockHandler(callable $assertion = null): RequestHandlerInterface
return new class($assertion) implements RequestHandlerInterface
/** @var callable */
private $assertion;
public function __construct(?callable $assertion)
$this->assertion = $assertion ?? function ($request) {
$request
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
$this->assertion = $assertion ?? function (/** @scrutinizer ignore-unused */ $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 true;
};
}
public function handle(ServerRequestInterface $request): ResponseInterface
return new Response(($this->assertion)($request) ? 200 : 400);
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.