Skip to content

Commit

Permalink
Deprecate DiactorosFactory, use nyholm/psr7 for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Mar 11, 2019
1 parent 5076934 commit 36a8065
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
4 changes: 4 additions & 0 deletions Factory/DiactorosFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace Symfony\Bridge\PsrHttpMessage\Factory;

@trigger_error(sprintf('The "%s" class is deprecated since symfony/psr-http-message-bridge 1.2, use PsrHttpFactory instea.', DiactorosFactory::class), E_USER_DEPRECATED);

use Psr\Http\Message\UploadedFileInterface;
use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
Expand All @@ -28,6 +30,8 @@
* Builds Psr\HttpMessage instances using the Zend Diactoros implementation.
*
* @author Kévin Dunglas <dunglas@gmail.com>
*
* @deprecated since symfony/psr-http-message-bridge 1.2, use PsrHttpFactory instead
*/
class DiactorosFactory implements HttpMessageFactoryInterface
{
Expand Down
2 changes: 2 additions & 0 deletions Tests/Factory/DiactorosFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
/**
* @author Kévin Dunglas <dunglas@gmail.com>
* @author Antonio J. García Lagar <aj@garcialagar.es>
*
* @group legacy
*/
class DiactorosFactoryTest extends AbstractHttpMessageFactoryTest
{
Expand Down
16 changes: 3 additions & 13 deletions Tests/Factory/PsrHttpFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@

namespace Symfony\Bridge\PsrHttpMessage\Tests\Factory;

use Http\Factory\Diactoros\ResponseFactory;
use Http\Factory\Diactoros\ServerRequestFactory;
use Http\Factory\Diactoros\StreamFactory;
use Http\Factory\Diactoros\UploadedFileFactory;
use Nyholm\Psr7\Factory\Psr17Factory;
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;

/**
Expand All @@ -25,15 +22,8 @@ class PsrHttpFactoryTest extends AbstractHttpMessageFactoryTest
{
protected function buildHttpMessageFactory()
{
if (!class_exists('Http\Factory\Diactoros\ServerRequestFactory')) {
$this->markTestSkipped('HTTP Factory for Diactoros is not installed.');
}
$factory = new Psr17Factory();

return new PsrHttpFactory(
new ServerRequestFactory(),
new StreamFactory(),
new UploadedFileFactory(),
new ResponseFactory()
);
return new PsrHttpFactory($factory, $factory, $factory, $factory);
}
}
9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "symfony/psr-http-message-bridge",
"type": "symfony-bridge",
"description": "PSR HTTP message bridge",
"keywords": ["http", "psr-7", "http-message"],
"keywords": ["http", "psr-7", "psr-17", "http-message"],
"homepage": "http://symfony.com",
"license": "MIT",
"authors": [
Expand All @@ -21,12 +21,11 @@
"symfony/http-foundation": "^2.3.42 || ^3.4 || ^4.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^3.4 || 4.0"
"symfony/phpunit-bridge": "^3.4 || ^4.0",
"nyholm/psr7": "^1.1"
},
"suggest": {
"psr/http-message-implementation": "To use the HttpFoundation factory",
"zendframework/zend-diactoros": "To use the Zend Diactoros factory",
"psr/http-factory-implementation": "To use the PSR-17 factory"
"nyholm/psr7": "For a super lightweight PSR-7/17 implementation"
},
"autoload": {
"psr-4": { "Symfony\\Bridge\\PsrHttpMessage\\": "" }
Expand Down

0 comments on commit 36a8065

Please sign in to comment.