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 906e757

Browse filesBrowse files
committed
[OptionsResolver] Remove deprecated code
1 parent d131937 commit 906e757
Copy full SHA for 906e757

File tree

5 files changed

+8
-69
lines changed
Filter options

5 files changed

+8
-69
lines changed

‎src/Symfony/Component/OptionsResolver/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/OptionsResolver/CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
6.0
5+
---
6+
7+
* Remove `OptionsResolverIntrospector::getDeprecationMessage()`
8+
49
5.3
510
---
611

‎src/Symfony/Component/OptionsResolver/Debug/OptionsResolverIntrospector.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/OptionsResolver/Debug/OptionsResolverIntrospector.php
-14Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -96,20 +96,6 @@ public function getNormalizers(string $option): array
9696
return ($this->get)('normalizers', $option, sprintf('No normalizer was set for the "%s" option.', $option));
9797
}
9898

99-
/**
100-
* @return string|\Closure
101-
*
102-
* @throws NoConfigurationException on no configured deprecation
103-
*
104-
* @deprecated since Symfony 5.1, use "getDeprecation()" instead.
105-
*/
106-
public function getDeprecationMessage(string $option)
107-
{
108-
trigger_deprecation('symfony/options-resolver', '5.1', 'The "%s()" method is deprecated, use "getDeprecation()" instead.', __METHOD__);
109-
110-
return $this->getDeprecation($option)['message'];
111-
}
112-
11399
/**
114100
* @throws NoConfigurationException on no configured deprecation
115101
*/

‎src/Symfony/Component/OptionsResolver/OptionsResolver.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/OptionsResolver/OptionsResolver.php
+1-14Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ public function isNested(string $option): bool
449449
* @param string $version The version of the package that introduced the deprecation
450450
* @param string|\Closure $message The deprecation message to use
451451
*/
452-
public function setDeprecated(string $option/*, string $package, string $version, $message = 'The option "%name%" is deprecated.' */): self
452+
public function setDeprecated(string $option, string $package, string $version, $message = 'The option "%name%" is deprecated.'): self
453453
{
454454
if ($this->locked) {
455455
throw new AccessException('Options cannot be deprecated from a lazy option or normalizer.');
@@ -459,19 +459,6 @@ public function setDeprecated(string $option/*, string $package, string $version
459459
throw new UndefinedOptionsException(sprintf('The option "%s" does not exist, defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
460460
}
461461

462-
$args = \func_get_args();
463-
464-
if (\func_num_args() < 3) {
465-
trigger_deprecation('symfony/options-resolver', '5.1', 'The signature of method "%s()" requires 2 new arguments: "string $package, string $version", not defining them is deprecated.', __METHOD__);
466-
467-
$message = $args[1] ?? 'The option "%name%" is deprecated.';
468-
$package = $version = '';
469-
} else {
470-
$package = $args[1];
471-
$version = $args[2];
472-
$message = $args[3] ?? 'The option "%name%" is deprecated.';
473-
}
474-
475462
if (!\is_string($message) && !$message instanceof \Closure) {
476463
throw new InvalidArgumentException(sprintf('Invalid type for deprecation message argument, expected string or \Closure, but got "%s".', get_debug_type($message)));
477464
}

‎src/Symfony/Component/OptionsResolver/Tests/Debug/OptionsResolverIntrospectorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/OptionsResolver/Tests/Debug/OptionsResolverIntrospectorTest.php
-26Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -215,32 +215,6 @@ public function testGetNormalizersThrowsOnNotDefinedOption()
215215
$debug->getNormalizers('foo');
216216
}
217217

218-
/**
219-
* @group legacy
220-
*/
221-
public function testGetDeprecationMessage()
222-
{
223-
$resolver = new OptionsResolver();
224-
$resolver->setDefined('foo');
225-
$resolver->setDeprecated('foo', 'The option "foo" is deprecated.');
226-
227-
$debug = new OptionsResolverIntrospector($resolver);
228-
$this->assertSame('The option "foo" is deprecated.', $debug->getDeprecationMessage('foo'));
229-
}
230-
231-
/**
232-
* @group legacy
233-
*/
234-
public function testGetClosureDeprecationMessage()
235-
{
236-
$resolver = new OptionsResolver();
237-
$resolver->setDefined('foo');
238-
$resolver->setDeprecated('foo', $closure = function (Options $options, $value) {});
239-
240-
$debug = new OptionsResolverIntrospector($resolver);
241-
$this->assertSame($closure, $debug->getDeprecationMessage('foo'));
242-
}
243-
244218
public function testGetDeprecation()
245219
{
246220
$resolver = new OptionsResolver();

‎src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
+2-15Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ public function testFailIfSetDeprecatedFromLazyOption()
452452
$this->resolver
453453
->setDefault('bar', 'baz')
454454
->setDefault('foo', function (Options $options) {
455-
$options->setDeprecated('bar');
455+
$options->setDeprecated('bar', 'vendor/package', '1.1');
456456
})
457457
->resolve()
458458
;
@@ -461,7 +461,7 @@ public function testFailIfSetDeprecatedFromLazyOption()
461461
public function testSetDeprecatedFailsIfUnknownOption()
462462
{
463463
$this->expectException(UndefinedOptionsException::class);
464-
$this->resolver->setDeprecated('foo');
464+
$this->resolver->setDeprecated('foo', 'vendor/package', '1.1');
465465
}
466466

467467
public function testSetDeprecatedFailsIfInvalidDeprecationMessageType()
@@ -2492,19 +2492,6 @@ public function testInfoOnInvalidValue()
24922492
$this->resolver->resolve(['expires' => new \DateTime('-1 hour')]);
24932493
}
24942494

2495-
/**
2496-
* @group legacy
2497-
*/
2498-
public function testSetDeprecatedWithoutPackageAndVersion()
2499-
{
2500-
$this->expectDeprecation('Since symfony/options-resolver 5.1: The signature of method "Symfony\Component\OptionsResolver\OptionsResolver::setDeprecated()" requires 2 new arguments: "string $package, string $version", not defining them is deprecated.');
2501-
2502-
$this->resolver
2503-
->setDefined('foo')
2504-
->setDeprecated('foo')
2505-
;
2506-
}
2507-
25082495
public function testInvalidValueForPrototypeDefinition()
25092496
{
25102497
$this->expectException(InvalidOptionsException::class);

0 commit comments

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