Skip to content

Commit

Permalink
Merge pull request #262 from php-http/fix-build
Browse files Browse the repository at this point in the history
fix build
  • Loading branch information
dbu committed Mar 28, 2024
2 parents 6b5f57f + 261b096 commit 7fbed2f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Change Log

## 1.19.3 - 2024-03-28

- [#261](https://github.com/php-http/discovery/pull/261) - explicitly mark nullable parameters as nullable (avoid deprecation in PHP 8.4)

## 1.19.2 - 2023-11-30

- [#253](https://github.com/php-http/discovery/pull/253) - Symfony 7 dropped the deprecated PHP-HTTP `HttpClient` interface from their HTTP client, do not discover the version 7 client when lookig for the old interface.
- [#253](https://github.com/php-http/discovery/pull/253) - Symfony 7 dropped the deprecated PHP-HTTP `HttpClient` interface from their HTTP client, do not discover the version 7 client when looking for the old interface.

## 1.19.1 - 2023-07-11

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"php-http/httplug": "^1.0 || ^2.0",
"php-http/message-factory": "^1.0",
"phpspec/phpspec": "^5.1 || ^6.1 || ^7.3",
"symfony/phpunit-bridge": "^6.2"
"symfony/phpunit-bridge": "^6.4.4 || ^7.0.1"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 3 additions & 1 deletion src/NotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

namespace Http\Discovery;

use Http\Discovery\Exception\NotFoundException as RealNotFoundException;

/**
* Thrown when a discovery does not find any matches.
*
* @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
*
* @deprecated since since version 1.0, and will be removed in 2.0. Use {@link \Http\Discovery\Exception\NotFoundException} instead.
*/
final class NotFoundException extends \Http\Discovery\Exception\NotFoundException
final class NotFoundException extends RealNotFoundException
{
}
17 changes: 9 additions & 8 deletions src/Psr17FactoryDiscovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Http\Discovery;

use Http\Discovery\Exception\DiscoveryFailedException;
use Http\Discovery\Exception\NotFoundException as RealNotFoundException;
use Psr\Http\Message\RequestFactoryInterface;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\ServerRequestFactoryInterface;
Expand All @@ -19,7 +20,7 @@ final class Psr17FactoryDiscovery extends ClassDiscovery
{
private static function createException($type, Exception $e)
{
return new \Http\Discovery\Exception\NotFoundException(
return new RealNotFoundException(
'No PSR-17 '.$type.' found. Install a package from this list: https://packagist.org/providers/psr/http-factory-implementation',
0,
$e
Expand All @@ -29,7 +30,7 @@ private static function createException($type, Exception $e)
/**
* @return RequestFactoryInterface
*
* @throws Exception\NotFoundException
* @throws RealNotFoundException
*/
public static function findRequestFactory()
{
Expand All @@ -45,7 +46,7 @@ public static function findRequestFactory()
/**
* @return ResponseFactoryInterface
*
* @throws Exception\NotFoundException
* @throws RealNotFoundException
*/
public static function findResponseFactory()
{
Expand All @@ -61,7 +62,7 @@ public static function findResponseFactory()
/**
* @return ServerRequestFactoryInterface
*
* @throws Exception\NotFoundException
* @throws RealNotFoundException
*/
public static function findServerRequestFactory()
{
Expand All @@ -77,7 +78,7 @@ public static function findServerRequestFactory()
/**
* @return StreamFactoryInterface
*
* @throws Exception\NotFoundException
* @throws RealNotFoundException
*/
public static function findStreamFactory()
{
Expand All @@ -93,7 +94,7 @@ public static function findStreamFactory()
/**
* @return UploadedFileFactoryInterface
*
* @throws Exception\NotFoundException
* @throws RealNotFoundException
*/
public static function findUploadedFileFactory()
{
Expand All @@ -109,7 +110,7 @@ public static function findUploadedFileFactory()
/**
* @return UriFactoryInterface
*
* @throws Exception\NotFoundException
* @throws RealNotFoundException
*/
public static function findUriFactory()
{
Expand All @@ -125,7 +126,7 @@ public static function findUriFactory()
/**
* @return UriFactoryInterface
*
* @throws Exception\NotFoundException
* @throws RealNotFoundException
*
* @deprecated This will be removed in 2.0. Consider using the findUriFactory() method.
*/
Expand Down
5 changes: 3 additions & 2 deletions src/Psr18ClientDiscovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Http\Discovery;

use Http\Discovery\Exception\DiscoveryFailedException;
use Http\Discovery\Exception\NotFoundException as RealNotFoundException;
use Psr\Http\Client\ClientInterface;

/**
Expand All @@ -17,14 +18,14 @@ final class Psr18ClientDiscovery extends ClassDiscovery
*
* @return ClientInterface
*
* @throws Exception\NotFoundException
* @throws RealNotFoundException
*/
public static function find()
{
try {
$client = static::findOneByType(ClientInterface::class);
} catch (DiscoveryFailedException $e) {
throw new \Http\Discovery\Exception\NotFoundException('No PSR-18 clients found. Make sure to install a package providing "psr/http-client-implementation". Example: "php-http/guzzle7-adapter".', 0, $e);
throw new RealNotFoundException('No PSR-18 clients found. Make sure to install a package providing "psr/http-client-implementation". Example: "php-http/guzzle7-adapter".', 0, $e);
}

return static::instantiateClass($client);
Expand Down

0 comments on commit 7fbed2f

Please sign in to comment.