Skip to content
Snippets Groups Projects
Commit 3a2eeaf6 authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Slightly improve Psalm type-detection

parent e111a65c
No related branches found
No related tags found
No related merge requests found
...@@ -613,7 +613,7 @@ class Configuration implements Utils\ClearableState ...@@ -613,7 +613,7 @@ class Configuration implements Utils\ClearableState
* The default value can be null or a boolean. * The default value can be null or a boolean.
* *
* @return bool|null The option with the given name, or $default. * @return bool|null The option with the given name, or $default.
* @psalm-return ($default is null ? null : bool) * @psalm-return ($default is set ? bool|null : bool)
* *
* @throws \SimpleSAML\Assert\AssertionFailedException If the option is not boolean. * @throws \SimpleSAML\Assert\AssertionFailedException If the option is not boolean.
*/ */
...@@ -667,7 +667,7 @@ class Configuration implements Utils\ClearableState ...@@ -667,7 +667,7 @@ class Configuration implements Utils\ClearableState
* The default value can be null or a string. * The default value can be null or a string.
* *
* @return string|null The option with the given name, or $default if the option isn't found. * @return string|null The option with the given name, or $default if the option isn't found.
* @psalm-return ($default is null ? null : string) * @psalm-return ($default is set ? string|null : string)
* *
* @throws \SimpleSAML\Assert\AssertionFailedException If the option is not a string. * @throws \SimpleSAML\Assert\AssertionFailedException If the option is not a string.
*/ */
...@@ -721,7 +721,7 @@ class Configuration implements Utils\ClearableState ...@@ -721,7 +721,7 @@ class Configuration implements Utils\ClearableState
* The default value can be null or an integer. * The default value can be null or an integer.
* *
* @return int|null The option with the given name, or $default if the option isn't found. * @return int|null The option with the given name, or $default if the option isn't found.
* @psalm-return ($default is null ? null : int) * @psalm-return ($default is set ? int|null : int)
* *
* @throws \SimpleSAML\Assert\AssertionFailedException If the option is not an integer. * @throws \SimpleSAML\Assert\AssertionFailedException If the option is not an integer.
*/ */
...@@ -792,7 +792,7 @@ class Configuration implements Utils\ClearableState ...@@ -792,7 +792,7 @@ class Configuration implements Utils\ClearableState
* *
* @return int|null The option with the given name, or $default if the option isn't found and $default is * @return int|null The option with the given name, or $default if the option isn't found and $default is
* specified. * specified.
* @psalm-return ($default is null ? null : int) * @psalm-return ($default is set ? int|null : int)
* *
* @throws \SimpleSAML\Assert\AssertionFailedException If the option is not in the range specified. * @throws \SimpleSAML\Assert\AssertionFailedException If the option is not in the range specified.
*/ */
...@@ -917,7 +917,7 @@ class Configuration implements Utils\ClearableState ...@@ -917,7 +917,7 @@ class Configuration implements Utils\ClearableState
* *
* @return array|null The option with the given name, or $default if the option isn't found and $default is * @return array|null The option with the given name, or $default if the option isn't found and $default is
* specified. * specified.
* @psalm-return ($default is null ? null : array) * @psalm-return ($default is set ? array|null : array)
* *
* @throws \SimpleSAML\Assert\AssertionFailedException If the option is not an array. * @throws \SimpleSAML\Assert\AssertionFailedException If the option is not an array.
*/ */
...@@ -965,7 +965,7 @@ class Configuration implements Utils\ClearableState ...@@ -965,7 +965,7 @@ class Configuration implements Utils\ClearableState
* The default value can be null or an array. * The default value can be null or an array.
* *
* @return array|null The option with the given name. * @return array|null The option with the given name.
* @psalm-return ($default is null ? null : array) * @psalm-return ($default is set ? array|null : array)
*/ */
public function getOptionalArrayize(string $name, $default): ?array public function getOptionalArrayize(string $name, $default): ?array
{ {
...@@ -1016,7 +1016,7 @@ class Configuration implements Utils\ClearableState ...@@ -1016,7 +1016,7 @@ class Configuration implements Utils\ClearableState
* The default value can be null or an array of strings. * The default value can be null or an array of strings.
* *
* @return string[]|null The option with the given name, or $default if the option isn't found and $default is specified. * @return string[]|null The option with the given name, or $default if the option isn't found and $default is specified.
* @psalm-return ($default is null ? null : array) * @psalm-return ($default is set ? array|null : array)
* *
* @throws \SimpleSAML\Assert\AssertionFailedException If the option is not a string or an array of strings. * @throws \SimpleSAML\Assert\AssertionFailedException If the option is not a string or an array of strings.
*/ */
...@@ -1074,7 +1074,7 @@ class Configuration implements Utils\ClearableState ...@@ -1074,7 +1074,7 @@ class Configuration implements Utils\ClearableState
* *
* @return \SimpleSAML\Configuration|null The option with the given name, * @return \SimpleSAML\Configuration|null The option with the given name,
* or $default, converted into a Configuration object. * or $default, converted into a Configuration object.
* @psalm-return ($default is null ? null : \SimpleSAML\Configuration) * @psalm-return ($default is set ? \SimpleSAML\Configuration|null : \SimpleSAML\Configuration)
* *
* @throws \SimpleSAML\Assert\AssertionFailedException If the option is not an array. * @throws \SimpleSAML\Assert\AssertionFailedException If the option is not an array.
*/ */
...@@ -1324,7 +1324,7 @@ class Configuration implements Utils\ClearableState ...@@ -1324,7 +1324,7 @@ class Configuration implements Utils\ClearableState
* @param mixed $default The default value. * @param mixed $default The default value.
* *
* @return array|null Associative array with language => string pairs, or the provided default value. * @return array|null Associative array with language => string pairs, or the provided default value.
* @psalm-return ($default is null ? null : array) * @psalm-return ($default is set ? array|null : array)
* *
* @throws \SimpleSAML\Assert\AssertionFailedException * @throws \SimpleSAML\Assert\AssertionFailedException
* If the translation is not an array or a string, or its index or value are not strings. * If the translation is not an array or a string, or its index or value are not strings.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment