Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f538167

Browse files
committed
feature #13808 [OptionsResolver] removed deprecated functionality (Tobion)
This PR was merged into the 3.0-dev branch. Discussion ---------- [OptionsResolver] removed deprecated functionality | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | yes | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | - Commits ------- 295bba2 [OptionsResolver] removed deprecated functionality
2 parents 5bf779d + 295bba2 commit f538167

File tree

4 files changed

+5
-1211
lines changed

4 files changed

+5
-1211
lines changed

src/Symfony/Component/OptionsResolver/OptionsResolver.php

Lines changed: 4 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -423,31 +423,6 @@ public function setNormalizer($option, \Closure $normalizer)
423423
return $this;
424424
}
425425

426-
/**
427-
* Sets the normalizers for an array of options.
428-
*
429-
* @param array $normalizers An array of closures
430-
*
431-
* @return OptionsResolver This instance
432-
*
433-
* @throws UndefinedOptionsException If the option is undefined
434-
* @throws AccessException If called from a lazy option or normalizer
435-
*
436-
* @see setNormalizer()
437-
*
438-
* @deprecated since version 2.6, to be removed in 3.0.
439-
*/
440-
public function setNormalizers(array $normalizers)
441-
{
442-
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use setNormalizer() instead.', E_USER_DEPRECATED);
443-
444-
foreach ($normalizers as $option => $normalizer) {
445-
$this->setNormalizer($option, $normalizer);
446-
}
447-
448-
return $this;
449-
}
450-
451426
/**
452427
* Sets allowed values for an option.
453428
*
@@ -469,23 +444,12 @@ public function setNormalizers(array $normalizers)
469444
* @throws UndefinedOptionsException If the option is undefined
470445
* @throws AccessException If called from a lazy option or normalizer
471446
*/
472-
public function setAllowedValues($option, $allowedValues = null)
447+
public function setAllowedValues($option, $allowedValues)
473448
{
474449
if ($this->locked) {
475450
throw new AccessException('Allowed values cannot be set from a lazy option or normalizer.');
476451
}
477452

478-
// BC
479-
if (is_array($option) && null === $allowedValues) {
480-
trigger_error('Calling the '.__METHOD__.' method with an array of options is deprecated since version 2.6 and will be removed in 3.0. Use the new signature with a single option instead.', E_USER_DEPRECATED);
481-
482-
foreach ($option as $optionName => $optionValues) {
483-
$this->setAllowedValues($optionName, $optionValues);
484-
}
485-
486-
return $this;
487-
}
488-
489453
if (!isset($this->defined[$option])) {
490454
throw new UndefinedOptionsException(sprintf(
491455
'The option "%s" does not exist. Defined options are: "%s".',
@@ -525,23 +489,12 @@ public function setAllowedValues($option, $allowedValues = null)
525489
* @throws UndefinedOptionsException If the option is undefined
526490
* @throws AccessException If called from a lazy option or normalizer
527491
*/
528-
public function addAllowedValues($option, $allowedValues = null)
492+
public function addAllowedValues($option, $allowedValues)
529493
{
530494
if ($this->locked) {
531495
throw new AccessException('Allowed values cannot be added from a lazy option or normalizer.');
532496
}
533497

534-
// BC
535-
if (is_array($option) && null === $allowedValues) {
536-
trigger_error('Calling the '.__METHOD__.' method with an array of options is deprecated since version 2.6 and will be removed in 3.0. Use the new signature with a single option instead.', E_USER_DEPRECATED);
537-
538-
foreach ($option as $optionName => $optionValues) {
539-
$this->addAllowedValues($optionName, $optionValues);
540-
}
541-
542-
return $this;
543-
}
544-
545498
if (!isset($this->defined[$option])) {
546499
throw new UndefinedOptionsException(sprintf(
547500
'The option "%s" does not exist. Defined options are: "%s".',
@@ -581,23 +534,12 @@ public function addAllowedValues($option, $allowedValues = null)
581534
* @throws UndefinedOptionsException If the option is undefined
582535
* @throws AccessException If called from a lazy option or normalizer
583536
*/
584-
public function setAllowedTypes($option, $allowedTypes = null)
537+
public function setAllowedTypes($option, $allowedTypes)
585538
{
586539
if ($this->locked) {
587540
throw new AccessException('Allowed types cannot be set from a lazy option or normalizer.');
588541
}
589542

590-
// BC
591-
if (is_array($option) && null === $allowedTypes) {
592-
trigger_error('Calling the '.__METHOD__.' method with an array of options is deprecated since version 2.6 and will be removed in 3.0. Use the new signature with a single option instead.', E_USER_DEPRECATED);
593-
594-
foreach ($option as $optionName => $optionTypes) {
595-
$this->setAllowedTypes($optionName, $optionTypes);
596-
}
597-
598-
return $this;
599-
}
600-
601543
if (!isset($this->defined[$option])) {
602544
throw new UndefinedOptionsException(sprintf(
603545
'The option "%s" does not exist. Defined options are: "%s".',
@@ -631,23 +573,12 @@ public function setAllowedTypes($option, $allowedTypes = null)
631573
* @throws UndefinedOptionsException If the option is undefined
632574
* @throws AccessException If called from a lazy option or normalizer
633575
*/
634-
public function addAllowedTypes($option, $allowedTypes = null)
576+
public function addAllowedTypes($option, $allowedTypes)
635577
{
636578
if ($this->locked) {
637579
throw new AccessException('Allowed types cannot be added from a lazy option or normalizer.');
638580
}
639581

640-
// BC
641-
if (is_array($option) && null === $allowedTypes) {
642-
trigger_error('Calling the '.__METHOD__.' method with an array of options is deprecated since version 2.6 and will be removed in 3.0. Use the new signature with a single option instead.', E_USER_DEPRECATED);
643-
644-
foreach ($option as $optionName => $optionTypes) {
645-
$this->addAllowedTypes($optionName, $optionTypes);
646-
}
647-
648-
return $this;
649-
}
650-
651582
if (!isset($this->defined[$option])) {
652583
throw new UndefinedOptionsException(sprintf(
653584
'The option "%s" does not exist. Defined options are: "%s".',
@@ -1031,106 +962,6 @@ public function count()
1031962
return count($this->defaults);
1032963
}
1033964

1034-
/**
1035-
* Alias of {@link setDefault()}.
1036-
*
1037-
* @deprecated since version 2.6, to be removed in 3.0.
1038-
*/
1039-
public function set($option, $value)
1040-
{
1041-
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the setDefaults() method instead.', E_USER_DEPRECATED);
1042-
1043-
return $this->setDefault($option, $value);
1044-
}
1045-
1046-
/**
1047-
* Shortcut for {@link clear()} and {@link setDefaults()}.
1048-
*
1049-
* @deprecated since version 2.6, to be removed in 3.0.
1050-
*/
1051-
public function replace(array $defaults)
1052-
{
1053-
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the clear() and setDefaults() methods instead.', E_USER_DEPRECATED);
1054-
1055-
$this->clear();
1056-
1057-
return $this->setDefaults($defaults);
1058-
}
1059-
1060-
/**
1061-
* Alias of {@link setDefault()}.
1062-
*
1063-
* @deprecated since version 2.6, to be removed in 3.0.
1064-
*/
1065-
public function overload($option, $value)
1066-
{
1067-
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the setDefault() method instead.', E_USER_DEPRECATED);
1068-
1069-
return $this->setDefault($option, $value);
1070-
}
1071-
1072-
/**
1073-
* Alias of {@link offsetGet()}.
1074-
*
1075-
* @deprecated since version 2.6, to be removed in 3.0.
1076-
*/
1077-
public function get($option)
1078-
{
1079-
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the ArrayAccess syntax instead to get an option value.', E_USER_DEPRECATED);
1080-
1081-
return $this->offsetGet($option);
1082-
}
1083-
1084-
/**
1085-
* Alias of {@link offsetExists()}.
1086-
*
1087-
* @deprecated since version 2.6, to be removed in 3.0.
1088-
*/
1089-
public function has($option)
1090-
{
1091-
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the ArrayAccess syntax instead to get an option value.', E_USER_DEPRECATED);
1092-
1093-
return $this->offsetExists($option);
1094-
}
1095-
1096-
/**
1097-
* Shortcut for {@link clear()} and {@link setDefaults()}.
1098-
*
1099-
* @deprecated since version 2.6, to be removed in 3.0.
1100-
*/
1101-
public function replaceDefaults(array $defaultValues)
1102-
{
1103-
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the clear() and setDefaults() methods instead.', E_USER_DEPRECATED);
1104-
1105-
$this->clear();
1106-
1107-
return $this->setDefaults($defaultValues);
1108-
}
1109-
1110-
/**
1111-
* Alias of {@link setDefined()}.
1112-
*
1113-
* @deprecated since version 2.6, to be removed in 3.0.
1114-
*/
1115-
public function setOptional(array $optionNames)
1116-
{
1117-
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the setDefined() method instead.', E_USER_DEPRECATED);
1118-
1119-
return $this->setDefined($optionNames);
1120-
}
1121-
1122-
/**
1123-
* Alias of {@link isDefined()}.
1124-
*
1125-
* @deprecated since version 2.6, to be removed in 3.0.
1126-
*/
1127-
public function isKnown($option)
1128-
{
1129-
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the isDefined() method instead.', E_USER_DEPRECATED);
1130-
1131-
return $this->isDefined($option);
1132-
}
1133-
1134965
/**
1135966
* Returns a string representation of the type of the value.
1136967
*

0 commit comments

Comments
 (0)