Skip to content
This repository has been archived by the owner on Feb 24, 2023. It is now read-only.

Remove PSR-7 support #710

Merged
merged 1 commit into from Jan 20, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,11 @@
CHANGELOG
=========

6.0
---

* Remove PSR-7 support

5.6
---

Expand Down
4 changes: 1 addition & 3 deletions composer.json
Expand Up @@ -22,7 +22,6 @@
"doctrine/dbal": "^2.10|^3.0",
"doctrine/doctrine-bundle": "^1.11|^2.0",
"doctrine/orm": "^2.5",
"nyholm/psr7": "^1.1",
"symfony/browser-kit": "^4.4|^5.0",
"symfony/doctrine-bridge": "^4.4|^5.0",
"symfony/dom-crawler": "^4.4|^5.0",
Expand All @@ -31,7 +30,6 @@
"symfony/monolog-bundle": "^3.2",
"symfony/monolog-bridge": "^4.0|^5.0",
"symfony/phpunit-bridge": "^4.4.9|^5.0.9",
"symfony/psr-http-message-bridge": "^1.1",
"symfony/security-bundle": "^4.4|^5.0",
"symfony/twig-bundle": "^4.4|^5.0",
"symfony/yaml": "^4.4|^5.0",
Expand All @@ -58,7 +56,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "5.6.x-dev"
"dev-master": "6.0.x-dev"
}
}
}
7 changes: 0 additions & 7 deletions src/DependencyInjection/Configuration.php
Expand Up @@ -11,7 +11,6 @@

namespace Sensio\Bundle\FrameworkExtraBundle\DependencyInjection;

use Symfony\Bridge\PsrHttpMessage\HttpFoundationFactoryInterface;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\NodeInterface;
Expand Down Expand Up @@ -74,12 +73,6 @@ public function getConfigTreeBuilder()
->scalarNode('expression_language')->defaultValue('sensio_framework_extra.security.expression_language.default')->end()
->end()
->end()
->arrayNode('psr_message')
->addDefaultsIfNotSet()
->children()
->booleanNode('enabled')->defaultValue(interface_exists(HttpFoundationFactoryInterface::class))->end()
->end()
->end()
->arrayNode('templating')
->fixXmlConfig('controller_pattern')
->children()
Expand Down
9 changes: 0 additions & 9 deletions src/DependencyInjection/SensioFrameworkExtraExtension.php
Expand Up @@ -11,7 +11,6 @@

namespace Sensio\Bundle\FrameworkExtraBundle\DependencyInjection;

use Psr\Http\Message\StreamFactoryInterface;
use Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterInterface;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Resource\ClassExistenceResource;
Expand Down Expand Up @@ -103,14 +102,6 @@ public function load(array $configs, ContainerBuilder $container)
->addArgument($config['templating']['controller_patterns']);
}

if ($config['psr_message']['enabled']) {
$loader->load('psr7.xml');

if (!interface_exists(StreamFactoryInterface::class)) {
$definitionsToRemove[] = 'sensio_framework_extra.psr7.argument_value_resolver.server_request';
}
}

foreach ($definitionsToRemove as $definition) {
$container->removeDefinition($definition);
}
Expand Down
60 changes: 0 additions & 60 deletions src/EventListener/PsrResponseListener.php

This file was deleted.

54 changes: 0 additions & 54 deletions src/Request/ArgumentValueResolver/Psr7ServerRequestResolver.php

This file was deleted.

36 changes: 0 additions & 36 deletions src/Resources/config/psr7.xml

This file was deleted.

44 changes: 0 additions & 44 deletions src/Resources/doc/index.rst
Expand Up @@ -35,7 +35,6 @@ The default configuration is as follow:
view: { annotations: true }
cache: { annotations: true }
security: { annotations: true }
psr_message: { enabled: false } # Defaults to true if the PSR-7 bridge is installed


.. code-block:: xml
Expand All @@ -47,7 +46,6 @@ The default configuration is as follow:
<view annotations="true" />
<cache annotations="true" />
<security annotations="true" />
<psr-message enabled="false" /> <!-- Defaults to true if the PSR-7 bridge is installed -->
</sensio-framework-extra:config>

.. code-block:: php
Expand All @@ -59,7 +57,6 @@ The default configuration is as follow:
'view' => array('annotations' => true),
'cache' => array('annotations' => true),
'security' => array('annotations' => true),
'psr_message' => array('enabled' => false), // Defaults to true if the PSR-7 bridge is installed
));

You can disable some annotations and conventions by defining one or more
Expand Down Expand Up @@ -162,45 +159,4 @@ example:
resource: "@AnnotRoutingBundle/Controller"
type: annotation

PSR-7 support
-------------

SensioFrameworkExtraBundle provides support for HTTP messages interfaces defined
in `PSR-7`_. It allows to inject instances of ``Psr\Http\Message\ServerRequestInterface``
and to return instances of ``Psr\Http\Message\ResponseInterface`` in controllers.

To enable this feature, `the HttpFoundation to PSR-7 bridge`_ and `autowiring
aliases for PSR-17`_ must be installed:

.. code-block:: bash

$ composer require symfony/psr-http-message-bridge nyholm/psr7

Then, PSR-7 messages can be used directly in controllers like in the following code
snippet::

namespace AppBundle\Controller;

use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\ServerRequestInterface;

class DefaultController
{
public function index(ServerRequestInterface $request, ResponseFactoryInterface $responseFactory)
{
// Interact with the PSR-7 request

$response = $responseFactory->createResponse();
// Interact with the PSR-7 response

return $response;
}
}

Note that internally, Symfony always use :class:`Symfony\\Component\\HttpFoundation\\Request`
and :class:`Symfony\\Component\\HttpFoundation\\Response` instances.

.. _`SensioFrameworkExtraBundle`: https://github.com/sensiolabs/SensioFrameworkExtraBundle
.. _`PSR-7`: http://www.php-fig.org/psr/psr-7/
.. _`the HttpFoundation to PSR-7 bridge`: https://github.com/symfony/psr-http-message-bridge
.. _`autowiring aliases for PSR-17`: https://github.com/symfony/recipes/blob/master/nyholm/psr7/1.0/config/packages/nyholm_psr7.yaml
53 changes: 0 additions & 53 deletions tests/EventListener/PsrResponseListenerTest.php

This file was deleted.

18 changes: 0 additions & 18 deletions tests/Fixtures/ActionArgumentsBundle/ActionArgumentsBundle.php

This file was deleted.