Skip to content

Commit 6d8486e

Browse files
authored
Psalm seemed to thing of "set" as a type (#1722)
1 parent 892beb7 commit 6d8486e

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

src/SimpleSAML/Configuration.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ public function getBoolean(string $name): bool
613613
* The default value can be null or a boolean.
614614
*
615615
* @return bool|null The option with the given name, or $default.
616-
* @psalm-return ($default is set ? bool|null : bool)
616+
* @psalm-return ($default is bool ? bool : bool|null)
617617
*
618618
* @throws \SimpleSAML\Assert\AssertionFailedException If the option is not boolean.
619619
*/
@@ -667,7 +667,7 @@ public function getString(string $name): string
667667
* The default value can be null or a string.
668668
*
669669
* @return string|null The option with the given name, or $default if the option isn't found.
670-
* @psalm-return ($default is set ? string|null : string)
670+
* @psalm-return ($default is string ? string : string|null)
671671
*
672672
* @throws \SimpleSAML\Assert\AssertionFailedException If the option is not a string.
673673
*/
@@ -717,11 +717,11 @@ public function getInteger(string $name): int
717717
* An exception will be thrown if this option isn't an integer.
718718
*
719719
* @param string $name The name of the option.
720-
* @param mixed $default A default value which will be returned if the option isn't found.
720+
* @param int|null $default A default value which will be returned if the option isn't found.
721721
* The default value can be null or an integer.
722722
*
723723
* @return int|null The option with the given name, or $default if the option isn't found.
724-
* @psalm-return ($default is set ? int|null : int)
724+
* @psalm-return ($default is int ? int : int|null)
725725
*
726726
* @throws \SimpleSAML\Assert\AssertionFailedException If the option is not an integer.
727727
*/
@@ -792,7 +792,7 @@ public function getIntegerRange(string $name, int $minimum, int $maximum): int
792792
*
793793
* @return int|null The option with the given name, or $default if the option isn't found and $default is
794794
* specified.
795-
* @psalm-return ($default is set ? int|null : int)
795+
* @psalm-return ($default is int ? int : int|null)
796796
*
797797
* @throws \SimpleSAML\Assert\AssertionFailedException If the option is not in the range specified.
798798
*/
@@ -917,7 +917,7 @@ public function getArray(string $name): array
917917
*
918918
* @return array|null The option with the given name, or $default if the option isn't found and $default is
919919
* specified.
920-
* @psalm-return ($default is set ? array|null : array)
920+
* @psalm-return ($default is array ? array : array|null)
921921
*
922922
* @throws \SimpleSAML\Assert\AssertionFailedException If the option is not an array.
923923
*/
@@ -965,7 +965,7 @@ public function getArrayize(string $name): array
965965
* The default value can be null or an array.
966966
*
967967
* @return array|null The option with the given name.
968-
* @psalm-return ($default is set ? array|null : array)
968+
* @psalm-return ($default is null ? array|null : array)
969969
*/
970970
public function getOptionalArrayize(string $name, $default): ?array
971971
{
@@ -1017,7 +1017,7 @@ public function getArrayizeString(string $name): array
10171017
*
10181018
* @return string[]|null The option with the given name, or $default if the option isn't found
10191019
* and $default is specified.
1020-
* @psalm-return ($default is set ? array|null : array)
1020+
* @psalm-return ($default is null ? array|null : array)
10211021
*
10221022
* @throws \SimpleSAML\Assert\AssertionFailedException If the option is not a string or an array of strings.
10231023
*/
@@ -1075,7 +1075,7 @@ public function getConfigItem(string $name): Configuration
10751075
*
10761076
* @return \SimpleSAML\Configuration|null The option with the given name,
10771077
* or $default, converted into a Configuration object.
1078-
* @psalm-return ($default is set ? \SimpleSAML\Configuration|null : \SimpleSAML\Configuration)
1078+
* @psalm-return ($default is array ? \SimpleSAML\Configuration : \SimpleSAML\Configuration|null)
10791079
*
10801080
* @throws \SimpleSAML\Assert\AssertionFailedException If the option is not an array.
10811081
*/
@@ -1325,10 +1325,10 @@ public function getLocalizedString(string $name): array
13251325
* The default language returned is always 'en'.
13261326
*
13271327
* @param string $name The name of the option.
1328-
* @param mixed $default The default value.
1328+
* @param array|null $default The default value.
13291329
*
13301330
* @return array|null Associative array with language => string pairs, or the provided default value.
1331-
* @psalm-return ($default is set ? array|null : array)
1331+
* @psalm-return ($default is array ? array : array|null)
13321332
*
13331333
* @throws \SimpleSAML\Assert\AssertionFailedException
13341334
* If the translation is not an array or a string, or its index or value are not strings.

0 commit comments

Comments
 (0)