Skip to content

Commit 8db16da

Browse files
Nyholmsagikazarmark
authored andcommitted
Moved statement outside of try-catch to improve readability. (#73)
* Moved statement outside of try-catch to improve readability. * style
1 parent 96fc219 commit 8db16da

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/HttpAsyncClientDiscovery.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ public static function find()
2323
{
2424
try {
2525
$asyncClient = static::findOneByType(HttpAsyncClient::class);
26-
27-
return static::instantiateClass($asyncClient);
2826
} catch (DiscoveryFailedException $e) {
2927
throw new NotFoundException(
3028
'No HTTPlug async clients found. Make sure to install a package providing "php-http/async-client-implementation". Example: "php-http/guzzle6-adapter".',
3129
0,
3230
$e
3331
);
3432
}
33+
34+
return static::instantiateClass($asyncClient);
3535
}
3636
}

src/HttpClientDiscovery.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ public static function find()
2323
{
2424
try {
2525
$client = static::findOneByType(HttpClient::class);
26-
27-
return static::instantiateClass($client);
2826
} catch (DiscoveryFailedException $e) {
2927
throw new NotFoundException(
3028
'No HTTPlug clients found. Make sure to install a package providing "php-http/client-implementation". Example: "php-http/guzzle6-adapter".',
3129
0,
3230
$e
3331
);
3432
}
33+
34+
return static::instantiateClass($client);
3535
}
3636
}

src/MessageFactoryDiscovery.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ public static function find()
2323
{
2424
try {
2525
$messageFactory = static::findOneByType(MessageFactory::class);
26-
27-
return static::instantiateClass($messageFactory);
2826
} catch (DiscoveryFailedException $e) {
2927
throw new NotFoundException(
3028
'No message factories found. To use Guzzle or Diactoros factories install php-http/message and the chosen message implementation.',
3129
0,
3230
$e
3331
);
3432
}
33+
34+
return static::instantiateClass($messageFactory);
3535
}
3636
}

src/StreamFactoryDiscovery.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ public static function find()
2323
{
2424
try {
2525
$streamFactory = static::findOneByType(StreamFactory::class);
26-
27-
return static::instantiateClass($streamFactory);
2826
} catch (DiscoveryFailedException $e) {
2927
throw new NotFoundException(
3028
'No stream factories found. To use Guzzle or Diactoros factories install php-http/message and the chosen message implementation.',
3129
0,
3230
$e
3331
);
3432
}
33+
34+
return static::instantiateClass($streamFactory);
3535
}
3636
}

src/UriFactoryDiscovery.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ public static function find()
2323
{
2424
try {
2525
$uriFactory = static::findOneByType(UriFactory::class);
26-
27-
return static::instantiateClass($uriFactory);
2826
} catch (DiscoveryFailedException $e) {
2927
throw new NotFoundException(
3028
'No uri factories found. To use Guzzle or Diactoros factories install php-http/message and the chosen message implementation.',
3129
0,
3230
$e
3331
);
3432
}
33+
34+
return static::instantiateClass($uriFactory);
3535
}
3636
}

0 commit comments

Comments
 (0)