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

[OptionsResolver] removed deprecated functionality #13808

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
177 changes: 4 additions & 173 deletions 177 src/Symfony/Component/OptionsResolver/OptionsResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,31 +423,6 @@ public function setNormalizer($option, \Closure $normalizer)
return $this;
}

/**
* Sets the normalizers for an array of options.
*
* @param array $normalizers An array of closures
*
* @return OptionsResolver This instance
*
* @throws UndefinedOptionsException If the option is undefined
* @throws AccessException If called from a lazy option or normalizer
*
* @see setNormalizer()
*
* @deprecated since version 2.6, to be removed in 3.0.
*/
public function setNormalizers(array $normalizers)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use setNormalizer() instead.', E_USER_DEPRECATED);

foreach ($normalizers as $option => $normalizer) {
$this->setNormalizer($option, $normalizer);
}

return $this;
}

/**
* Sets allowed values for an option.
*
Expand All @@ -469,23 +444,12 @@ public function setNormalizers(array $normalizers)
* @throws UndefinedOptionsException If the option is undefined
* @throws AccessException If called from a lazy option or normalizer
*/
public function setAllowedValues($option, $allowedValues = null)
public function setAllowedValues($option, $allowedValues)
{
if ($this->locked) {
throw new AccessException('Allowed values cannot be set from a lazy option or normalizer.');
}

// BC
if (is_array($option) && null === $allowedValues) {
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);

foreach ($option as $optionName => $optionValues) {
$this->setAllowedValues($optionName, $optionValues);
}

return $this;
}

if (!isset($this->defined[$option])) {
throw new UndefinedOptionsException(sprintf(
'The option "%s" does not exist. Defined options are: "%s".',
Expand Down Expand Up @@ -525,23 +489,12 @@ public function setAllowedValues($option, $allowedValues = null)
* @throws UndefinedOptionsException If the option is undefined
* @throws AccessException If called from a lazy option or normalizer
*/
public function addAllowedValues($option, $allowedValues = null)
public function addAllowedValues($option, $allowedValues)
{
if ($this->locked) {
throw new AccessException('Allowed values cannot be added from a lazy option or normalizer.');
}

// BC
if (is_array($option) && null === $allowedValues) {
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);

foreach ($option as $optionName => $optionValues) {
$this->addAllowedValues($optionName, $optionValues);
}

return $this;
}

if (!isset($this->defined[$option])) {
throw new UndefinedOptionsException(sprintf(
'The option "%s" does not exist. Defined options are: "%s".',
Expand Down Expand Up @@ -581,23 +534,12 @@ public function addAllowedValues($option, $allowedValues = null)
* @throws UndefinedOptionsException If the option is undefined
* @throws AccessException If called from a lazy option or normalizer
*/
public function setAllowedTypes($option, $allowedTypes = null)
public function setAllowedTypes($option, $allowedTypes)
{
if ($this->locked) {
throw new AccessException('Allowed types cannot be set from a lazy option or normalizer.');
}

// BC
if (is_array($option) && null === $allowedTypes) {
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);

foreach ($option as $optionName => $optionTypes) {
$this->setAllowedTypes($optionName, $optionTypes);
}

return $this;
}

if (!isset($this->defined[$option])) {
throw new UndefinedOptionsException(sprintf(
'The option "%s" does not exist. Defined options are: "%s".',
Expand Down Expand Up @@ -631,23 +573,12 @@ public function setAllowedTypes($option, $allowedTypes = null)
* @throws UndefinedOptionsException If the option is undefined
* @throws AccessException If called from a lazy option or normalizer
*/
public function addAllowedTypes($option, $allowedTypes = null)
public function addAllowedTypes($option, $allowedTypes)
{
if ($this->locked) {
throw new AccessException('Allowed types cannot be added from a lazy option or normalizer.');
}

// BC
if (is_array($option) && null === $allowedTypes) {
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);

foreach ($option as $optionName => $optionTypes) {
$this->addAllowedTypes($optionName, $optionTypes);
}

return $this;
}

if (!isset($this->defined[$option])) {
throw new UndefinedOptionsException(sprintf(
'The option "%s" does not exist. Defined options are: "%s".',
Expand Down Expand Up @@ -1031,106 +962,6 @@ public function count()
return count($this->defaults);
}

/**
* Alias of {@link setDefault()}.
*
* @deprecated since version 2.6, to be removed in 3.0.
*/
public function set($option, $value)
{
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);

return $this->setDefault($option, $value);
}

/**
* Shortcut for {@link clear()} and {@link setDefaults()}.
*
* @deprecated since version 2.6, to be removed in 3.0.
*/
public function replace(array $defaults)
{
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);

$this->clear();

return $this->setDefaults($defaults);
}

/**
* Alias of {@link setDefault()}.
*
* @deprecated since version 2.6, to be removed in 3.0.
*/
public function overload($option, $value)
{
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);

return $this->setDefault($option, $value);
}

/**
* Alias of {@link offsetGet()}.
*
* @deprecated since version 2.6, to be removed in 3.0.
*/
public function get($option)
{
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);

return $this->offsetGet($option);
}

/**
* Alias of {@link offsetExists()}.
*
* @deprecated since version 2.6, to be removed in 3.0.
*/
public function has($option)
{
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);

return $this->offsetExists($option);
}

/**
* Shortcut for {@link clear()} and {@link setDefaults()}.
*
* @deprecated since version 2.6, to be removed in 3.0.
*/
public function replaceDefaults(array $defaultValues)
{
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);

$this->clear();

return $this->setDefaults($defaultValues);
}

/**
* Alias of {@link setDefined()}.
*
* @deprecated since version 2.6, to be removed in 3.0.
*/
public function setOptional(array $optionNames)
{
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);

return $this->setDefined($optionNames);
}

/**
* Alias of {@link isDefined()}.
*
* @deprecated since version 2.6, to be removed in 3.0.
*/
public function isKnown($option)
{
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);

return $this->isDefined($option);
}

/**
* Returns a string representation of the type of the value.
*
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.