@@ -191,7 +191,7 @@ class OptionsResolver implements Options
191191 *
192192 * @throws AccessException If called from a lazy option or normalizer
193193 */
194- public function setDefault (string $ option , mixed $ value )
194+ public function setDefault (string $ option , mixed $ value ): static
195195 {
196196 // Setting is not possible once resolving starts, because then lazy
197197 // options could manipulate the state of the object, leading to
@@ -262,7 +262,7 @@ public function setDefault(string $option, mixed $value)
262262 *
263263 * @throws AccessException If called from a lazy option or normalizer
264264 */
265- public function setDefaults (array $ defaults )
265+ public function setDefaults (array $ defaults ): static
266266 {
267267 foreach ($ defaults as $ option => $ value ) {
268268 $ this ->setDefault ($ option , $ value );
@@ -279,7 +279,7 @@ public function setDefaults(array $defaults)
279279 *
280280 * @return bool Whether a default value is set
281281 */
282- public function hasDefault (string $ option )
282+ public function hasDefault (string $ option ): bool
283283 {
284284 return \array_key_exists ($ option , $ this ->defaults );
285285 }
@@ -293,7 +293,7 @@ public function hasDefault(string $option)
293293 *
294294 * @throws AccessException If called from a lazy option or normalizer
295295 */
296- public function setRequired (string |array $ optionNames )
296+ public function setRequired (string |array $ optionNames ): static
297297 {
298298 if ($ this ->locked ) {
299299 throw new AccessException ('Options cannot be made required from a lazy option or normalizer. ' );
@@ -314,7 +314,7 @@ public function setRequired(string|array $optionNames)
314314 *
315315 * @return bool Whether the option is required
316316 */
317- public function isRequired (string $ option )
317+ public function isRequired (string $ option ): bool
318318 {
319319 return isset ($ this ->required [$ option ]);
320320 }
@@ -326,7 +326,7 @@ public function isRequired(string $option)
326326 *
327327 * @see isRequired()
328328 */
329- public function getRequiredOptions ()
329+ public function getRequiredOptions (): array
330330 {
331331 return array_keys ($ this ->required );
332332 }
@@ -340,7 +340,7 @@ public function getRequiredOptions()
340340 *
341341 * @return bool Whether the option is missing
342342 */
343- public function isMissing (string $ option )
343+ public function isMissing (string $ option ): bool
344344 {
345345 return isset ($ this ->required [$ option ]) && !\array_key_exists ($ option , $ this ->defaults );
346346 }
@@ -352,7 +352,7 @@ public function isMissing(string $option)
352352 *
353353 * @see isMissing()
354354 */
355- public function getMissingOptions ()
355+ public function getMissingOptions (): array
356356 {
357357 return array_keys (array_diff_key ($ this ->required , $ this ->defaults ));
358358 }
@@ -370,7 +370,7 @@ public function getMissingOptions()
370370 *
371371 * @throws AccessException If called from a lazy option or normalizer
372372 */
373- public function setDefined (string |array $ optionNames )
373+ public function setDefined (string |array $ optionNames ): static
374374 {
375375 if ($ this ->locked ) {
376376 throw new AccessException ('Options cannot be defined from a lazy option or normalizer. ' );
@@ -391,7 +391,7 @@ public function setDefined(string|array $optionNames)
391391 *
392392 * @return bool Whether the option is defined
393393 */
394- public function isDefined (string $ option )
394+ public function isDefined (string $ option ): bool
395395 {
396396 return isset ($ this ->defined [$ option ]);
397397 }
@@ -403,7 +403,7 @@ public function isDefined(string $option)
403403 *
404404 * @see isDefined()
405405 */
406- public function getDefinedOptions ()
406+ public function getDefinedOptions (): array
407407 {
408408 return array_keys ($ this ->defined );
409409 }
@@ -534,7 +534,7 @@ public function setNormalizer(string $option, \Closure $normalizer)
534534 * @throws UndefinedOptionsException If the option is undefined
535535 * @throws AccessException If called from a lazy option or normalizer
536536 */
537- public function addNormalizer (string $ option , \Closure $ normalizer , bool $ forcePrepend = false ): self
537+ public function addNormalizer (string $ option , \Closure $ normalizer , bool $ forcePrepend = false ): static
538538 {
539539 if ($ this ->locked ) {
540540 throw new AccessException ('Normalizers cannot be set from a lazy option or normalizer. ' );
@@ -733,7 +733,7 @@ public function define(string $option): OptionConfigurator
733733 * @throws UndefinedOptionsException If the option is undefined
734734 * @throws AccessException If called from a lazy option or normalizer
735735 */
736- public function setInfo (string $ option , string $ info ): self
736+ public function setInfo (string $ option , string $ info ): static
737737 {
738738 if ($ this ->locked ) {
739739 throw new AccessException ('The Info message cannot be set from a lazy option or normalizer. ' );
@@ -767,7 +767,7 @@ public function getInfo(string $option): ?string
767767 *
768768 * @throws AccessException If called from a lazy option, a normalizer or a root definition
769769 */
770- public function setPrototype (bool $ prototype ): self
770+ public function setPrototype (bool $ prototype ): static
771771 {
772772 if ($ this ->locked ) {
773773 throw new AccessException ('The prototype property cannot be set from a lazy option or normalizer. ' );
@@ -798,7 +798,7 @@ public function isPrototype(): bool
798798 *
799799 * @throws AccessException If called from a lazy option or normalizer
800800 */
801- public function remove (string |array $ optionNames )
801+ public function remove (string |array $ optionNames ): static
802802 {
803803 if ($ this ->locked ) {
804804 throw new AccessException ('Options cannot be removed from a lazy option or normalizer. ' );
@@ -819,7 +819,7 @@ public function remove(string|array $optionNames)
819819 *
820820 * @throws AccessException If called from a lazy option or normalizer
821821 */
822- public function clear ()
822+ public function clear (): static
823823 {
824824 if ($ this ->locked ) {
825825 throw new AccessException ('Options cannot be cleared from a lazy option or normalizer. ' );
@@ -862,7 +862,7 @@ public function clear()
862862 * @throws NoSuchOptionException If a lazy option reads an unavailable option
863863 * @throws AccessException If called from a lazy option or normalizer
864864 */
865- public function resolve (array $ options = [])
865+ public function resolve (array $ options = []): array
866866 {
867867 if ($ this ->locked ) {
868868 throw new AccessException ('Options cannot be resolved from a lazy option or normalizer. ' );
0 commit comments