You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bug symfony#20769 [Bridge\Twig] Trigger deprecation when using FormExtension::$renderer (nicolas-grekas)
This PR was merged into the 3.2 branch.
Discussion
----------
[Bridge\Twig] Trigger deprecation when using FormExtension::$renderer
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | yes (instead of a BC break)
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
As spotted in symfony#20710 and sonata-project/SonataAdminBundle#4216.
Note that this simple implementation is fine because neither the class nor its parent have any private/protected properties.
Commits
-------
6f1c59c [Bridge\Twig] Trigger deprecation when using FormExtension::$renderer
if ($this->rendererinstanceof TwigRendererInterface) {
31
35
@trigger_error(sprintf('Passing a Twig Form Renderer to the "%s" constructor is deprecated since version 3.2 and won\'t be possible in 4.0. Pass the Twig_Environment to the TwigRendererEngine constructor instead.', static::class), E_USER_DEPRECATED);
if ($this->rendererinstanceof TwigRendererInterface) {
44
50
$this->renderer->setEnvironment($environment);
51
+
} elseif (null !== $this->renderer) {
52
+
$this->renderer[2] = $environment;
45
53
}
46
54
}
47
55
@@ -94,6 +102,62 @@ public function getTests()
94
102
);
95
103
}
96
104
105
+
/**
106
+
* @internal
107
+
*/
108
+
publicfunction__get($name)
109
+
{
110
+
if ('renderer' === $name) {
111
+
@trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since version 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED);
@trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since version 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED);
132
+
}
133
+
134
+
$this->$name = $value;
135
+
}
136
+
137
+
/**
138
+
* @internal
139
+
*/
140
+
publicfunction__isset($name)
141
+
{
142
+
if ('renderer' === $name) {
143
+
@trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since version 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED);
144
+
}
145
+
146
+
returnisset($this->$name);
147
+
}
148
+
149
+
/**
150
+
* @internal
151
+
*/
152
+
publicfunction__unset($name)
153
+
{
154
+
if ('renderer' === $name) {
155
+
@trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since version 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED);
0 commit comments