Skip to content

Commit f95097d

Browse files
authored
Merge pull request #475 from php-http/alias
add autowiring alias
2 parents 2b25608 + 34957a1 commit f95097d

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee
2525
- Removed the `Http\Client\HttpClient` alias use the `Psr\Http\Client\ClientInterface` typehint in your services for autowiring.
2626
- Changed classes marked as `@final` to be actually `final`. If you extended any of those, instead implement interfaces or decorate the class rather than extending it. Open an issue if you think a class needs to be made non-final to discuss what we should do.
2727
- Added return type declaration to `Http\HttplugBundle\ClientFactory\ClientFactory::createClient`
28+
- Added interface name alias for the `Http\Mock\Client` and all PSR17 factories to help with autowiring.
2829

2930
# Version 1
3031

Diff for: src/Resources/config/mock-client.xml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
<services>
77
<service id="httplug.client.mock" class="Http\Mock\Client" public="true" />
8+
<service id="Http\Mock\Client" alias="httplug.client.mock" public="true"/>
89
<service id="httplug.factory.mock" class="Http\HttplugBundle\ClientFactory\MockFactory" public="false">
910
<call method="setClient">
1011
<argument type="service" id="httplug.client.mock" />

Diff for: src/Resources/config/services.xml

+11
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,32 @@
4141
<service id="httplug.psr17_request_factory.default" class="Psr\Http\Message\RequestFactoryInterface">
4242
<factory class="Http\Discovery\Psr17FactoryDiscovery" method="findRequestFactory" />
4343
</service>
44+
<service id="Psr\Http\Message\RequestFactoryInterface" alias="httplug.psr17_request_factory.default" public="true"/>
45+
4446
<service id="httplug.psr17_response_factory.default" class="Psr\Http\Message\ResponseFactoryInterface">
4547
<factory class="Http\Discovery\Psr17FactoryDiscovery" method="findResponseFactory" />
4648
</service>
49+
<service id="Psr\Http\Message\ResponseFactoryInterface" alias="httplug.psr17_response_factory.default" public="true"/>
50+
4751
<service id="httplug.psr17_stream_factory.default" class="Psr\Http\Message\StreamFactoryInterface">
4852
<factory class="Http\Discovery\Psr17FactoryDiscovery" method="findStreamFactory" />
4953
</service>
54+
<service id="Psr\Http\Message\StreamFactoryInterface" alias="httplug.psr17_stream_factory.default" public="true"/>
55+
5056
<service id="httplug.psr17_uri_factory.default" class="Psr\Http\Message\UriFactoryInterface">
5157
<factory class="Http\Discovery\Psr17FactoryDiscovery" method="findUrlFactory" />
5258
</service>
59+
<service id="Psr\Http\Message\UriFactoryInterface" alias="httplug.psr17_uri_factory.default" public="true"/>
60+
5361
<service id="httplug.psr17_uploaded_file_factory.default" class="Psr\Http\Message\UploadedFileFactoryInterface">
5462
<factory class="Http\Discovery\Psr17FactoryDiscovery" method="findUploadedFileFactory" />
5563
</service>
64+
<service id="Psr\Http\Message\UploadedFileFactoryInterface" alias="httplug.psr17_uploaded_file_factory.default" public="true"/>
65+
5666
<service id="httplug.psr17_server_request_factory.default" class="Psr\Http\Message\ServerRequestFactoryInterface">
5767
<factory class="Http\Discovery\Psr17FactoryDiscovery" method="findServerRequestFactory" />
5868
</service>
69+
<service id="Psr\Http\Message\ServerRequestFactoryInterface" alias="httplug.psr17_server_request_factory.default" public="true"/>
5970

6071
<!-- PluginClientFactory -->
6172
<service id="Http\Client\Common\PluginClientFactory" class="Http\Client\Common\PluginClientFactory" public="false" />

0 commit comments

Comments
 (0)