Skip to content

Commit 8ab0ed8

Browse files
authored
Merge pull request #625 from FriendsOfSymfony/cleanup-legacy-support
remove remaining legacy code and doc
2 parents f343e22 + 58c9ef4 commit 8ab0ed8

File tree

13 files changed

+16
-142
lines changed

13 files changed

+16
-142
lines changed

Resources/doc/features/tagging.rst

-10
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ To add tags to responses, use the ``ResponseTagger::addTags`` method::
7474
}
7575
}
7676

77-
.. versionadded:: 2.3.2
78-
Autowiring support has been added in version 2.3.2. In older versions of
79-
the bundle, you need to inject the service
80-
``fos_http_cache.http.symfony_response_tagger`` into your controller.
81-
8277
To invalidate tags, use the ``CacheManager::invalidateTags($tags)`` method::
8378

8479
use FOS\HttpCacheBundle\CacheManager;
@@ -100,11 +95,6 @@ To invalidate tags, use the ``CacheManager::invalidateTags($tags)`` method::
10095
}
10196
}
10297

103-
.. versionadded:: 2.3.2
104-
Autowiring support has been added in version 2.3.2. In older versions of
105-
the bundle, you need to inject the service ``fos_http_cache.cache_manager``
106-
in your controller.
107-
10898
Tagging from Twig Templates
10999
~~~~~~~~~~~~~~~~~~~~~~~~~~~
110100

Resources/doc/overview.rst

-17
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,6 @@ To install the bundle together with Symfony HttpClient, run:
1818
If you want to use something else than Symfony HttpClient, see Packagist for a list of
1919
available `client implementations`_.
2020

21-
If you use an old version of Symfony, you
22-
must manually register the bundle to your application:
23-
24-
.. code-block:: php
25-
26-
<?php
27-
// app/AppKernel.php
28-
29-
public function registerBundles()
30-
{
31-
$bundles = array(
32-
// ...
33-
new FOS\HttpCacheBundle\FOSHttpCacheBundle(),
34-
// ...
35-
);
36-
}
37-
3821
For most features, you also need to :ref:`configure a caching proxy <foshttpcache:proxy-configuration>`.
3922

4023
.. _requirements:

Resources/doc/reference/cache-manager.rst

-5
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ By *refreshing* a piece of content, a fresh copy will be fetched right away.
1818
The cache manager is available in the Symfony DI container using autowiring
1919
with the ``FOS\HttpCacheBundle\CacheManager`` class.
2020

21-
.. versionadded:: 2.3.2
22-
Autowiring support has been added in version 2.3.2. In older versions of
23-
the bundle, you need to explicitly use the service name
24-
``fos_http_cache.cache_manager``.
25-
2621
.. _cache manager invalidation:
2722

2823
``invalidatePath()``

Resources/doc/reference/configuration/headers.rst

+2-5
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@ way to determine if it was manually set. If the full header is only
136136
You can prevent the cache control on specific controller actions by calling
137137
``FOS\HttpCacheBundle\EventListener\CacheControlListener::setSkip()``. When
138138
skip is set to ``true``, no cache rules are applied. This service can be
139-
autowired - in older versions of the bundle, use the service
140-
``fos_http_cache.event_listener.cache_control``.
139+
autowired.
141140

142141
``cache_control``
143142
"""""""""""""""""
@@ -220,9 +219,7 @@ directives are flags that are included when set to true:
220219

221220
This enables a simplistic ETag calculated as md5 hash of the response body:
222221

223-
.. versionadded:: 2.2
224-
225-
You can set up ETag to be strong or weak by setting the option to "strong" or "weak" respectively.
222+
You can set up ETag to be strong or weak by setting the option to "strong" or "weak" respectively.
226223

227224
.. code-block:: yaml
228225

Resources/doc/reference/configuration/proxy-client.rst

+5-7
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,11 @@ refer to the :ref:`FOSHttpCache documentation for Symfony <foshttpcache:symfony
213213
214214
For ``servers``, ``base_url``, ``tags_header`` and ``header_length``, see above.
215215

216-
.. versionadded:: 2.3
217-
218-
You can omit the whole ``http`` configuration and use ``use_kernel_dispatcher: true``
219-
instead. This will call the kernel directly instead of executing a real
220-
HTTP request. Note that your kernel and bootstrapping need to be adjusted
221-
to support this feature. The setup is explained in the
222-
:ref:`Symfony HttpCache chapter <symfony_http_cache_kernel_dispatcher>`.
216+
You can omit the whole ``http`` configuration and use ``use_kernel_dispatcher: true``
217+
instead. This will call the kernel directly instead of executing a real
218+
HTTP request. Note that your kernel and bootstrapping need to be adjusted
219+
to support this feature. The setup is explained in the
220+
:ref:`Symfony HttpCache chapter <symfony_http_cache_kernel_dispatcher>`.
223221

224222
``tags_method``
225223
"""""""""""""""

