Skip to content

Commit

Permalink
Fix issues raised by Scrutinizer
Browse files Browse the repository at this point in the history
  • Loading branch information
rougin committed Apr 3, 2016
1 parent 4728437 commit 8018bc6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/Dispatching/FastRoute/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace Rougin\Slytherin\Dispatching\FastRoute;

use Closure;
use FastRoute;
use UnexpectedValueException;
use FastRoute\Dispatcher as FastRouteDispatcher;

use Rougin\Slytherin\Dispatching\RouterInterface;
use Rougin\Slytherin\Dispatching\DispatcherInterface;

/**
Expand All @@ -27,11 +27,11 @@ class Dispatcher implements DispatcherInterface
protected $dispatcher;

/**
* @param \Rougin\Slytherin\Dispatching\RouterInterface $router
* @param \Rougin\Slytherin\Dispatching\FastRoute\Router $router
*/
public function __construct(RouterInterface $router)
public function __construct(Router $router)
{
$this->dispatcher = \FastRoute\simpleDispatcher($router->getRoutes());
$this->dispatcher = FastRoute\simpleDispatcher($router->getRoutes());
}

/**
Expand Down
12 changes: 6 additions & 6 deletions src/Http/HttpFoundationFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ public function createRequest(ServerRequestInterface $psrRequest)
$server = array_replace($server, $psrRequest->getServerParams());

return new Request(
$psrRequest->getQueryParams(),
$psrRequest->getParsedBody(),
$psrRequest->getAttributes(),
$psrRequest->getCookieParams(),
$psrRequest->getUploadedFiles(),
$server,
(array) $psrRequest->getQueryParams(),
(array) $psrRequest->getParsedBody(),
(array) $psrRequest->getAttributes(),
(array) $psrRequest->getCookieParams(),
(array) $psrRequest->getUploadedFiles(),
(array) $server,
$psrRequest->getBody()->__toString()
);
}
Expand Down
17 changes: 17 additions & 0 deletions tests/Debug/WhoopsDebuggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,23 @@ public function testSetHandlerMethod()
);
}

/**
* Tests if the specified handler is in the debugger's list of handlers.
*
* @return void
*/
public function testSetHandlerMethodWithCallback()
{
$this->debugger->setHandler(function () {
return 'Hello';
});

$this->assertInstanceOf(
'Whoops\Handler\CallbackHandler',
$this->debugger->getHandlers()[0]
);
}

/**
* Tests the display() method.
*
Expand Down

0 comments on commit 8018bc6

Please sign in to comment.