Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f2ad947

Browse files
committed
log warning
1 parent c2944ac commit f2ad947

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/Symfony/Component/OptionsResolver/OptionsResolver.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,9 @@ public function setAllowedValues($option, $allowedValues)
552552
throw new AccessException('Allowed values cannot be set from a lazy option or normalizer.');
553553
}
554554

555-
// Not supported for nested options
556555
if ($this->isNested($option)) {
556+
@trigger_error(sprintf('The "%s" method should not be used with nested options. A failed attempt occurred with the option "%" for values %s', __METHOD__, $option, $this->formatValues($allowedValues)), E_USER_WARNING);
557+
557558
return $this;
558559
}
559560

@@ -602,8 +603,9 @@ public function addAllowedValues($option, $allowedValues)
602603
throw new AccessException('Allowed values cannot be added from a lazy option or normalizer.');
603604
}
604605

605-
// Not supported for nested options
606606
if ($this->isNested($option)) {
607+
@trigger_error(sprintf('The "%s" method should not be used with nested options. A failed attempt occurred with the option "%" for values %s', __METHOD__, $option, $this->formatValues($allowedValues)), E_USER_WARNING);
608+
607609
return $this;
608610
}
609611

@@ -652,8 +654,9 @@ public function setAllowedTypes($option, $allowedTypes)
652654
throw new AccessException('Allowed types cannot be set from a lazy option or normalizer.');
653655
}
654656

655-
// Not supported for nested options
656657
if ($this->isNested($option)) {
658+
@trigger_error(sprintf('The "%s" method should not be used with nested options. A failed attempt occurred with the option "%" for types %s', __METHOD__, $option, $this->formatValues($allowedTypes)), E_USER_WARNING);
659+
657660
return $this;
658661
}
659662

@@ -696,8 +699,9 @@ public function addAllowedTypes($option, $allowedTypes)
696699
throw new AccessException('Allowed types cannot be added from a lazy option or normalizer.');
697700
}
698701

699-
// Not supported for nested options
700702
if ($this->isNested($option)) {
703+
@trigger_error(sprintf('The "%s" method should not be used with nested options. A failed attempt occurred with the option "%" for types %s', __METHOD__, $option, $this->formatValues($allowedTypes)), E_USER_WARNING);
704+
701705
return $this;
702706
}
703707

0 commit comments

Comments
 (0)