Resources/doc/reference/configuration/user-context.rst

+5-10
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,6 @@ For the handler to work:
148148
* Symfony’s default behavior of regenerating the session id when users log in
149149
and out must be enabled (``invalidate_session``).
150150

151-
.. warning::
152-
The cache invalidation on logout only works correctly with FOSHttpCacheBundle 2.2 and later.
153-
It was broken in older versions of the bundle.
154-
155151
.. tip::
156152
The logout handler is active on all firewalls. If your application has
157153
multiple firewalls with different user context, you need to create your own
@@ -232,12 +228,11 @@ Custom providers need to:
232228
* implement the ``FOS\HttpCache\UserContext\ContextProvider`` interface
233229
* be tagged with ``fos_http_cache.user_context_provider``.
234230

235-
.. versionadded:: 2.4.0
236-
Since version 2.4.0, context providers are autoconfigured. With
237-
autoconfigure enabled in Symfony 3.3 and newer, your custom providers
238-
are tagged automatically, with a default priority of 0. For older
239-
versions, or if autoconfigure is disabled, or to override the
240-
priority, check out the rest of this section.
231+
.. tip::
232+
Context providers are autoconfigured. With autoconfigure enabled in
233+
Symfony, your custom providers are tagged automatically, with a default
234+
priority of 0. If you disabled autoconfigure, or to override the priority,
235+
check out the rest of this section.
241236

242237
If you need context providers to run in a specific order, you can specify the
243238
optional ``priority`` parameter for the tag. The higher the priority, the

tests/Functional/EventListener/SwitchUserListenerTest.php

+1-18
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
1717
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
1818
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
19-
use Symfony\Component\BrowserKit\Cookie;
2019
use Symfony\Component\HttpKernel\KernelInterface;
21-
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
2220
use Symfony\Component\Security\Core\User\InMemoryUser;
2321
use Symfony\Component\Security\Core\User\UserInterface;
2422

@@ -72,22 +70,7 @@ public function testInvalidateContext()
7270

7371
public function loginAsAdmin(KernelBrowser $client)
7472
{
75-
if (method_exists($client, 'loginUser')) {
76-
$client->loginUser($this->createAdminUser(), self::FIREWALL_NAME);
77-
78-
return;
79-
}
80-
81-
$session = $client->getContainer()->get('session');
82-
83-
$user = $this->createAdminUser();
84-
85-
$token = new UsernamePasswordToken($user, self::FIREWALL_NAME, $user->getRoles());
86-
$session->set('_security_'.self::FIREWALL_NAME, serialize($token));
87-
$session->save();
88-
89-
$cookie = new Cookie($session->getName(), $session->getId());
90-
$client->getCookieJar()->set($cookie);
73+
$client->loginUser($this->createAdminUser(), self::FIREWALL_NAME);
9174
}
9275

9376
private function createAdminUser(): UserInterface

tests/Functional/Fixtures/app/AppKernel.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,7 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
6161
} else {
6262
$loader->load(__DIR__.'/config/config.yml');
6363
}
64-
if (\version_compare(Kernel::VERSION, '6.0', '>=')) {
65-
$loader->load(__DIR__.'/config/config_6.yml');
66-
} else {
67-
$loader->load(__DIR__.'/config/config_4.yml');
68-
}
64+
$loader->load(__DIR__.'/config/config_security.yml');
6965

7066
$loader->load(__DIR__.'/config/services.yml');
7167

