@@ -30,68 +30,68 @@ class OptionsResolver implements Options
3030 /**
3131 * The names of all defined options.
3232 */
33- private $ defined = array () ;
33+ private $ defined = [] ;
3434
3535 /**
3636 * The default option values.
3737 */
38- private $ defaults = array () ;
38+ private $ defaults = [] ;
3939
4040 /**
4141 * A list of closure for nested options.
4242 *
4343 * @var \Closure[][]
4444 */
45- private $ nested = array () ;
45+ private $ nested = [] ;
4646
4747 /**
4848 * The names of required options.
4949 */
50- private $ required = array () ;
50+ private $ required = [] ;
5151
5252 /**
5353 * The resolved option values.
5454 */
55- private $ resolved = array () ;
55+ private $ resolved = [] ;
5656
5757 /**
5858 * A list of normalizer closures.
5959 *
6060 * @var \Closure[]
6161 */
62- private $ normalizers = array () ;
62+ private $ normalizers = [] ;
6363
6464 /**
6565 * A list of accepted values for each option.
6666 */
67- private $ allowedValues = array () ;
67+ private $ allowedValues = [] ;
6868
6969 /**
7070 * A list of accepted types for each option.
7171 */
72- private $ allowedTypes = array () ;
72+ private $ allowedTypes = [] ;
7373
7474 /**
7575 * A list of closures for evaluating lazy options.
7676 */
77- private $ lazy = array () ;
77+ private $ lazy = [] ;
7878
7979 /**
8080 * A list of lazy options whose closure is currently being called.
8181 *
8282 * This list helps detecting circular dependencies between lazy options.
8383 */
84- private $ calling = array () ;
84+ private $ calling = [] ;
8585
8686 /**
8787 * A list of deprecated options.
8888 */
89- private $ deprecated = array () ;
89+ private $ deprecated = [] ;
9090
9191 /**
9292 * The list of options provided by the user.
9393 */
94- private $ given = array () ;
94+ private $ given = [] ;
9595
9696 /**
9797 * Whether the instance is locked for reading.
@@ -103,11 +103,11 @@ class OptionsResolver implements Options
103103 */
104104 private $ locked = false ;
105105
106- private static $ typeAliases = array (
106+ private static $ typeAliases = [
107107 'boolean ' => 'bool ' ,
108108 'integer ' => 'int ' ,
109109 'double ' => 'float ' ,
110- ) ;
110+ ] ;
111111
112112 /**
113113 * Sets the default value of a given option.
@@ -186,7 +186,7 @@ public function setDefault($option, $value)
186186
187187 // Ignore previous lazy options if the closure has no second parameter
188188 if (!isset ($ this ->lazy [$ option ]) || !isset ($ params [1 ])) {
189- $ this ->lazy [$ option ] = array () ;
189+ $ this ->lazy [$ option ] = [] ;
190190 }
191191
192192 // Store closure for later evaluation
@@ -202,7 +202,7 @@ public function setDefault($option, $value)
202202 if (isset ($ params [0 ]) && null !== ($ class = $ params [0 ]->getClass ()) && self ::class === $ class ->name && (!isset ($ params [1 ]) || (null !== ($ class = $ params [1 ]->getClass ()) && Options::class === $ class ->name ))) {
203203 // Store closure for later evaluation
204204 $ this ->nested [$ option ][] = $ value ;
205- $ this ->defaults [$ option ] = array () ;
205+ $ this ->defaults [$ option ] = [] ;
206206 $ this ->defined [$ option ] = true ;
207207
208208 // Make sure the option is processed and is not lazy anymore
@@ -523,7 +523,7 @@ public function setAllowedValues($option, $allowedValues)
523523 throw new UndefinedOptionsException (sprintf ('The option "%s" does not exist. Defined options are: "%s". ' , $ option , implode ('", " ' , array_keys ($ this ->defined ))));
524524 }
525525
526- $ this ->allowedValues [$ option ] = \is_array ($ allowedValues ) ? $ allowedValues : array ( $ allowedValues) ;
526+ $ this ->allowedValues [$ option ] = \is_array ($ allowedValues ) ? $ allowedValues : [ $ allowedValues] ;
527527
528528 // Make sure the option is processed
529529 unset($ this ->resolved [$ option ]);
@@ -565,7 +565,7 @@ public function addAllowedValues($option, $allowedValues)
565565 }
566566
567567 if (!\is_array ($ allowedValues )) {
568- $ allowedValues = array ( $ allowedValues) ;
568+ $ allowedValues = [ $ allowedValues] ;
569569 }
570570
571571 if (!isset ($ this ->allowedValues [$ option ])) {
@@ -690,16 +690,16 @@ public function clear()
690690 throw new AccessException ('Options cannot be cleared from a lazy option or normalizer. ' );
691691 }
692692
693- $ this ->defined = array () ;
694- $ this ->defaults = array () ;
695- $ this ->nested = array () ;
696- $ this ->required = array () ;
697- $ this ->resolved = array () ;
698- $ this ->lazy = array () ;
699- $ this ->normalizers = array () ;
700- $ this ->allowedTypes = array () ;
701- $ this ->allowedValues = array () ;
702- $ this ->deprecated = array () ;
693+ $ this ->defined = [] ;
694+ $ this ->defaults = [] ;
695+ $ this ->nested = [] ;
696+ $ this ->required = [] ;
697+ $ this ->resolved = [] ;
698+ $ this ->lazy = [] ;
699+ $ this ->normalizers = [] ;
700+ $ this ->allowedTypes = [] ;
701+ $ this ->allowedValues = [] ;
702+ $ this ->deprecated = [] ;
703703
704704 return $ this ;
705705 }
@@ -728,7 +728,7 @@ public function clear()
728728 * @throws NoSuchOptionException If a lazy option reads an unavailable option
729729 * @throws AccessException If called from a lazy option or normalizer
730730 */
731- public function resolve (array $ options = array () )
731+ public function resolve (array $ options = [] )
732732 {
733733 if ($ this ->locked ) {
734734 throw new AccessException ('Options cannot be resolved from a lazy option or normalizer. ' );
@@ -802,7 +802,7 @@ public function offsetGet($option/*, bool $triggerDeprecation = true*/)
802802 // Shortcut for resolved options
803803 if (isset ($ this ->resolved [$ option ]) || array_key_exists ($ option , $ this ->resolved )) {
804804 if ($ triggerDeprecation && isset ($ this ->deprecated [$ option ]) && (isset ($ this ->given [$ option ]) || $ this ->calling ) && \is_string ($ this ->deprecated [$ option ])) {
805- @trigger_error (strtr ($ this ->deprecated [$ option ], array ( '%name% ' => $ option) ), E_USER_DEPRECATED );
805+ @trigger_error (strtr ($ this ->deprecated [$ option ], [ '%name% ' => $ option] ), E_USER_DEPRECATED );
806806 }
807807
808808 return $ this ->resolved [$ option ];
@@ -869,7 +869,7 @@ public function offsetGet($option/*, bool $triggerDeprecation = true*/)
869869 // Validate the type of the resolved option
870870 if (isset ($ this ->allowedTypes [$ option ])) {
871871 $ valid = false ;
872- $ invalidTypes = array () ;
872+ $ invalidTypes = [] ;
873873
874874 foreach ($ this ->allowedTypes [$ option ] as $ type ) {
875875 $ type = self ::$ typeAliases [$ type ] ?? $ type ;
@@ -893,7 +893,7 @@ public function offsetGet($option/*, bool $triggerDeprecation = true*/)
893893 // Validate the value of the resolved option
894894 if (isset ($ this ->allowedValues [$ option ])) {
895895 $ success = false ;
896- $ printableAllowedValues = array () ;
896+ $ printableAllowedValues = [] ;
897897
898898 foreach ($ this ->allowedValues [$ option ] as $ allowedValue ) {
899899 if ($ allowedValue instanceof \Closure) {
@@ -954,7 +954,7 @@ public function offsetGet($option/*, bool $triggerDeprecation = true*/)
954954 }
955955
956956 if ('' !== $ deprecationMessage ) {
957- @trigger_error (strtr ($ deprecationMessage , array ( '%name% ' => $ option) ), E_USER_DEPRECATED );
957+ @trigger_error (strtr ($ deprecationMessage , [ '%name% ' => $ option] ), E_USER_DEPRECATED );
958958 }
959959 }
960960
0 commit comments