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

Skip to content

Commit e746b2a

Browse files
committed
[OptionsResolver] removed deprecated functionality
1 parent 5a60ba4 commit e746b2a

File tree

4 files changed

+5
-1190
lines changed

4 files changed

+5
-1190
lines changed

src/Symfony/Component/OptionsResolver/OptionsResolver.php

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

426-
/**
427-
* {@inheritdoc}
428-
*/
429-
public function setNormalizers(array $normalizers)
430-
{
431-
foreach ($normalizers as $option => $normalizer) {
432-
$this->setNormalizer($option, $normalizer);
433-
}
434-
435-
return $this;
436-
}
437-
438426
/**
439427
* Sets allowed values for an option.
440428
*
@@ -456,21 +444,12 @@ public function setNormalizers(array $normalizers)
456444
* @throws UndefinedOptionsException If the option is undefined
457445
* @throws AccessException If called from a lazy option or normalizer
458446
*/
459-
public function setAllowedValues($option, $allowedValues = null)
447+
public function setAllowedValues($option, $allowedValues)
460448
{
461449
if ($this->locked) {
462450
throw new AccessException('Allowed values cannot be set from a lazy option or normalizer.');
463451
}
464452

465-
// BC
466-
if (is_array($option) && null === $allowedValues) {
467-
foreach ($option as $optionName => $optionValues) {
468-
$this->setAllowedValues($optionName, $optionValues);
469-
}
470-
471-
return $this;
472-
}
473-
474453
if (!isset($this->defined[$option])) {
475454
throw new UndefinedOptionsException(sprintf(
476455
'The option "%s" does not exist. Defined options are: "%s".',
@@ -510,21 +489,12 @@ public function setAllowedValues($option, $allowedValues = null)
510489
* @throws UndefinedOptionsException If the option is undefined
511490
* @throws AccessException If called from a lazy option or normalizer
512491
*/
513-
public function addAllowedValues($option, $allowedValues = null)
492+
public function addAllowedValues($option, $allowedValues)
514493
{
515494
if ($this->locked) {
516495
throw new AccessException('Allowed values cannot be added from a lazy option or normalizer.');
517496
}
518497

519-
// BC
520-
if (is_array($option) && null === $allowedValues) {
521-
foreach ($option as $optionName => $optionValues) {
522-
$this->addAllowedValues($optionName, $optionValues);
523-
}
524-
525-
return $this;
526-
}
527-
528498
if (!isset($this->defined[$option])) {
529499
throw new UndefinedOptionsException(sprintf(
530500
'The option "%s" does not exist. Defined options are: "%s".',
@@ -562,21 +532,12 @@ public function addAllowedValues($option, $allowedValues = null)
562532
* @throws UndefinedOptionsException If the option is undefined
563533
* @throws AccessException If called from a lazy option or normalizer
564534
*/
565-
public function setAllowedTypes($option, $allowedTypes = null)
535+
public function setAllowedTypes($option, $allowedTypes)
566536
{
567537
if ($this->locked) {
568538
throw new AccessException('Allowed types cannot be set from a lazy option or normalizer.');
569539
}
570540

571-
// BC
572-
if (is_array($option) && null === $allowedTypes) {
573-
foreach ($option as $optionName => $optionTypes) {
574-
$this->setAllowedTypes($optionName, $optionTypes);
575-
}
576-
577-
return $this;
578-
}
579-
580541
if (!isset($this->defined[$option])) {
581542
throw new UndefinedOptionsException(sprintf(
582543
'The option "%s" does not exist. Defined options are: "%s".',
@@ -610,21 +571,12 @@ public function setAllowedTypes($option, $allowedTypes = null)
610571
* @throws UndefinedOptionsException If the option is undefined
611572
* @throws AccessException If called from a lazy option or normalizer
612573
*/
613-
public function addAllowedTypes($option, $allowedTypes = null)
574+
public function addAllowedTypes($option, $allowedTypes)
614575
{
615576
if ($this->locked) {
616577
throw new AccessException('Allowed types cannot be added from a lazy option or normalizer.');
617578
}
618579

619-
// BC
620-
if (is_array($option) && null === $allowedTypes) {
621-
foreach ($option as $optionName => $optionTypes) {
622-
$this->addAllowedTypes($optionName, $optionTypes);
623-
}
624-
625-
return $this;
626-
}
627-
628580
if (!isset($this->defined[$option])) {
629581
throw new UndefinedOptionsException(sprintf(
630582
'The option "%s" does not exist. Defined options are: "%s".',
@@ -1008,106 +960,6 @@ public function count()
1008960
return count($this->defaults);
1009961
}
1010962

1011-
/**
1012-
* Alias of {@link setDefault()}.
1013-
*
1014-
* @deprecated since version 2.6, to be removed in 3.0.
1015-
*/
1016-
public function set($option, $value)
1017-
{
1018-
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);
1019-
1020-
return $this->setDefault($option, $value);
1021-
}
1022-
1023-
/**
1024-
* Shortcut for {@link clear()} and {@link setDefaults()}.
1025-
*
1026-
* @deprecated since version 2.6, to be removed in 3.0.
1027-
*/
1028-
public function replace(array $defaults)
1029-
{
1030-
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);
1031-
1032-
$this->clear();
1033-
1034-
return $this->setDefaults($defaults);
1035-
}
1036-
1037-
/**
1038-
* Alias of {@link setDefault()}.
1039-
*
1040-
* @deprecated since version 2.6, to be removed in 3.0.
1041-
*/
1042-
public function overload($option, $value)
1043-
{
1044-
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);
1045-
1046-
return $this->setDefault($option, $value);
1047-
}
1048-
1049-
/**
1050-
* Alias of {@link offsetGet()}.
1051-
*
1052-
* @deprecated since version 2.6, to be removed in 3.0.
1053-
*/
1054-
public function get($option)
1055-
{
1056-
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);
1057-
1058-
return $this->offsetGet($option);
1059-
}
1060-
1061-
/**
1062-
* Alias of {@link offsetExists()}.
1063-
*
1064-
* @deprecated since version 2.6, to be removed in 3.0.
1065-
*/
1066-
public function has($option)
1067-
{
1068-
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);
1069-
1070-
return $this->offsetExists($option);
1071-
}
1072-
1073-
/**
1074-
* Shortcut for {@link clear()} and {@link setDefaults()}.
1075-
*
1076-
* @deprecated since version 2.6, to be removed in 3.0.
1077-
*/
1078-
public function replaceDefaults(array $defaultValues)
1079-
{
1080-
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);
1081-
1082-
$this->clear();
1083-
1084-
return $this->setDefaults($defaultValues);
1085-
}
1086-
1087-
/**
1088-
* Alias of {@link setDefined()}.
1089-
*
1090-
* @deprecated since version 2.6, to be removed in 3.0.
1091-
*/
1092-
public function setOptional(array $optionNames)
1093-
{
1094-
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);
1095-
1096-
return $this->setDefined($optionNames);
1097-
}
1098-
1099-
/**
1100-
* Alias of {@link isDefined()}.
1101-
*
1102-
* @deprecated since version 2.6, to be removed in 3.0.
1103-
*/
1104-
public function isKnown($option)
1105-
{
1106-
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);
1107-
1108-
return $this->isDefined($option);
1109-
}
1110-
1111963
/**
1112964
* Returns a string representation of the type of the value.
1113965
*

0 commit comments

Comments
 (0)