Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9994c02

Browse filesBrowse files
committed
removed deprecated Twig features
1 parent ceefea8 commit 9994c02
Copy full SHA for 9994c02

File tree

7 files changed

+0
-185
lines changed
Filter options

7 files changed

+0
-185
lines changed

‎src/Symfony/Bridge/Twig/AppVariable.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/AppVariable.php
-28Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Symfony\Component\HttpFoundation\Session\Session;
1717
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1818
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
19-
use Symfony\Component\Security\Core\SecurityContextInterface;
2019

2120
/**
2221
* Exposes some Symfony parameters and services as an "app" global variable.
@@ -25,20 +24,11 @@
2524
*/
2625
class AppVariable
2726
{
28-
private $security;
2927
private $tokenStorage;
3028
private $requestStack;
3129
private $environment;
3230
private $debug;
3331

34-
/**
35-
* @deprecated since version 2.7, to be removed in 3.0.
36-
*/
37-
public function setSecurity(SecurityContextInterface $security)
38-
{
39-
$this->security = $security;
40-
}
41-
4232
public function setTokenStorage(TokenStorageInterface $tokenStorage)
4333
{
4434
$this->tokenStorage = $tokenStorage;
@@ -59,24 +49,6 @@ public function setDebug($debug)
5949
$this->debug = (bool) $debug;
6050
}
6151

62-
/**
63-
* Returns the security context service.
64-
*
65-
* @deprecated since version 2.6, to be removed in 3.0.
66-
*
67-
* @return SecurityContext|null The security context
68-
*/
69-
public function getSecurity()
70-
{
71-
trigger_error('The "app.security" variable is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);
72-
73-
if (null === $this->security) {
74-
throw new \RuntimeException('The "app.security" variable is not available.');
75-
}
76-
77-
return $this->security;
78-
}
79-
8052
/**
8153
* Returns the current user.
8254
*

‎src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php
-47Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -38,60 +38,13 @@ public function getConfigTreeBuilder()
3838
->end()
3939
;
4040

41-
$this->addFormSection($rootNode);
4241
$this->addFormThemesSection($rootNode);
4342
$this->addGlobalsSection($rootNode);
4443
$this->addTwigOptions($rootNode);
4544

4645
return $treeBuilder;
4746
}
4847

49-
private function addFormSection(ArrayNodeDefinition $rootNode)
50-
{
51-
$rootNode
52-
// Check deprecation before the config is processed to ensure
53-
// the setting has been explicitly defined in a configuration file.
54-
->beforeNormalization()
55-
->ifTrue(function ($v) { return isset($v['form']['resources']); })
56-
->then(function ($v) {
57-
trigger_error('The twig.form.resources configuration key is deprecated since version 2.6 and will be removed in 3.0. Use the twig.form_themes configuration key instead.', E_USER_DEPRECATED);
58-
59-
return $v;
60-
})
61-
->end()
62-
->validate()
63-
->ifTrue(function ($v) {
64-
return count($v['form']['resources']) > 0;
65-
})
66-
->then(function ($v) {
67-
$v['form_themes'] = array_values(array_unique(array_merge($v['form']['resources'], $v['form_themes'])));
68-
69-
return $v;
70-
})
71-
->end()
72-
->children()
73-
->arrayNode('form')
74-
->info('Deprecated since version 2.6, to be removed in 3.0. Use twig.form_themes instead')
75-
->addDefaultsIfNotSet()
76-
->fixXmlConfig('resource')
77-
->children()
78-
->arrayNode('resources')
79-
->addDefaultChildrenIfNoneSet()
80-
->prototype('scalar')->defaultValue('form_div_layout.html.twig')->end()
81-
->example(array('MyBundle::form.html.twig'))
82-
->validate()
83-
->ifTrue(function ($v) { return !in_array('form_div_layout.html.twig', $v); })
84-
->then(function ($v) {
85-
return array_merge(array('form_div_layout.html.twig'), $v);
86-
})
87-
->end()
88-
->end()
89-
->end()
90-
->end()
91-
->end()
92-
;
93-
}
94-
9548
private function addFormThemesSection(ArrayNodeDefinition $rootNode)
9649
{
9750
$rootNode

‎src/Symfony/Bundle/TwigBundle/Resources/config/schema/twig-1.0.xsd

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/Resources/config/schema/twig-1.0.xsd
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
<xsd:complexType name="config">
1111
<xsd:sequence>
12-
<!-- @deprecated since version 2.6, to be removed in 3.0 -->
13-
<xsd:element name="form" type="form" minOccurs="0" maxOccurs="1" />
1412
<xsd:element name="form-theme" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
1513
<xsd:element name="global" type="global" minOccurs="0" maxOccurs="unbounded" />
1614
<xsd:element name="path" type="path" minOccurs="0" maxOccurs="unbounded" />
@@ -28,12 +26,6 @@
2826
<xsd:attribute name="exception-controller" type="xsd:string" />
2927
</xsd:complexType>
3028

31-
<xsd:complexType name="form">
32-
<xsd:choice minOccurs="1" maxOccurs="unbounded">
33-
<xsd:element name="resource" type="xsd:string" />
34-
</xsd:choice>
35-
</xsd:complexType>
36-
3729
<xsd:complexType name="path" mixed="true">
3830
<xsd:attribute name="namespace" type="xsd:string" />
3931
</xsd:complexType>

‎src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
<service id="twig.app_variable" class="Symfony\Bridge\Twig\AppVariable" public="false">
4141
<call method="setEnvironment"><argument>%kernel.environment%</argument></call>
4242
<call method="setDebug"><argument>%kernel.debug%</argument></call>
43-
<call method="setSecurity"><argument type="service" id="security.context" on-invalid="ignore" /></call>
4443
<call method="setTokenStorage"><argument type="service" id="security.token_storage" on-invalid="ignore" /></call>
4544
<call method="setRequestStack"><argument type="service" id="request_stack" on-invalid="ignore" /></call>
4645
</service>

‎src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php
-38Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -23,44 +23,6 @@
2323

2424
class TwigExtensionTest extends TestCase
2525
{
26-
/**
27-
* @dataProvider getFormats
28-
*/
29-
public function testLegacyFormResourcesConfigurationKey($format)
30-
{
31-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
32-
33-
$container = $this->createContainer();
34-
$container->registerExtension(new TwigExtension());
35-
$this->loadFromFile($container, 'legacy-form-resources-only', $format);
36-
$this->compileContainer($container);
37-
38-
// Form resources
39-
$this->assertCount(3, $container->getParameter('twig.form.resources'));
40-
$this->assertContains('form_div_layout.html.twig', $container->getParameter('twig.form.resources'));
41-
$this->assertContains('form_table_layout.html.twig', $container->getParameter('twig.form.resources'));
42-
$this->assertContains('MyBundle:Form:my_theme.html.twig', $container->getParameter('twig.form.resources'));
43-
}
44-
45-
/**
46-
* @dataProvider getFormats
47-
*/
48-
public function testLegacyMergeFormResourcesConfigurationKeyWithFormThemesConfigurationKey($format)
49-
{
50-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
51-
52-
$container = $this->createContainer();
53-
$container->registerExtension(new TwigExtension());
54-
$this->loadFromFile($container, 'legacy-merge-form-resources-with-form-themes', $format);
55-
$this->compileContainer($container);
56-
57-
$this->assertCount(4, $container->getParameter('twig.form.resources'));
58-
$this->assertContains('form_div_layout.html.twig', $container->getParameter('twig.form.resources'));
59-
$this->assertContains('form_table_layout.html.twig', $container->getParameter('twig.form.resources'));
60-
$this->assertContains('MyBundle:Form:my_theme.html.twig', $container->getParameter('twig.form.resources'));
61-
$this->assertContains('FooBundle:Form:bar.html.twig', $container->getParameter('twig.form.resources'));
62-
}
63-
6426
public function testLoadEmptyConfiguration()
6527
{
6628
$container = $this->createContainer();

‎src/Symfony/Bundle/TwigBundle/TwigDefaultEscapingStrategy.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/TwigDefaultEscapingStrategy.php
-41Lines changed: 0 additions & 41 deletions
This file was deleted.

‎src/Symfony/Bundle/TwigBundle/TwigEngine.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/TwigEngine.php
-22Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,6 @@ public function __construct(\Twig_Environment $environment, TemplateNameParserIn
4141
$this->locator = $locator;
4242
}
4343

44-
/**
45-
* @deprecated since version 2.7, to be removed in 3.0.
46-
* Inject the escaping strategy on \Twig_Environment instead.
47-
*/
48-
public function setDefaultEscapingStrategy($strategy)
49-
{
50-
trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0. Inject the escaping strategy in the Twig_Environment object instead.', E_USER_DEPRECATED);
51-
52-
$this->environment->getExtension('escaper')->setDefaultStrategy($strategy);
53-
}
54-
55-
/**
56-
* @deprecated since version 2.7, to be removed in 3.0.
57-
* Use the 'filename' strategy instead.
58-
*/
59-
public function guessDefaultEscapingStrategy($filename)
60-
{
61-
trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0. Use the Twig_FileExtensionEscapingStrategy::guess method instead.', E_USER_DEPRECATED);
62-
63-
return \Twig_FileExtensionEscapingStrategy::guess($filename);
64-
}
65-
6644
/**
6745
* {@inheritdoc}
6846
*/

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.