Skip to content

Commit 090a977

Browse files
committed
psr2 fixes
1 parent dbff7b9 commit 090a977

File tree

2 files changed

+50
-10
lines changed

2 files changed

+50
-10
lines changed

src/Provider/AbstractProvider.php

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -221,16 +221,35 @@ public function getRequestFactory()
221221
public function setHttpClient($client)
222222
{
223223
if ($client instanceof GuzzleClientInterface) {
224-
trigger_error(sprintf('Passing a "%s" to "%s::setHttpClient" is deprecated. Please use a "Http\Client\HttpClient" instead.', GuzzleClientInterface::class, static::class), E_USER_DEPRECATED);
224+
trigger_error(
225+
sprintf(
226+
'Passing a "%s" to "%s::setHttpClient" is deprecated. Please use a "Http\Client\HttpClient" instead.',
227+
GuzzleClientInterface::class,
228+
static::class
229+
),
230+
E_USER_DEPRECATED
231+
);
225232
if (!class_exists(HttplugGuzzle6::class)) {
226-
throw new \RuntimeException(sprintf('You must install "php-http/guzzle6-adapter" to be able to pass a "%s" to "%s::setHttpClient".', GuzzleClientInterface::class, static::class));
233+
throw new \RuntimeException(
234+
sprintf(
235+
'You must install "php-http/guzzle6-adapter" to be able to pass a "%s" to "%s::setHttpClient".',
236+
GuzzleClientInterface::class,
237+
static::class
238+
)
239+
);
227240
}
228241
$client = new HttplugGuzzle6($client);
229242
}
230243

231244
if (!$client instanceof HttpClient) {
232245
$type = is_object($client) ? get_class($client) : gettype($client);
233-
throw new \RuntimeException(sprintf('First parameter to "%s::setHttpClient" was expected to be a "Http\Client\HttpClient", you provided a "%s"', static::class, $type));
246+
throw new \RuntimeException(
247+
sprintf(
248+
'First parameter to "%s::setHttpClient" was expected to be a "Http\Client\HttpClient", you provided a "%s"',
249+
static::class,
250+
$type
251+
)
252+
);
234253
}
235254

236255
$this->httpClient = $client;
@@ -255,14 +274,23 @@ public function getHttplugClient()
255274
*/
256275
public function getHttpClient()
257276
{
258-
trigger_error(sprintf('Using "%s::getHttpClient" is deprecated in favor for "%s::getHttplugClient".', static::class, static::class), E_USER_DEPRECATED);
277+
trigger_error(
278+
sprintf(
279+
'Using "%s::getHttpClient" is deprecated in favor for "%s::getHttplugClient".',
280+
static::class,
281+
static::class
282+
),
283+
E_USER_DEPRECATED
284+
);
259285

260286
if ($this->guzzleClient !== null) {
261287
return $this->guzzleClient;
262288
}
263289

264290
if (!class_exists(GuzzleClient::class)) {
265-
throw new \RuntimeException('You must install "php-http/guzzle6-adapter" to be able to use "%s::getHttplugClient".', static::class);
291+
throw new \RuntimeException(
292+
'You must install "php-http/guzzle6-adapter" to be able to use "%s::getHttplugClient".', static::class
293+
);
266294
}
267295

268296
return new GuzzleClient($this->guzzle6Options);
@@ -899,23 +927,36 @@ private function getHttpClientFromOptions(array $options, array $collaborators)
899927
if (empty($guzzle6Options)) {
900928
return HttpClientDiscovery::find();
901929
} else {
902-
trigger_error('Passing options to Guzzle6 client is deprecated. Use "httplugClient" instead', E_USER_DEPRECATED);
930+
trigger_error(
931+
'Passing options to Guzzle6 client is deprecated. Use "httplugClient" instead',
932+
E_USER_DEPRECATED
933+
);
903934
if (!class_exists(HttplugGuzzle6::class)) {
904-
throw new \RuntimeException('You must install "php-http/guzzle6-adapter" to be able to pass options to the Guzzle6 client.');
935+
throw new \RuntimeException(
936+
'You must install "php-http/guzzle6-adapter" to be able to pass options to the Guzzle6 client.'
937+
);
905938
}
906939
$this->guzzle6Options = $guzzle6Options;
940+
907941
return HttplugGuzzle6::createWithConfig($guzzle6Options);
908942
}
909943
}
910944

911945
trigger_error('The "httpClient" option is deprecated. Use "httplugClient" instead', E_USER_DEPRECATED);
912946
$client = $collaborators['httpClient'];
913947
if (!$client instanceof GuzzleClientInterface) {
914-
throw new \RuntimeException(sprintf('The value provided with option "HttpClient" must be instance of "%s".', GuzzleClientInterface::class));
948+
throw new \RuntimeException(
949+
sprintf(
950+
'The value provided with option "HttpClient" must be instance of "%s".',
951+
GuzzleClientInterface::class
952+
)
953+
);
915954
}
916955

917956
if (!class_exists(HttplugGuzzle6::class)) {
918-
throw new \RuntimeException('You must install "php-http/guzzle6-adapter" to be able to pass a Guzzle6 client with "httpClient" option.');
957+
throw new \RuntimeException(
958+
'You must install "php-http/guzzle6-adapter" to be able to pass a Guzzle6 client with "httpClient" option.'
959+
);
919960
}
920961

921962
$this->guzzleClient = $client;

src/Tool/RequestFactory.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Psr\Http\Message\RequestInterface;
1919
use Psr\Http\Message\StreamInterface;
2020

21-
2221
/**
2322
* Used to produce PSR-7 Request instances.
2423
*

0 commit comments

Comments
 (0)