Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate HttplugFactory and make dependency on php-http/message-factory optional #243

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
- Make depencendy on php-http/message-factory optional

## 1.7.0

- Bump to PHP 7.2 minimum
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
"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/psr7-integration-tests": "^1.0@dev",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.4",
"php-http/message-factory": "^1.0",
"php-http/psr7-integration-tests": "^1.0",
"http-interop/http-factory-tests": "^0.9",
"symfony/error-handler": "^4.4"
},
Expand All @@ -43,7 +43,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.7-dev"
"dev-master": "1.8-dev"
}
}
}
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