Skip to content

Commit 36a8065

Browse files
Deprecate DiactorosFactory, use nyholm/psr7 for tests
1 parent 5076934 commit 36a8065

File tree

4 files changed

+13
-18
lines changed

4 files changed

+13
-18
lines changed

Factory/DiactorosFactory.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Bridge\PsrHttpMessage\Factory;
1313

14+
@trigger_error(sprintf('The "%s" class is deprecated since symfony/psr-http-message-bridge 1.2, use PsrHttpFactory instea.', DiactorosFactory::class), E_USER_DEPRECATED);
15+
1416
use Psr\Http\Message\UploadedFileInterface;
1517
use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface;
1618
use Symfony\Component\HttpFoundation\BinaryFileResponse;
@@ -28,6 +30,8 @@
2830
* Builds Psr\HttpMessage instances using the Zend Diactoros implementation.
2931
*
3032
* @author Kévin Dunglas <dunglas@gmail.com>
33+
*
34+
* @deprecated since symfony/psr-http-message-bridge 1.2, use PsrHttpFactory instead
3135
*/
3236
class DiactorosFactory implements HttpMessageFactoryInterface
3337
{

Tests/Factory/DiactorosFactoryTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
/**
1717
* @author Kévin Dunglas <dunglas@gmail.com>
1818
* @author Antonio J. García Lagar <aj@garcialagar.es>
19+
*
20+
* @group legacy
1921
*/
2022
class DiactorosFactoryTest extends AbstractHttpMessageFactoryTest
2123
{

Tests/Factory/PsrHttpFactoryTest.php

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111

1212
namespace Symfony\Bridge\PsrHttpMessage\Tests\Factory;
1313

14-
use Http\Factory\Diactoros\ResponseFactory;
15-
use Http\Factory\Diactoros\ServerRequestFactory;
16-
use Http\Factory\Diactoros\StreamFactory;
17-
use Http\Factory\Diactoros\UploadedFileFactory;
14+
use Nyholm\Psr7\Factory\Psr17Factory;
1815
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
1916

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

32-
return new PsrHttpFactory(
33-
new ServerRequestFactory(),
34-
new StreamFactory(),
35-
new UploadedFileFactory(),
36-
new ResponseFactory()
37-
);
27+
return new PsrHttpFactory($factory, $factory, $factory, $factory);
3828
}
3929
}

composer.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "symfony/psr-http-message-bridge",
33
"type": "symfony-bridge",
44
"description": "PSR HTTP message bridge",
5-
"keywords": ["http", "psr-7", "http-message"],
5+
"keywords": ["http", "psr-7", "psr-17", "http-message"],
66
"homepage": "http://symfony.com",
77
"license": "MIT",
88
"authors": [
@@ -21,12 +21,11 @@
2121
"symfony/http-foundation": "^2.3.42 || ^3.4 || ^4.0"
2222
},
2323
"require-dev": {
24-
"symfony/phpunit-bridge": "^3.4 || 4.0"
24+
"symfony/phpunit-bridge": "^3.4 || ^4.0",
25+
"nyholm/psr7": "^1.1"
2526
},
2627
"suggest": {
27-
"psr/http-message-implementation": "To use the HttpFoundation factory",
28-
"zendframework/zend-diactoros": "To use the Zend Diactoros factory",
29-
"psr/http-factory-implementation": "To use the PSR-17 factory"
28+
"nyholm/psr7": "For a super lightweight PSR-7/17 implementation"
3029
},
3130
"autoload": {
3231
"psr-4": { "Symfony\\Bridge\\PsrHttpMessage\\": "" }

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy