Skip to content

Commit

Permalink
Added missing class exists checks (#31027)
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Jan 4, 2020
1 parent 15d6744 commit 1a45d9d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Illuminate/Routing/RoutingServiceProvider.php
Expand Up @@ -15,6 +15,7 @@
use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory;
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
use Zend\Diactoros\Response as ZendPsrResponse;
use Zend\Diactoros\ServerRequestFactory;

class RoutingServiceProvider extends ServiceProvider
{
Expand Down Expand Up @@ -132,14 +133,14 @@ protected function registerRedirector()
protected function registerPsrRequest()
{
$this->app->bind(ServerRequestInterface::class, function ($app) {
if (class_exists(PsrHttpFactory::class)) {
if (class_exists(Psr17Factory::class) && class_exists(PsrHttpFactory::class)) {
$psr17Factory = new Psr17Factory;

return (new PsrHttpFactory($psr17Factory, $psr17Factory, $psr17Factory, $psr17Factory))
->createRequest($app->make('request'));
}

if (class_exists(DiactorosFactory::class)) {
if (class_exists(ServerRequestFactory::class) && class_exists(DiactorosFactory::class)) {
return (new DiactorosFactory)->createRequest($app->make('request'));
}

Expand Down

0 comments on commit 1a45d9d

Please sign in to comment.