Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[OptionsResolver] Ensure remove() also unsets deprecation status
  • Loading branch information
yoeunes committed Nov 11, 2025
commit 5ffa260fa434c0b2b665d552f3a5a5a9474b51a5
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ public function remove(string|array $optionNames): static

foreach ((array) $optionNames as $option) {
unset($this->defined[$option], $this->defaults[$option], $this->required[$option], $this->resolved[$option]);
unset($this->lazy[$option], $this->normalizers[$option], $this->allowedTypes[$option], $this->allowedValues[$option], $this->info[$option]);
unset($this->lazy[$option], $this->normalizers[$option], $this->allowedTypes[$option], $this->allowedValues[$option], $this->info[$option], $this->deprecated[$option]);
}

return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2566,4 +2566,33 @@ public function testPrototypeDefinition()

$this->assertSame($expectedOptions, $actualOptions);
}

public function testRemoveAlsoRemovesDeprecation()
{
$this->resolver->setDefined('foo');
$this->resolver->setDeprecated('foo', 'vendor/package', '1.0');
$this->assertTrue($this->resolver->isDeprecated('foo'));

$this->resolver->remove('foo');
$this->assertFalse($this->resolver->isDeprecated('foo'));

$this->resolver->setDefault('foo', 'bar');
$this->assertFalse($this->resolver->isDeprecated('foo'));

$count = 0;
set_error_handler(static function (int $type) use (&$count) {
if (\E_USER_DEPRECATED === $type) {
++$count;
}

return false;
});

try {
$this->resolver->resolve(['foo' => 'value']);
$this->assertSame(0, $count);
} finally {
restore_error_handler();
}
}
}
Loading