Skip to content

Commit 32ecb92

Browse files
committed
psr2 fixes, silence deprecation notices and remove SymfonyPHPUnitBridge
1 parent dbff7b9 commit 32ecb92

File tree

3 files changed

+56
-14
lines changed

3 files changed

+56
-14
lines changed

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
"satooshi/php-coveralls": "0.6.*",
2020
"php-http/message": "^1.0",
2121
"php-http/guzzle6-adapter": "^1.0",
22-
"jakub-onderka/php-parallel-lint": "0.8.*",
23-
"symfony/phpunit-bridge": "^3.1"
22+
"jakub-onderka/php-parallel-lint": "0.8.*"
2423
},
2524
"keywords": [
2625
"oauth",

src/Provider/AbstractProvider.php

Lines changed: 55 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ abstract class AbstractProvider
9999
/**
100100
* The options given to the Guzzle6 client
101101
* @var array
102-
* @deprecated These are to be removed in the next major release. These options are only used in getHttpClient to keep BC.
102+
* @deprecated These are to be removed in the next major release.
103+
* These options are only used in getHttpClient to keep BC.
103104
*/
104105
private $guzzle6Options = [];
105106

@@ -221,16 +222,36 @@ public function getRequestFactory()
221222
public function setHttpClient($client)
222223
{
223224
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);
225+
@trigger_error(
226+
sprintf(
227+
'Passing a "%s" to "%s::setHttpClient" is deprecated. Use a "Http\Client\HttpClient" instead.',
228+
GuzzleClientInterface::class,
229+
static::class
230+
),
231+
E_USER_DEPRECATED
232+
);
225233
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));
234+
throw new \RuntimeException(
235+
sprintf(
236+
'You must install "php-http/guzzle6-adapter" to be able to pass a "%s" to "%s::setHttpClient".',
237+
GuzzleClientInterface::class,
238+
static::class
239+
)
240+
);
227241
}
228242
$client = new HttplugGuzzle6($client);
229243
}
230244

231245
if (!$client instanceof HttpClient) {
232246
$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));
247+
throw new \RuntimeException(
248+
sprintf(
249+
'First parameter to "%s::setHttpClient" was expected to be a "%s", you provided a "%s"',
250+
static::class,
251+
HttpClient::class,
252+
$type
253+
)
254+
);
234255
}
235256

236257
$this->httpClient = $client;
@@ -255,14 +276,24 @@ public function getHttplugClient()
255276
*/
256277
public function getHttpClient()
257278
{
258-
trigger_error(sprintf('Using "%s::getHttpClient" is deprecated in favor for "%s::getHttplugClient".', static::class, static::class), E_USER_DEPRECATED);
279+
@trigger_error(
280+
sprintf(
281+
'Using "%s::getHttpClient" is deprecated in favor for "%s::getHttplugClient".',
282+
static::class,
283+
static::class
284+
),
285+
E_USER_DEPRECATED
286+
);
259287

260288
if ($this->guzzleClient !== null) {
261289
return $this->guzzleClient;
262290
}
263291

264292
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);
293+
throw new \RuntimeException(
294+
'You must install "php-http/guzzle6-adapter" to be able to use "%s::getHttplugClient".',
295+
static::class
296+
);
266297
}
267298

268299
return new GuzzleClient($this->guzzle6Options);
@@ -899,23 +930,36 @@ private function getHttpClientFromOptions(array $options, array $collaborators)
899930
if (empty($guzzle6Options)) {
900931
return HttpClientDiscovery::find();
901932
} else {
902-
trigger_error('Passing options to Guzzle6 client is deprecated. Use "httplugClient" instead', E_USER_DEPRECATED);
933+
@trigger_error(
934+
'Passing options to Guzzle6 client is deprecated. Use "httplugClient" instead',
935+
E_USER_DEPRECATED
936+
);
903937
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.');
938+
throw new \RuntimeException(
939+
'You must install "php-http/guzzle6-adapter" to be able to pass options to the Guzzle6 client.'
940+
);
905941
}
906942
$this->guzzle6Options = $guzzle6Options;
943+
907944
return HttplugGuzzle6::createWithConfig($guzzle6Options);
908945
}
909946
}
910947

911-
trigger_error('The "httpClient" option is deprecated. Use "httplugClient" instead', E_USER_DEPRECATED);
948+
@trigger_error('The "httpClient" option is deprecated. Use "httplugClient" instead', E_USER_DEPRECATED);
912949
$client = $collaborators['httpClient'];
913950
if (!$client instanceof GuzzleClientInterface) {
914-
throw new \RuntimeException(sprintf('The value provided with option "HttpClient" must be instance of "%s".', GuzzleClientInterface::class));
951+
throw new \RuntimeException(
952+
sprintf(
953+
'The value provided with option "HttpClient" must be instance of "%s".',
954+
GuzzleClientInterface::class
955+
)
956+
);
915957
}
916958

917959
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.');
960+
throw new \RuntimeException(
961+
'You must install "php-http/guzzle6-adapter" to pass a Guzzle6 client with the "httpClient" option.'
962+
);
919963
}
920964

921965
$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)