Skip to content

Commit 5f15fa2

Browse files
committed
Merge branch '2.x'
* 2.x: mark legacy aliases as deprecated deprecate the force_redirects option deprecate the default_engine option deprecate the templating service option remove duplicated changelog entry deprecate the "fos_rest.service.inflector" option
2 parents 51c1ffb + a58b6a8 commit 5f15fa2

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,17 +165,18 @@ CHANGELOG
165165
`isPopulateDefaultVars()` methods of the `Controller\Annotations\View` class
166166
* deprecated the `setEngine()`, `setTemplate()`, `setTemplateData()`, `setTemplateVar()`, `getEngine()`,
167167
`getTemplate()`, `getTemplateData()`, and `getTemplateVar()` methods of the `View\View` class
168-
* deprecated the `fos_rest.templating` alias and the `fos_rest.exception.twig_controller` service
169-
* deprecated not setting the `fos_rest.service.templating` and `fos_rest.view.default_engine` options
170-
* deprecated not setting the `fos_rest.view.force_redirects` option to the empty array
171168
* deprecated not enabling the `fos_rest.body_listener` option explicitly, it will be disabled by default
172169
in 3.0
173170
* deprecated the following options:
174171

175172
* `fos_rest.exception.exception_controller`
176173
* `fos_rest.exception.exception_listener`
177174
* `fos_rest.exception.service`
175+
* `fos_rest.service.inflector`
178176
* `fos_rest.service.router`
177+
* `fos_rest.service.templating`
178+
* `fos_rest.view.default_engine`
179+
* `fos_rest.view.force_redirects`
179180
* `fos_rest.view.templating_formats`
180181

181182
* the following classes and interfaces are marked as `deprecated`, they will be removed in 3.0:

DependencyInjection/Configuration.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public function getConfigTreeBuilder(): TreeBuilder
124124
->ifString()
125125
->thenInvalid('only null is supported')
126126
->end()
127+
->setDeprecated('The "%path%.%node%" option is deprecated since FOSRestBundle 2.8.')
127128
->end()
128129
->scalarNode('serializer')->defaultNull()->end()
129130
->scalarNode('view_handler')->defaultValue('fos_rest.view_handler.default')->end()
@@ -133,6 +134,7 @@ public function getConfigTreeBuilder(): TreeBuilder
133134
->ifString()
134135
->thenInvalid('only null is supported')
135136
->end()
137+
->setDeprecated('The "%path%.%node%" option is deprecated since FOSRestBundle 2.8.')
136138
->end()
137139
->scalarNode('validator')->defaultValue('validator')->end()
138140
->end()
@@ -200,8 +202,10 @@ private function addViewSection(ArrayNodeDefinition $rootNode): void
200202
->ifString()
201203
->thenInvalid('only null is supported')
202204
->end()
205+
->setDeprecated('The "%path%.%node%" option has been deprecated in FOSRestBundle 2.8.')
203206
->end()
204207
->arrayNode('force_redirects')
208+
->setDeprecated('The "%path%.%node%" option has been deprecated in FOSRestBundle 2.8.')
205209
->useAttributeAsKey('name')
206210
->defaultValue([])
207211
->validate()

Tests/DependencyInjection/FOSRestExtensionTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,4 +581,17 @@ public function testRegisterSerializerErrorRenderer()
581581
$this->assertTrue($this->container->hasAlias('error_renderer'));
582582
$this->assertSame('fos_rest.error_renderer.serializer', (string) $this->container->getAlias('error_renderer'));
583583
}
584+
585+
public function testLegacyAliasesAreDeprecated()
586+
{
587+
if (!method_exists(Alias::class, 'isDeprecated')) {
588+
$this->markTestSkipped();
589+
}
590+
591+
$this->extension->load([], $this->container);
592+
593+
$this->assertTrue($this->container->getAlias('fos_rest.inflector')->isDeprecated());
594+
$this->assertTrue($this->container->getAlias('fos_rest.router')->isDeprecated());
595+
$this->assertTrue($this->container->getAlias('fos_rest.templating')->isDeprecated());
596+
}
584597
}

UPGRADING-3.0.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ Upgrading From 2.x To 3.0
3333
`getTemplate()`, `getTemplateData()`, and `getTemplateVar()` methods of the `View\View` class
3434
have been removed.
3535

36-
* The default values of the `fos_rest.service.templating` and `fos_rest.view.default_engine` options
37-
have been changed to `null`. Setting it to another value leads to an exception.
38-
39-
* The default value of the `fos_rest.view.force_redirects` option has been changed to the empty
40-
array. Setting it to another value leads to an exception.
41-
4236
* The default value of the `fos_rest.body_listener` option has been changed from enabled to disabled.
4337

4438
* The `setMaxDepth()` method has been removed from the `Context` class. Use the
@@ -52,7 +46,11 @@ Upgrading From 2.x To 3.0
5246
* `fos_rest.exception.exception_controller`
5347
* `fos_rest.exception.exception_listener`
5448
* `fos_rest.exception.service`
49+
* `fos_rest.service.inflector`
5550
* `fos_rest.service.router`
51+
* `fos_rest.service.templating`
52+
* `fos_rest.view.default_engine`
53+
* `fos_rest.view.force_redirects`
5654
* `fos_rest.view.templating_formats`
5755

5856
* The following classes and interfaces have been removed:

0 commit comments

Comments
 (0)