Skip to content

Commit

Permalink
remove not needed BC layer
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Apr 21, 2020
1 parent e464954 commit 1452619
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 29 deletions.
15 changes: 1 addition & 14 deletions src/Symfony/Component/OptionsResolver/OptionConfigurator.php
Expand Up @@ -90,21 +90,8 @@ public function define(string $option): self
*
* @return $this
*/
public function deprecated(/*string $package, string $version, $message = 'The option "%name%" is deprecated.'*/): self
public function deprecated(string $package, string $version, $message = 'The option "%name%" is deprecated.'): self
{
$args = \func_get_args();

if (\func_num_args() < 2) {
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__);

$message = $args[0] ?? 'The option "%name%" is deprecated.';
$package = (string) $version = '';
} else {
$package = (string) $args[0];
$version = (string) $args[1];
$message = (string) ($args[2] ?? 'The option "%name%" is deprecated.');
}

$this->resolver->setDeprecated($this->name, $package, $version, $message);

return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/OptionsResolver/OptionsResolver.php
Expand Up @@ -733,7 +733,7 @@ public function addAllowedTypes(string $option, $allowedTypes)
public function define(string $option): OptionConfigurator
{
if (isset($this->defined[$option])) {
throw new OptionDefinitionException(sprintf('The options "%s" is already defined.', $option));
throw new OptionDefinitionException(sprintf('The option "%s" is already defined.', $option));
}

return new OptionConfigurator($option, $this);
Expand Down
Expand Up @@ -2388,24 +2388,11 @@ public function testAccessToParentOptionFromNestedNormalizerAndLazyOption()
public function testFailsIfOptionIsAlreadyDefined()
{
$this->expectException('Symfony\Component\OptionsResolver\Exception\OptionDefinitionException');
$this->expectExceptionMessage('The options "foo" is already defined.');
$this->expectExceptionMessage('The option "foo" is already defined.');
$this->resolver->define('foo');
$this->resolver->define('foo');
}

/**
* @group legacy
*/
public function testDeprecatedByOptionConfiguratorWithoutPackageAndVersion()
{
$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.');

$this->resolver
->define('foo')
->deprecated()
;
}

public function testResolveOptionsDefinedByOptionConfigurator()
{
$this->resolver->define('foo')
Expand Down

0 comments on commit 1452619

Please sign in to comment.