8000 [OptionResolver] Add type-hints to OptionResolver class by jschaedl · Pull Request #32235 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[OptionResolver] Add type-hints to OptionResolver class #32235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/Symfony/Component/OptionsResolver/OptionsResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class OptionsResolver implements Options
*
* @throws AccessException If called from a lazy option or normalizer
*/
public function setDefault($option, $value)
public function setDefault(string $option, $value)
{
// Setting is not possible once resolving starts, because then lazy
// options could manipulate the state of the object, leading to
Expand Down Expand Up @@ -257,7 +257,7 @@ public function setDefaults(array $defaults)
*
* @return bool Whether a default value is set
*/
public function hasDefault($option)
public function hasDefault(string $option)
{
return \array_key_exists($option, $this->defaults);
}
Expand Down Expand Up @@ -294,7 +294,7 @@ public function setRequired($optionNames)
*
* @return bool Whether the option is required
*/
public function isRequired($option)
public function isRequired(string $option)
{
return isset($this->required[$option]);
}
Expand Down Expand Up @@ -322,7 +322,7 @@ public function getRequiredOptions()
*
* @return bool Whether the option is missing
*/
public function isMissing($option)
public function isMissing(string $option)
{
return isset($this->required[$option]) && !\array_key_exists($option, $this->defaults);
}
Expand Down Expand Up @@ -375,7 +375,7 @@ public function setDefined($optionNames)
*
* @return bool Whether the option is defined
*/
public function isDefined($option)
public function isDefined(string $option)
{
return isset($this->defined[$option]);
}
Expand Down Expand Up @@ -474,7 +474,7 @@ public function isDeprecated(string $option): bool
* @throws UndefinedOptionsException If the option is undefined
* @throws AccessException If called from a lazy option or normalizer
*/
public function setNormalizer($option, \Closure $normalizer)
public function setNormalizer(string $option, \Closure $normalizer)
{
if ($this->locked) {
throw new AccessException('Normalizers cannot be set from a lazy option or normalizer.');
Expand Down Expand Up @@ -562,7 +562,7 @@ public function addNormalizer(string $option, \Closure $normalizer, bool $forceP
* @throws UndefinedOptionsException If the option is undefined
* @throws AccessException If called from a lazy option or normalizer
*/
public function setAllowedValues($option, $allowedValues)
public function setAllowedValues(string $option, $allowedValues)
{
if ($this->locked) {
throw new AccessException('Allowed values cannot be set from a lazy option or normalizer.');
Expand Down Expand Up @@ -603,7 +603,7 @@ public function setAllowedValues($option, $allowedValues)
* @throws UndefinedOptionsException If the option is undefined
* @throws AccessException If called from a lazy option or normalizer
*/
public function addAllowedValues($option, $allowedValues)
public function addAllowedValues(string $option, $allowedValues)
{
if ($this->locked) {
throw new AccessException('Allowed values cannot be added from a lazy option or normalizer.');
Expand Down Expand Up @@ -644,7 +644,7 @@ public function addAllowedValues($option, $allowedValues)
* @throws UndefinedOptionsException If the option is undefined
* @throws AccessException If called from a lazy option or normalizer
*/
public function setAllowedTypes($option, $allowedTypes)
public function setAllowedTypes(string $option, $allowedTypes)
{
if ($this->locked) {
throw new AccessException('Allowed types cannot be set from a lazy option or normalizer.');
Expand Down Expand Up @@ -679,7 +679,7 @@ public function setAllowedTypes($option, $allowedTypes)
* @throws UndefinedOptionsException If the option is undefined
* @throws AccessException If called from a lazy option or normalizer
*/
public function addAllowedTypes($option, $allowedTypes)
public function addAllowedTypes(string $option, $allowedTypes)
{
if ($this->locked) {
throw new AccessException('Allowed types cannot be added from a lazy option or normalizer.');
Expand Down
0