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 811b711

Browse filesBrowse files
committed
Improve triggering of the deprecation error
1 parent 469e70d commit 811b711
Copy full SHA for 811b711

File tree

Expand file treeCollapse file tree

1 file changed

+10
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-4
lines changed

‎src/Symfony/Component/Form/ResolvedFormType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/ResolvedFormType.php
+10-4Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,19 +206,25 @@ public function getOptionsResolver()
206206
$this->innerType->setDefaultOptions($this->optionsResolver);
207207

208208
$reflector = new \ReflectionMethod($this->innerType, 'setDefaultOptions');
209-
$isOverwritten = ($reflector->getDeclaringClass()->getName() !== 'Symfony\Component\Form\AbstractType');
209+
$isOldOverwritten = $reflector->getDeclaringClass()->getName() !== 'Symfony\Component\Form\AbstractType';
210210

211-
if (true === $isOverwritten) {
211+
$reflector = new \ReflectionMethod($this->innerType, 'configureOptions');
212+
$isNewOverwritten = $reflector->getDeclaringClass()->getName() !== 'Symfony\Component\Form\AbstractType';
213+
214+
if ($isOldOverwritten && !$isNewOverwritten) {
212215
trigger_error('The FormTypeInterface::setDefaultOptions() method is deprecated since version 2.7 and will be removed in 3.0. Use configureOptions() instead. This method will be added to the FormTypeInterface with Symfony 3.0.', E_USER_DEPRECATED);
213216
}
214217

215218
foreach ($this->typeExtensions as $extension) {
216219
$extension->setDefaultOptions($this->optionsResolver);
217220

218221
$reflector = new \ReflectionMethod($extension, 'setDefaultOptions');
219-
$isOverwritten = ($reflector->getDeclaringClass()->getName() !== 'Symfony\Component\Form\AbstractTypeExtension');
222+
$isOldOverwritten = $reflector->getDeclaringClass()->getName() !== 'Symfony\Component\Form\AbstractTypeExtension';
223+
224+
$reflector = new \ReflectionMethod($extension, 'configureOptions');
225+
$isNewOverwritten = $reflector->getDeclaringClass()->getName() !== 'Symfony\Component\Form\AbstractTypeExtension';
220226

221-
if (true === $isOverwritten) {
227+
if ($isOldOverwritten && !$isNewOverwritten) {
222228
trigger_error('The FormTypeExtensionInterface::setDefaultOptions() method is deprecated since version 2.7 and will be removed in 3.0. Use configureOptions() instead. This method will be added to the FormTypeExtensionInterface with Symfony 3.0.', E_USER_DEPRECATED);
223229
}
224230
}

0 commit comments

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