Skip to content

Commit

Permalink
Deprecate HttplugFactory and make depencendy on php-http/message-fact…
Browse files Browse the repository at this point in the history
…ory optional
  • Loading branch information
murat11 authored and nicolas-grekas committed Apr 27, 2023
1 parent 7f77c0e commit e19cf76
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to this project will be documented in this file, in reverse chronological order by release.

## 1.8.0

- Deprecate HttplugFactory, use Psr17Factory instead
- Move `php-http/message-factory` to an optional dependency

## 1.7.0

- Bump to PHP 7.2 minimum
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
"require": {
"php": ">=7.2",
"psr/http-message": "^1.1 || ^2.0",
"php-http/message-factory": "^1.0",
"psr/http-factory": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^7.5 || 8.5 || 9.4",
"php-http/message-factory": "^1.0",
"php-http/psr7-integration-tests": "^1.0@dev",
"http-interop/http-factory-tests": "^0.9",
"symfony/error-handler": "^4.4"
Expand Down
8 changes: 8 additions & 0 deletions src/Factory/HttplugFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,19 @@
use Psr\Http\Message\StreamInterface;
use Psr\Http\Message\UriInterface;

if (!\interface_exists(MessageFactory::class)) {
throw new \LogicException('You cannot use "Nyholm\Psr7\Factory\HttplugFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead');
}

@\trigger_error('Class "Nyholm\Psr7\Factory\HttplugFactory" is deprecated since version 1.8, use "Nyholm\Psr7\Factory\Psr17Factory" instead.', \E_USER_DEPRECATED);

/**
* @author Tobias Nyholm <[email protected]>
* @author Martijn van der Ven <[email protected]>
*
* @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
*
* @deprecated since version 1.8, use Psr17Factory instead
*/
class HttplugFactory implements MessageFactory, StreamFactory, UriFactory
{
Expand Down

0 comments on commit e19cf76

Please sign in to comment.