Skip to content

Commit 419416d

Browse files
committed
minor #13060 [2.7] adds deprecation notices. (hhamon)
This PR was merged into the 2.7 branch. Discussion ---------- [2.7] adds deprecation notices. | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #12608, #12672, #12675 #12684, #12686 | License | MIT | Doc PR | ~ Commits ------- f9fbb4f Fixes more deprecation notices as per @stof review. fd47c07 Fixed some deprecations according to @stof feedbacks. 2a3e7d2 Normalizes deprecation notice messages. 738b9be [Validator] fixes UuidValidator deprecated class namespace. e608ba6 [Form] adds more deprecation notices. cd9617a [Validator] adds more deprecation notices. a7f841e [Form] Adds a way to trigger deprecation notice on demand for VirtualFormAwareIterator class. 97efd2c Fixes more deprecation notices. fd9c7bb Normalized @deprecated annotations. 39cfd47 Removed deprecation notices from test files. 2a9749d Fixes deprecation notices. 6f57b7b Reverted trigger_error() function calls on deprecated interfaces to prevent breaking third party projects implementing them. 86b9f6b Adds deprecation notices for structures to be removed in 3.0.
2 parents cdae349 + 75b4a9d commit 419416d

File tree

3 files changed

+26
-11
lines changed

3 files changed

+26
-11
lines changed

OptionsResolver.php

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,20 +1011,24 @@ public function count()
10111011
/**
10121012
* Alias of {@link setDefault()}.
10131013
*
1014-
* @deprecated Deprecated as of Symfony 2.6, to be removed in Symfony 3.0.
1014+
* @deprecated since version 2.6, to be removed in 3.0.
10151015
*/
10161016
public function set($option, $value)
10171017
{
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+
10181020
return $this->setDefault($option, $value);
10191021
}
10201022

10211023
/**
10221024
* Shortcut for {@link clear()} and {@link setDefaults()}.
10231025
*
1024-
* @deprecated Deprecated as of Symfony 2.6, to be removed in Symfony 3.0.
1026+
* @deprecated since version 2.6, to be removed in 3.0.
10251027
*/
10261028
public function replace(array $defaults)
10271029
{
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+
10281032
$this->clear();
10291033

10301034
return $this->setDefaults($defaults);
@@ -1033,40 +1037,48 @@ public function replace(array $defaults)
10331037
/**
10341038
* Alias of {@link setDefault()}.
10351039
*
1036-
* @deprecated Deprecated as of Symfony 2.6, to be removed in Symfony 3.0.
1040+
* @deprecated since version 2.6, to be removed in 3.0.
10371041
*/
10381042
public function overload($option, $value)
10391043
{
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+
10401046
return $this->setDefault($option, $value);
10411047
}
10421048

10431049
/**
10441050
* Alias of {@link offsetGet()}.
10451051
*
1046-
* @deprecated Deprecated as of Symfony 2.6, to be removed in Symfony 3.0.
1052+
* @deprecated since version 2.6, to be removed in 3.0.
10471053
*/
10481054
public function get($option)
10491055
{
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+
10501058
return $this->offsetGet($option);
10511059
}
10521060

10531061
/**
10541062
* Alias of {@link offsetExists()}.
10551063
*
1056-
* @deprecated Deprecated as of Symfony 2.6, to be removed in Symfony 3.0.
1064+
* @deprecated since version 2.6, to be removed in 3.0.
10571065
*/
10581066
public function has($option)
10591067
{
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+
10601070
return $this->offsetExists($option);
10611071
}
10621072

10631073
/**
10641074
* Shortcut for {@link clear()} and {@link setDefaults()}.
10651075
*
1066-
* @deprecated Deprecated as of Symfony 2.6, to be removed in Symfony 3.0.
1076+
* @deprecated since version 2.6, to be removed in 3.0.
10671077
*/
10681078
public function replaceDefaults(array $defaultValues)
10691079
{
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+
10701082
$this->clear();
10711083

10721084
return $this->setDefaults($defaultValues);
@@ -1075,20 +1087,24 @@ public function replaceDefaults(array $defaultValues)
10751087
/**
10761088
* Alias of {@link setDefined()}.
10771089
*
1078-
* @deprecated Deprecated as of Symfony 2.6, to be removed in Symfony 3.0.
1090+
* @deprecated since version 2.6, to be removed in 3.0.
10791091
*/
10801092
public function setOptional(array $optionNames)
10811093
{
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+
10821096
return $this->setDefined($optionNames);
10831097
}
10841098

10851099
/**
10861100
* Alias of {@link isDefined()}.
10871101
*
1088-
* @deprecated Deprecated as of Symfony 2.6, to be removed in Symfony 3.0.
1102+
* @deprecated since version 2.6, to be removed in 3.0.
10891103
*/
10901104
public function isKnown($option)
10911105
{
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+
10921108
return $this->isDefined($option);
10931109
}
10941110

OptionsResolverInterface.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
namespace Symfony\Component\OptionsResolver;
1313

14-
trigger_error('The "Symfony\Component\OptionsResolver\OptionsResolverInterface" interface was deprecated in version 2.6 and will be removed in 3.0. Use "Symfony\Component\OptionsResolver\OptionsResolver" instead.', E_USER_DEPRECATED);
15-
1614
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
1715
use Symfony\Component\OptionsResolver\Exception\MissingOptionsException;
1816
use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException;
@@ -22,6 +20,7 @@
2220
*
2321
* @deprecated since version 2.6, to be removed in Symfony 3.0.
2422
* Use {@link OptionsResolver} instead.
23+
* @deprecated since version 2.6, to be removed in 3.0. Use {@link OptionsResolver} instead.
2524
*/
2625
interface OptionsResolverInterface
2726
{

Tests/LegacyOptionsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function testSetLazyOption()
3333
$test = $this;
3434

3535
$this->options->set('foo', function (Options $options) use ($test) {
36-
return 'dynamic';
36+
return 'dynamic';
3737
});
3838

3939
$this->assertEquals(array('foo' => 'dynamic'), $this->options->resolve());

0 commit comments

Comments
 (0)