Skip to content

Commit

Permalink
Fix several issue reported by PHPstan
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Jan 20, 2024
1 parent 600ca20 commit 0b71cbc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/SAML2/XML/saml/AttributeValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,9 @@ public function getXsiType(): string
case "NULL":
return "xs:nil";
case "object":
/** @var \SimpleSAML\XML\AbstractElement $this->value */
return sprintf(
'%s:%s',
$this->value::getNamespacePrefix(),
":",
AbstractElement::getClassName(get_class($this->value)),
);
default:
Expand Down
6 changes: 4 additions & 2 deletions src/SAML2/XML/saml/AuthzDecisionStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use DOMElement;
use SimpleSAML\Assert\Assert;
use SimpleSAML\SAML2\Constants as C;
use SimpleSAML\SAML2\Exception\ProtocolViolationException;
use SimpleSAML\SAML2\XML\Decision;
use SimpleSAML\XML\Exception\InvalidDOMElementException;
use SimpleSAML\XML\Exception\MissingElementException;
Expand Down Expand Up @@ -121,10 +122,11 @@ public static function fromXML(DOMElement $xml): static
TooManyElementsException::class,
);

$decision = self::getAttribute($xml, 'Decision');
try {
$decision = Decision::from(self::getAttribute($xml, 'Decision'));
$decision = Decision::from($decision);
} catch (ValueError) {
throw ProtocolViolationException(sprintf('Unknown value \'%s\' for Decision attribute.', $decision));
throw new ProtocolViolationException(sprintf('Unknown value \'%s\' for Decision attribute.', $decision));
}

return new static(
Expand Down
2 changes: 1 addition & 1 deletion src/SAML2/XML/saml/NameID.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use DOMElement;
use SimpleSAML\Assert\Assert;
use SimpleSAML\SAML2\Compat\ContainerSingleton;
use SimpleSAML\XML\Exception\ArrayValidationException;
use SimpleSAML\SAML2\Exception\ArrayValidationException;
use SimpleSAML\XML\Exception\InvalidDOMElementException;
use SimpleSAML\XMLSecurity\Backend\EncryptionBackend;
use SimpleSAML\XMLSecurity\XML\EncryptableElementInterface;
Expand Down

0 comments on commit 0b71cbc

Please sign in to comment.