Skip to content

Add autowiring for HTTPlug #32104

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
Jun 22, 2019
Merged

Add autowiring for HTTPlug #32104

merged 1 commit into from
Jun 22, 2019

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Jun 19, 2019

Q A
Branch? 4.4
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR symfony/symfony-docs#11820

@fabpot
Copy link
Member

fabpot commented Jun 20, 2019

Not a big fan of having HttpPlug code in FWB. It should be in a bridge/bundle, but not in the framework which is only about our code.

@nicolas-grekas
Copy link
Member Author

nicolas-grekas commented Jun 20, 2019

I removed the named autowiring aliases because they make no sense actually - nobody should code against HTTPlug anymore.
But since many libs still consume HTTPlug, and since we provide an HttplugClient to ease moving the ecosystem forward, it makes sense to me to have the generic autowiring alias.

I considered moving this to a recipe, but it would need two packages to be applicable (php-http/httplug and symfony/http-client), so that we cannot have one that fits both conditions. Creating a pack would make no sense since the goal of HTTPlug its to fade out now that PSR18 is released.

Moving HttplugClient to the php-http org is possible.
But yet another package :(
While a few lines here make everything so much simpler...

@nicolas-grekas nicolas-grekas force-pushed the wire-httplug branch 2 times, most recently from 2bdfb41 to 21ed826 Compare June 20, 2019 07:04
@@ -22,5 +22,11 @@
<argument type="service" id="Psr\Http\Message\StreamFactoryInterface" on-invalid="ignore" />
</service>
<service id="Psr\Http\Client\ClientInterface" alias="psr18.http_client" />

<service id="Http\Client\HttpClient" class="Symfony\Component\HttpClient\HttplugClient">
Copy link
Member Author

Choose a reason for hiding this comment

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

not an alias so that it's not listed in debug:autowiring - no need to promote the alias for autowiring

->setAutowired(true)
->setArguments([new Reference($name)]);
$container->setDefinition('psr18.'.$name, new ChildDefinition('psr18.http_client'))
->replaceArgument(0, new Reference($name));
Copy link
Member Author

Choose a reason for hiding this comment

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

this change is not related to httplug - it's just better way to wire the psr18 named aliases

@nicolas-grekas nicolas-grekas changed the title Create autowiring aliases for HTTPlug Add autowiring for HTTPlug Jun 20, 2019
@fabpot
Copy link
Member

fabpot commented Jun 22, 2019

Thank you @nicolas-grekas.

@fabpot fabpot merged commit f76e77d into symfony:4.4 Jun 22, 2019
fabpot added a commit that referenced this pull request Jun 22, 2019
This PR was merged into the 4.4 branch.

Discussion
----------

Add autowiring for HTTPlug

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

Commits
-------

f76e77d Add autowiring for HTTPlug
@nicolas-grekas nicolas-grekas deleted the wire-httplug branch June 24, 2019 09:11
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.4 Oct 27, 2019
This was referenced Nov 12, 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.

3 participants