@@ -191,7 +191,7 @@ class OptionsResolver implements Options
191
191
*
192
192
* @throws AccessException If called from a lazy option or normalizer
193
193
*/
194
- public function setDefault (string $ option , mixed $ value )
194
+ public function setDefault (string $ option , mixed $ value ): static
195
195
{
196
196
// Setting is not possible once resolving starts, because then lazy
197
197
// options could manipulate the state of the object, leading to
@@ -262,7 +262,7 @@ public function setDefault(string $option, mixed $value)
262
262
*
263
263
* @throws AccessException If called from a lazy option or normalizer
264
264
*/
265
- public function setDefaults (array $ defaults )
265
+ public function setDefaults (array $ defaults ): static
266
266
{
267
267
foreach ($ defaults as $ option => $ value ) {
268
268
$ this ->setDefault ($ option , $ value );
@@ -279,7 +279,7 @@ public function setDefaults(array $defaults)
279
279
*
280
280
* @return bool Whether a default value is set
281
281
*/
282
- public function hasDefault (string $ option )
282
+ public function hasDefault (string $ option ): bool
283
283
{
284
284
return \array_key_exists ($ option , $ this ->defaults );
285
285
}
@@ -293,7 +293,7 @@ public function hasDefault(string $option)
293
293
*
294
294
* @throws AccessException If called from a lazy option or normalizer
295
295
*/
296
- public function setRequired (string |array $ optionNames )
296
+ public function setRequired (string |array $ optionNames ): static
297
297
{
298
298
if ($ this ->locked ) {
299
299
throw new AccessException ('Options cannot be made required from a lazy option or normalizer. ' );
@@ -314,7 +314,7 @@ public function setRequired(string|array $optionNames)
314
314
*
315
315
* @return bool Whether the option is required
316
316
*/
317
- public function isRequired (string $ option )
317
+ public function isRequired (string $ option ): bool
318
318
{
319
319
return isset ($ this ->required [$ option ]);
320
320
}
@@ -326,7 +326,7 @@ public function isRequired(string $option)
326
326
*
327
327
* @see isRequired()
328
328
*/
329
- public function getRequiredOptions ()
329
+ public function getRequiredOptions (): array
330
330
{
331
331
return array_keys ($ this ->required );
332
332
}
@@ -340,7 +340,7 @@ public function getRequiredOptions()
340
340
*
341
341
* @return bool Whether the option is missing
342
342
*/
343
- public function isMissing (string $ option )
343
+ public function isMissing (string $ option ): bool
344
344
{
345
345
return isset ($ this ->required [$ option ]) && !\array_key_exists ($ option , $ this ->defaults );
346
346
}
@@ -352,7 +352,7 @@ public function isMissing(string $option)
352
352
*
353
353
* @see isMissing()
354
354
*/
355
- public function getMissingOptions ()
355
+ public function getMissingOptions (): array
356
356
{
357
357
return array_keys (array_diff_key ($ this ->required , $ this ->defaults ));
358
358
}
@@ -370,7 +370,7 @@ public function getMissingOptions()
370
370
*
371
371
* @throws AccessException If called from a lazy option or normalizer
372
372
*/
373
- public function setDefined (string |array $ optionNames )
373
+ public function setDefined (string |array $ optionNames ): static
374
374
{
375
375
if ($ this ->locked ) {
376
376
throw new AccessException ('Options cannot be defined from a lazy option or normalizer. ' );
@@ -391,7 +391,7 @@ public function setDefined(string|array $optionNames)
391
391
*
392
392
* @return bool Whether the option is defined
393
393
*/
394
- public function isDefined (string $ option )
394
+ public function isDefined (string $ option ): bool
395
395
{
396
396
return isset ($ this ->defined [$ option ]);
397
397
}
@@ -403,7 +403,7 @@ public function isDefined(string $option)
403
403
*
404
404
* @see isDefined()
405
405
*/
406
- public function getDefinedOptions ()
406
+ public function getDefinedOptions (): array
407
407
{
408
408
return array_keys ($ this ->defined );
409
409
}
@@ -534,7 +534,7 @@ public function setNormalizer(string $option, \Closure $normalizer)
534
534
* @throws UndefinedOptionsException If the option is undefined
535
535
* @throws AccessException If called from a lazy option or normalizer
536
536
*/
537
- public function addNormalizer (string $ option , \Closure $ normalizer , bool $ forcePrepend = false ): self
537
+ public function addNormalizer (string $ option , \Closure $ normalizer , bool $ forcePrepend = false ): static
538
538
{
539
539
if ($ this ->locked ) {
540
540
throw new AccessException ('Normalizers cannot be set from a lazy option or normalizer. ' );
@@ -733,7 +733,7 @@ public function define(string $option): OptionConfigurator
733
733
* @throws UndefinedOptionsException If the option is undefined
734
734
* @throws AccessException If called from a lazy option or normalizer
735
735
*/
736
- public function setInfo (string $ option , string $ info ): self
736
+ public function setInfo (string $ option , string $ info ): static
737
737
{
738
738
if ($ this ->locked ) {
739
739
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
767
767
*
768
768
* @throws AccessException If called from a lazy option, a normalizer or a root definition
769
769
*/
770
- public function setPrototype (bool $ prototype ): self
770
+ public function setPrototype (bool $ prototype ): static
771
771
{
772
772
if ($ this ->locked ) {
773
773
throw new AccessException ('The prototype property cannot be set from a lazy option or normalizer. ' );
@@ -798,7 +798,7 @@ public function isPrototype(): bool
798
798
*
799
799
* @throws AccessException If called from a lazy option or normalizer
800
800
*/
801
- public function remove (string |array $ optionNames )
801
+ public function remove (string |array $ optionNames ): static
802
802
{
803
803
if ($ this ->locked ) {
804
804
throw new AccessException ('Options cannot be removed from a lazy option or normalizer. ' );
@@ -819,7 +819,7 @@ public function remove(string|array $optionNames)
819
819
*
820
820
* @throws AccessException If called from a lazy option or normalizer
821
821
*/
822
- public function clear ()
822
+ public function clear (): static
823
823
{
824
824
if ($ this ->locked ) {
825
825
throw new AccessException ('Options cannot be cleared from a lazy option or normalizer. ' );
@@ -862,7 +862,7 @@ public function clear()
862
862
* @throws NoSuchOptionException If a lazy option reads an unavailable option
863
863
* @throws AccessException If called from a lazy option or normalizer
864
864
*/
865
- public function resolve (array $ options = [])
865
+ public function resolve (array $ options = []): array
866
866
{
867
867
if ($ this ->locked ) {
868
868
throw new AccessException ('Options cannot be resolved from a lazy option or normalizer. ' );
0 commit comments