8000 minor #32235 [OptionResolver] Add type-hints to OptionResolver class … · symfony/symfony@7485b6f · GitHub
[go: up one dir, main page]

Skip to content

Commit 7485b6f

Browse files
committed
minor #32235 [OptionResolver] Add type-hints to OptionResolver class (jschaedl)
This PR was merged into the 5.0-dev branch. Discussion ---------- [OptionResolver] Add type-hints to OptionResolver class | Q | A | ------------- | --- | Branch? | master <!-- see below --> | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #32179 <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | N/A <!-- required for new features --> This PR adds type hints to the `OptionResolver` class. Commits ------- b26b37d [OptionResolver] Add type-hints to OptionResolver class
2 parents aaf3ae0 + b26b37d commit 7485b6f

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/Symfony/Component/OptionsResolver/OptionsResolver.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class OptionsResolver implements Options
163163
*
164164
* @throws AccessException If called from a lazy option or normalizer
165165
*/
166-
public function setDefault($option, $value)
166+
public function setDefault(string $option, $value)
167167
{
168168
// Setting is not possible once resolving starts, because then lazy
169169
// options could manipulate the state of the object, leading to
@@ -257,7 +257,7 @@ public function setDefaults(array $defaults)
257257
*
258258
* @return bool Whether a default value is set
259259
*/
260-
public function hasDefault($option)
260+
public function hasDefault(string $option)
261261
{
262262
return \array_key_exists($option, $this->defaults);
263263
}
@@ -294,7 +294,7 @@ public function setRequired($optionNames)
294294
*
295295
* @return bool Whether the option is required
296296
*/
297-
public function isRequired($option)
297+
public function isRequired(string $option)
298298
{
299299
return isset($this->required[$option]);
300300
}
@@ -322,7 +322,7 @@ public function getRequiredOptions()
322322
*
323323
* @return bool Whether the option is missing
324324
*/
325-
public function isMissing($option)
325+
public function isMissing(string $option)
326326
{
327327
return isset($this->required[$option]) && !\array_key_exists($option, $this->defaults);
328328
}
@@ -375,7 +375,7 @@ public function setDefined($optionNames)
375375
*
376376
* @return bool Whether the option is defined
377377
*/
378-
public function isDefined($option)
378+
public function isDefined(string $option)
379379
{
380380
return isset($this->defined[$option]);
381381
}
@@ -474,7 +474,7 @@ public function isDeprecated(string $option): bool
474474
* @throws UndefinedOptionsException If the option is undefined
475475
* @throws AccessException If called from a lazy option or normalizer
476476
*/
477-
public function setNormalizer($option, \Closure $normalizer)
477+
public function setNormalizer(string $option, \Closure $normalizer)
478478
{
479479
if ($this->locked) {
480480
throw new AccessException('Normalizers cannot be set from a lazy option or normalizer.');
@@ -562,7 +562,7 @@ public function addNormalizer(string $option, \Closure $normalizer, bool $forceP
562562
* @throws UndefinedOptionsException If the option is undefined
563563
* @throws AccessException If called from a lazy option or normalizer
564564
*/
565-
public function setAllowedValues($option, $allowedValues)
565+
public function setAllowedValues(string $option, $allowedValues)
566566
{
567567
if ($this->locked) {
568568
throw new AccessException('Allowed values cannot be set from a lazy option or normalizer.');
@@ -603,7 +603,7 @@ public function setAllowedValues($option, $allowedValues)
603603
* @throws UndefinedOptionsException If the option is undefined
604604
* @throws AccessException If called from a lazy option or normalizer
605605
*/
606-
public function addAllowedValues($option, $allowedValues)
606+
public function addAllowedValues(string $option, $allowedValues)
607607
{
608608
if ($this->locked) {
609609
throw new AccessException('Allowed values cannot be added from a lazy option or normalizer.');
@@ -644,7 +644,7 @@ public function addAllowedValues($option, $allowedValues)
644644
* @throws UndefinedOptionsException If the option is undefined
645645
* @throws AccessException If called from a lazy option or normalizer
646646
*/
647-
public function setAllowedTypes($option, $allowedTypes)
647+
public function setAllowedTypes(string $option, $allowedTypes)
648648
{
649649
if ($this->locked) {
650650
throw new AccessException('Allowed types cannot be set from a lazy option or normalizer.');
@@ -679,7 +679,7 @@ public function setAllowedTypes($option, $allowedTypes)
679679
* @throws UndefinedOptionsException If the option is undefined
680680
* @throws AccessException If called from a lazy option or normalizer
681681
*/
682-
public function addAllowedTypes($option, $allowedTypes)
682+
public function addAllowedTypes(string $option, $allowedTypes)
683683
{
684684
if ($this->locked) {
685685
throw new AccessException('Allowed types cannot be added from a lazy option or normalizer.');

0 commit comments

Comments
 (0)
0