Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Utilize Symfony’s PSR Factory #31018

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Illuminate/Routing/RoutingServiceProvider.php
Expand Up @@ -2,6 +2,7 @@

namespace Illuminate\Routing;

use Exception;
use Illuminate\Contracts\Routing\ResponseFactory as ResponseFactoryContract;
use Illuminate\Contracts\Routing\UrlGenerator as UrlGeneratorContract;
use Illuminate\Contracts\View\Factory as ViewFactoryContract;
Expand Down Expand Up @@ -137,9 +138,12 @@ protected function registerPsrRequest()
return (new PsrHttpFactory($psr17Factory, $psr17Factory, $psr17Factory, $psr17Factory))
->createRequest($app->make('request'));
}

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

throw new Exception('Unable to resolve PSR request. Please install nyholm/psr7 or laminas/laminas-diactoros.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably replace this message with:

Unable to resolve PSR request. Please install symfony/psr-http-message-bridge.

Copy link
Author

@ivannovak ivannovak Jan 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should be both since that Psr17Factory comes from the nyholm package?

Unable to resolve PSR request. Please install symfony/psr-http-message-bridge and nyholm/psr7.

});
}

Expand All @@ -154,9 +158,12 @@ protected function registerPsrResponse()
if (class_exists(NyholmPsrResponse::class)) {
return new NyholmPsrResponse;
}

if (class_exists(ZendPsrResponse::class)) {
return new ZendPsrResponse;
}
GrahamCampbell marked this conversation as resolved.
Show resolved Hide resolved

throw new Exception('Unable to resolve PSR response. Please install nyholm/psr7 or laminas/laminas-diactoros.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're not actually supporting zendframework/zend-diactoros as per the previous discussion, and the zend stuff is now deprecated, maybe we should only recommend nyholm/psr7 here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, we'll have:

Unable to resolve PSR response. Please install nyholm/psr7.

});
}

Expand Down