Skip to content

Commit

Permalink
Fix Psalm type detection
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed May 19, 2023
1 parent ff25e78 commit b0b18ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/AbstractElement.php
Expand Up @@ -87,7 +87,7 @@ public static function getAttribute(DOMElement $xml, string $name): string
* @param \DOMElement $xml The element where we should search for the attribute.
* @param string $name The name of the attribute.
* @param string|null $default The default to return in case the attribute does not exist and it is optional.
* @return ($default is null ? null : string)
* @psalm-return ($default is string ? string : string|null)
*/
public static function getOptionalAttribute(DOMElement $xml, string $name, ?string $default = null): ?string
{
Expand Down Expand Up @@ -128,7 +128,7 @@ public static function getBooleanAttribute(DOMElement $xml, string $name): bool
* @param \DOMElement $xml The element where we should search for the attribute.
* @param string $name The name of the attribute.
* @param bool|null $default The default to return in case the attribute does not exist and it is optional.
* @return ($default is null ? null : bool)
* @psalm-return ($default is bool ? bool : bool|null)
*
* @throws \SimpleSAML\Assert\AssertionFailedException if the attribute is not a boolean
*/
Expand Down Expand Up @@ -174,7 +174,7 @@ public static function getIntegerAttribute(DOMElement $xml, string $name): int
* @param \DOMElement $xml The element where we should search for the attribute.
* @param string $name The name of the attribute.
* @param int|null $default The default to return in case the attribute does not exist and it is optional.
* @return ($default is null ? null : int)
* @psalm-return ($default is int ? int : int|null)
*
* @throws \SimpleSAML\Assert\AssertionFailedException if the attribute is not an integer
*/
Expand Down
8 changes: 4 additions & 4 deletions src/Chunk.php
Expand Up @@ -182,7 +182,7 @@ public static function getAttribute(DOMElement $xml, string $name): string
* @param \DOMElement $xml The element where we should search for the attribute.
* @param string $name The name of the attribute.
* @param string|null $default The default to return in case the attribute does not exist and it is optional.
* @return ($default is null ? null : string)
* @psalm-return ($default is string ? string : null)
*/
public static function getOptionalAttribute(DOMElement $xml, string $name, ?string $default = null): ?string
{
Expand Down Expand Up @@ -219,8 +219,8 @@ public static function getBooleanAttribute(DOMElement $xml, string $name): bool
/**
* @param \DOMElement $xml The element where we should search for the attribute.
* @param string $name The name of the attribute.
* @param bool|null $default The default to return in case the attribute does not exist and it is optional.
* @return ($default is null ? null : bool)
* @param bool|int $default The default to return in case the attribute does not exist and it is optional.
* @psalm-return ($default is bool ? bool : null)
*
* @throws \SimpleSAML\Assert\AssertionFailedException if the attribute is not a boolean
*/
Expand Down Expand Up @@ -264,7 +264,7 @@ public static function getIntegerAttribute(DOMElement $xml, string $name): int
* @param \DOMElement $xml The element where we should search for the attribute.
* @param string $name The name of the attribute.
* @param int|null $default The default to return in case the attribute does not exist and it is optional.
* @return ($default is null ? null : int)
* @psalm-return ($default is int ? int : null)
*
* @throws \SimpleSAML\Assert\AssertionFailedException if the attribute is not an integer
*/
Expand Down

0 comments on commit b0b18ff

Please sign in to comment.