remove not needed BC layer
This commit is contained in:
parent
e464954998
commit
1452619a52
@ -90,21 +90,8 @@ final class OptionConfigurator
|
|||||||
*
|
*
|
||||||
* @return $this
|
* @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);
|
$this->resolver->setDeprecated($this->name, $package, $version, $message);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -733,7 +733,7 @@ class OptionsResolver implements Options
|
|||||||
public function define(string $option): OptionConfigurator
|
public function define(string $option): OptionConfigurator
|
||||||
{
|
{
|
||||||
if (isset($this->defined[$option])) {
|
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);
|
return new OptionConfigurator($option, $this);
|
||||||
|
@ -2388,24 +2388,11 @@ class OptionsResolverTest extends TestCase
|
|||||||
public function testFailsIfOptionIsAlreadyDefined()
|
public function testFailsIfOptionIsAlreadyDefined()
|
||||||
{
|
{
|
||||||
$this->expectException('Symfony\Component\OptionsResolver\Exception\OptionDefinitionException');
|
$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');
|
||||||
$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()
|
public function testResolveOptionsDefinedByOptionConfigurator()
|
||||||
{
|
{
|
||||||
$this->resolver->define('foo')
|
$this->resolver->define('foo')
|
||||||
|
Reference in New Issue
Block a user