diff --git a/ChoiceList/LazyChoiceList.php b/ChoiceList/LazyChoiceList.php index 227c6e8f50..e8e37b3595 100644 --- a/ChoiceList/LazyChoiceList.php +++ b/ChoiceList/LazyChoiceList.php @@ -83,7 +83,7 @@ public function getChoices() // We can safely invoke the {@link ChoiceLoaderInterface} assuming it has the list // in cache when the lazy list is already loaded if ($this->loadedList !== $this->loader->loadChoiceList($this->value)) { - @trigger_error(sprintf('Caching the choice list in %s is deprecated since 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class)); + @trigger_error(sprintf('Caching the choice list in %s is deprecated since 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), E_USER_DEPRECATED); } return $this->loadedList->getChoices(); @@ -106,7 +106,7 @@ public function getValues() if ($this->loaded) { // Check whether the loader has the same cache if ($this->loadedList !== $this->loader->loadChoiceList($this->value)) { - @trigger_error(sprintf('Caching the choice list in %s is deprecated since 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class)); + @trigger_error(sprintf('Caching the choice list in %s is deprecated since 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), E_USER_DEPRECATED); } return $this->loadedList->getValues(); @@ -129,7 +129,7 @@ public function getStructuredValues() if ($this->loaded) { // Check whether the loader has the same cache if ($this->loadedList !== $this->loader->loadChoiceList($this->value)) { - @trigger_error(sprintf('Caching the choice list in %s is deprecated since 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class)); + @trigger_error(sprintf('Caching the choice list in %s is deprecated since 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), E_USER_DEPRECATED); } return $this->loadedList->getStructuredValues(); @@ -152,7 +152,7 @@ public function getOriginalKeys() if ($this->loaded) { // Check whether the loader has the same cache if ($this->loadedList !== $this->loader->loadChoiceList($this->value)) { - @trigger_error(sprintf('Caching the choice list in %s is deprecated since 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class)); + @trigger_error(sprintf('Caching the choice list in %s is deprecated since 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), E_USER_DEPRECATED); } return $this->loadedList->getOriginalKeys(); @@ -175,7 +175,7 @@ public function getChoicesForValues(array $values) if ($this->loaded) { // Check whether the loader has the same cache if ($this->loadedList !== $this->loader->loadChoiceList($this->value)) { - @trigger_error(sprintf('Caching the choice list in %s is deprecated since 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class)); + @trigger_error(sprintf('Caching the choice list in %s is deprecated since 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), E_USER_DEPRECATED); } return $this->loadedList->getChoicesForValues($values); @@ -192,7 +192,7 @@ public function getValuesForChoices(array $choices) if ($this->loaded) { // Check whether the loader has the same cache if ($this->loadedList !== $this->loader->loadChoiceList($this->value)) { - @trigger_error(sprintf('Caching the choice list in %s is deprecated since 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class)); + @trigger_error(sprintf('Caching the choice list in %s is deprecated since 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), E_USER_DEPRECATED); } return $this->loadedList->getValuesForChoices($choices); diff --git a/Tests/SimpleFormTest.php b/Tests/SimpleFormTest.php index d4d74c28d0..481817b412 100644 --- a/Tests/SimpleFormTest.php +++ b/Tests/SimpleFormTest.php @@ -314,6 +314,10 @@ public function testValidIfSubmittedAndDisabled() $this->assertTrue($form->isValid()); } + /** + * @group legacy + * @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered + */ public function testNotValidIfNotSubmitted() { ErrorAssert::assertDeprecationsAreTriggered(array('Call Form::isValid() with an unsubmitted form'), function () {