Skip to content

Commit 418c847

Browse files
committed
minor #36509 [OptionsResolver] remove not needed BC layer (xabbuh)
This PR was merged into the 5.1-dev branch. Discussion ---------- [OptionsResolver] remove not needed BC layer | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | Commits ------- 1452619 remove not needed BC layer
2 parents 3339244 + 1452619 commit 418c847

File tree

3 files changed

+3
-29
lines changed

3 files changed

+3
-29
lines changed

src/Symfony/Component/OptionsResolver/OptionConfigurator.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,21 +90,8 @@ public function define(string $option): self
9090
*
9191
* @return $this
9292
*/
93-
public function deprecated(/*string $package, string $version, $message = 'The option "%name%" is deprecated.'*/): self
93+
public function deprecated(string $package, string $version, $message = 'The option "%name%" is deprecated.'): self
9494
{
95-
$args = \func_get_args();
96-
97-
if (\func_num_args() < 2) {
98-
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__);
99-
100-
$message = $args[0] ?? 'The option "%name%" is deprecated.';
101-
$package = (string) $version = '';
102-
} else {
103-
$package = (string) $args[0];
104-
$version = (string) $args[1];
105-
$message = (string) ($args[2] ?? 'The option "%name%" is deprecated.');
106-
}
107-
10895
$this->resolver->setDeprecated($this->name, $package, $version, $message);
10996

11097
return $this;

src/Symfony/Component/OptionsResolver/OptionsResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ public function addAllowedTypes(string $option, $allowedTypes)
733733
public function define(string $option): OptionConfigurator
734734
{
735735
if (isset($this->defined[$option])) {
736-
throw new OptionDefinitionException(sprintf('The options "%s" is already defined.', $option));
736+
throw new OptionDefinitionException(sprintf('The option "%s" is already defined.', $option));
737737
}
738738

739739
return new OptionConfigurator($option, $this);

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

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2388,24 +2388,11 @@ public function testAccessToParentOptionFromNestedNormalizerAndLazyOption()
23882388
public function testFailsIfOptionIsAlreadyDefined()
23892389
{
23902390
$this->expectException('Symfony\Component\OptionsResolver\Exception\OptionDefinitionException');
2391-
$this->expectExceptionMessage('The options "foo" is already defined.');
2391+
$this->expectExceptionMessage('The option "foo" is already defined.');
23922392
$this->resolver->define('foo');
23932393
$this->resolver->define('foo');
23942394
}
23952395

2396-
/**
2397-
* @group legacy
2398-
*/
2399-
public function testDeprecatedByOptionConfiguratorWithoutPackageAndVersion()
2400-
{
2401-
$this->expectDeprecation('Since symfony/options-resolver 5.1: The signature of method "Symfony\Component\OptionsResolver\OptionConfigurator::deprecated()" requires 2 new arguments: "string $package, string $version", not defining them is deprecated.');
2402-
2403-
$this->resolver
2404-
->define('foo')
2405-
->deprecated()
2406-
;
2407-
}
2408-
24092396
public function testResolveOptionsDefinedByOptionConfigurator()
24102397
{
24112398
$this->resolver->define('foo')

0 commit comments

Comments
 (0)