tests/Functional/Fixtures/app/config/config.yml

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ framework:
33
router:
44
resource: "%kernel.project_dir%/tests/Functional/Fixtures/app/config/routing.yml"
55
test: ~
6+
session:
7+
storage_factory_id: session.storage.factory.mock_file
68

79
fos_http_cache:
810
cacheable:

tests/Functional/Fixtures/app/config/config_4.yml

-21
This file was deleted.

tests/Functional/Fixtures/app/config/config_6.yml renamed to tests/Functional/Fixtures/app/config/config_security.yml

-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
# configuration to make symfony 6 work as expected
2-
3-
framework:
4-
session:
5-
storage_factory_id: session.storage.factory.mock_file
6-
71
security:
82
providers:
93
in_memory:

tests/Functional/Fixtures/app/config/security-legacy.yml

-17
This file was deleted.

tests/Unit/EventListener/UserContextListenerTest.php

-21
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
use Symfony\Component\HttpKernel\Event\ResponseEvent;
2424
use Symfony\Component\HttpKernel\EventListener\AbstractSessionListener;
2525
use Symfony\Component\HttpKernel\HttpKernelInterface;
26-
use Symfony\Component\HttpKernel\Kernel;
2726

2827
class UserContextListenerTest extends TestCase
2928
{
@@ -238,10 +237,6 @@ public function testOnKernelResponse()
238237

239238
public function testOnKernelResponseSetsNoAutoCacheHeader()
240239
{
241-
if (\version_compare('4.1', Kernel::VERSION, '>')) {
242-
$this->markTestSkipped('Test only relevant for Symfony 4.1 and up');
243-
}
244-
245240
$request = new Request();
246241
$request->setMethod('HEAD');
247242
$request->headers->set('X-User-Context-Hash', 'hash');
@@ -263,10 +258,6 @@ public function testOnKernelResponseSetsNoAutoCacheHeader()
263258

264259
public function testOnKernelResponseDoesNotSetNoAutoCacheHeaderWhenNoSessionListener()
265260
{
266-
if (\version_compare('4.1', Kernel::VERSION, '>')) {
267-
$this->markTestSkipped('Test only relevant for Symfony 4.1 and up');
268-
}
269-
270261
$request = new Request();
271262
$request->setMethod('HEAD');
272263
$request->headers->set('X-User-Context-Hash', 'hash');
@@ -292,10 +283,6 @@ public function testOnKernelResponseDoesNotSetNoAutoCacheHeaderWhenNoSessionList
292283

293284
public function testOnKernelResponseSetsNoAutoCacheHeaderWhenCustomHeader()
294285
{
295-
if (\version_compare('4.1', Kernel::VERSION, '>')) {
296-
$this->markTestSkipped('Test only relevant for Symfony 4.1 and up');
297-
}
298-
299286
$request = new Request();
300287
$request->setMethod('HEAD');
301288
$request->headers->set('X-User-Context-Hash', 'hash');
@@ -316,10 +303,6 @@ public function testOnKernelResponseSetsNoAutoCacheHeaderWhenCustomHeader()
316303

317304
public function testOnKernelResponseSetsNoAutoCacheHeaderWhenCustomHeaderAndNoAddVaryOnHash()
318305
{
319-
if (\version_compare('4.1', Kernel::VERSION, '>')) {
320-
$this->markTestSkipped('Test only relevant for Symfony 4.1 and up');
321-
}
322-
323306
$request = new Request();
324307
$request->setMethod('HEAD');
325308
$request->headers->set('X-User-Context-Hash', 'hash');
@@ -345,10 +328,6 @@ public function testOnKernelResponseSetsNoAutoCacheHeaderWhenCustomHeaderAndNoAd
345328

346329
public function testOnKernelResponseDoesNotSetNoAutoCacheHeaderWhenNoCustomHeaderAndNoAddVaryOnHash()
347330
{
348-
if (\version_compare('4.1', Kernel::VERSION, '>')) {
349-
$this->markTestSkipped('Test only relevant for Symfony 4.1 and up');
350-
}
351-
352331
$request = new Request();
353332
$request->setMethod('HEAD');
354333
$request->headers->set('X-User-Context-Hash', 'hash');

0 commit comments

Comments
 (0)