Skip to content

Create an abstract HTTP transport and extend it in all HTTP transports #31650

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

Merged
merged 1 commit into from
May 28, 2019

Conversation

bocharsky-bw
Copy link
Contributor

Q A
Branch? 4.3
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets no
License MIT
Doc PR no

Right now when you try to use an HTTP transport e.g. Mailgun w/o HTTP client installed - the error message is:

Attempted to load class "HttpClient" from namespace "Symfony\Component\HttpClient".
Did you forget a "use" statement for "Http\Client\HttpClient"?

Not clear enough about what to do. After this PR the error message will be:

You cannot use "Symfony\Component\Mailer\Bridge\Mailgun\Http\MailgunTransport" as the HttpClient component is not installed. Try running "composer require symfony/http-client".

Actually, we already have a similar check for API:

$this->client = $client;
if (null === $client) {
if (!class_exists(HttpClient::class)) {
throw new \LogicException(sprintf('You cannot use "%s" as the HttpClient component is not installed. Try running "composer require symfony/http-client".', __CLASS__));
}
$this->client = HttpClient::create();
}

@bocharsky-bw bocharsky-bw changed the base branch from master to 4.3 May 28, 2019 11:44
@bocharsky-bw bocharsky-bw changed the base branch from 4.3 to master May 28, 2019 11:44
@bocharsky-bw bocharsky-bw changed the base branch from master to 4.3 May 28, 2019 11:51
@fabpot
Copy link
Member

fabpot commented May 28, 2019

Thank you @bocharsky-bw.

@fabpot fabpot merged commit 3c8d63c into symfony:4.3 May 28, 2019
fabpot added a commit that referenced this pull request May 28, 2019
…P transports (bocharsky-bw)

This PR was merged into the 4.3 branch.

Discussion
----------

Create an abstract HTTP transport and extend it in all HTTP transports

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | no
| License       | MIT
| Doc PR        | no

Right now when you try to use an HTTP transport e.g. Mailgun w/o HTTP client installed - the error message is:
> Attempted to load class "HttpClient" from namespace "Symfony\Component\HttpClient".
Did you forget a "use" statement for "Http\Client\HttpClient"?

Not clear enough about what to do. After this PR the error message will be:
> You cannot use "Symfony\Component\Mailer\Bridge\Mailgun\Http\MailgunTransport" as the HttpClient component is not installed. Try running "composer require symfony/http-client".

Actually, we already have a similar check for API:
https://github.com/symfony/symfony/blob/2c9a1960a164a857cd551881b580266bc77bdafa/src/Symfony/Component/Mailer/Transport/Http/Api/AbstractApiTransport.php#L37-L44

Commits
-------

3c8d63c Create an abstract HTTP transport and extend it in all HTTP transports
@bocharsky-bw bocharsky-bw deleted the patch-5 branch May 28, 2019 12:02
@fabpot fabpot mentioned this pull request May 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants