File tree 3 files changed +29
-19
lines changed
src/Symfony/Component/OptionsResolver
3 files changed +29
-19
lines changed Original file line number Diff line number Diff line change 1
1
CHANGELOG
2
2
=========
3
3
4
+ 5.0.0
5
+ -----
6
+
7
+ * added ` offsetGet() ` method to the ` Options ` interface with a new boolean argument ` $triggerDeprecation `
8
+
4
9
4.3.0
5
10
-----
6
11
Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \Component \OptionsResolver ;
13
13
14
+ use Symfony \Component \OptionsResolver \Exception \AccessException ;
15
+ use Symfony \Component \OptionsResolver \Exception \InvalidOptionsException ;
16
+ use Symfony \Component \OptionsResolver \Exception \NoSuchOptionException ;
17
+ use Symfony \Component \OptionsResolver \Exception \OptionDefinitionException ;
18
+
14
19
/**
15
20
* Contains resolved option values.
16
21
*
17
22
* @author Bernhard Schussek <[email protected] >
18
23
* @author Tobias Schultze <http://tobion.de>
19
- *
20
- * @method mixed offsetGet(string $option, bool $triggerDeprecation = true)
21
24
*/
22
25
interface Options extends \ArrayAccess, \Countable
23
26
{
27
+ /**
28
+ * Returns the resolved value of an option.
29
+ *
30
+ * @param string $option The option name
31
+ * @param bool $triggerDeprecation Whether to trigger the deprecation or not
32
+ *
33
+ * @return mixed The option value
34
+ *
35
+ * @throws AccessException If accessing this method outside of
36
+ * {@link resolve()}
37
+ * @throws NoSuchOptionException If the option is not set
38
+ * @throws InvalidOptionsException If the option doesn't fulfill the
39
+ * specified validation rules
40
+ * @throws OptionDefinitionException If there is a cyclic dependency between
41
+ * lazy options and/or normalizers
42
+ */
43
+ public function offsetGet ($ option , bool $ triggerDeprecation = true );
24
44
}
Original file line number Diff line number Diff line change @@ -825,29 +825,14 @@ public function resolve(array $options = [])
825
825
}
826
826
827
827
/**
828
- * Returns the resolved value of an option.
829
- *
830
- * @param string $option The option name
831
- * @param bool $triggerDeprecation Whether to trigger the deprecation or not (true by default)
832
- *
833
- * @return mixed The option value
834
- *
835
- * @throws AccessException If accessing this method outside of
836
- * {@link resolve()}
837
- * @throws NoSuchOptionException If the option is not set
838
- * @throws InvalidOptionsException If the option doesn't fulfill the
839
- * specified validation rules
840
- * @throws OptionDefinitionException If there is a cyclic dependency between
841
- * lazy options and/or normalizers
828
+ * {@inheritdoc}
842
829
*/
843
- public function offsetGet ($ option/* , bool $triggerDeprecation = true*/ )
830
+ public function offsetGet ($ option , bool $ triggerDeprecation = true )
844
831
{
845
832
if (!$ this ->locked ) {
846
833
throw new AccessException ('Array access is only supported within closures of lazy options and normalizers. ' );
847
834
}
848
835
849
- $ triggerDeprecation = 1 === \func_num_args () || \func_get_arg (1 );
850
-
851
836
// Shortcut for resolved options
852
837
if (isset ($ this ->resolved [$ option ]) || \array_key_exists ($ option , $ this ->resolved )) {
853
838
if ($ triggerDeprecation && isset ($ this ->deprecated [$ option ]) && (isset ($ this ->given [$ option ]) || $ this ->calling ) && \is_string ($ this ->deprecated [$ option ])) {
You can’t perform that action at this time.
0 commit comments