Skip to content

Commit 64050b9

Browse files
committed
Fix several issues reported by PHPStan
1 parent 600ca20 commit 64050b9

28 files changed

Lines changed: 70 additions & 39 deletions

src/SAML2/XML/saml/AttributeValue.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,9 @@ public function getXsiType(): string
5656
case "NULL":
5757
return "xs:nil";
5858
case "object":
59-
/** @var \SimpleSAML\XML\AbstractElement $this->value */
6059
return sprintf(
6160
'%s:%s',
6261
$this->value::getNamespacePrefix(),
63-
":",
6462
AbstractElement::getClassName(get_class($this->value)),
6563
);
6664
default:

src/SAML2/XML/saml/AuthzDecisionStatement.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use DOMElement;
88
use SimpleSAML\Assert\Assert;
99
use SimpleSAML\SAML2\Constants as C;
10+
use SimpleSAML\SAML2\Exception\ProtocolViolationException;
1011
use SimpleSAML\SAML2\XML\Decision;
1112
use SimpleSAML\XML\Exception\InvalidDOMElementException;
1213
use SimpleSAML\XML\Exception\MissingElementException;
@@ -121,10 +122,11 @@ public static function fromXML(DOMElement $xml): static
121122
TooManyElementsException::class,
122123
);
123124

125+
$decision = self::getAttribute($xml, 'Decision');
124126
try {
125-
$decision = Decision::from(self::getAttribute($xml, 'Decision'));
127+
$decision = Decision::from($decision);
126128
} catch (ValueError) {
127-
throw ProtocolViolationException(sprintf('Unknown value \'%s\' for Decision attribute.', $decision));
129+
throw new ProtocolViolationException(sprintf('Unknown value \'%s\' for Decision attribute.', $decision));
128130
}
129131

130132
return new static(

src/SAML2/XML/saml/NameID.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use DOMElement;
88
use SimpleSAML\Assert\Assert;
99
use SimpleSAML\SAML2\Compat\ContainerSingleton;
10-
use SimpleSAML\XML\Exception\ArrayValidationException;
10+
use SimpleSAML\SAML2\Exception\ArrayValidationException;
1111
use SimpleSAML\XML\Exception\InvalidDOMElementException;
1212
use SimpleSAML\XMLSecurity\Backend\EncryptionBackend;
1313
use SimpleSAML\XMLSecurity\XML\EncryptableElementInterface;

src/SAML2/XML/samlp/StatusDetail.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static function fromXML(DOMElement $xml): static
7676
/**
7777
* Convert this StatusDetail to XML.
7878
*
79-
* @param \DOMElement|null $element The element we are converting to XML.
79+
* @param \DOMElement|null $parent The element we are converting to XML.
8080
* @return \DOMElement The XML element after adding the data corresponding to this StatusDetail.
8181
*/
8282
public function toXML(DOMElement $parent = null): DOMElement

src/SAML2/XML/shibmd/KeyAuthority.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ final class KeyAuthority extends AbstractShibmdElement
3232
* Create a KeyAuthority.
3333
*
3434
* @param \SimpleSAML\XMLSecurity\XML\ds\KeyInfo[] $keys
35-
* @param int|null $verifyDepth
35+
* @param int|null $VerifyDepth
3636
* @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes
3737
*/
3838
public function __construct(
@@ -101,7 +101,6 @@ public static function fromXML(DOMElement $xml): static
101101
*/
102102
public function toXML(DOMElement $parent = null): DOMElement
103103
{
104-
/** @psalm-var \DOMDocument $e->ownerDocument */
105104
$e = $this->instantiateParentElement($parent);
106105

107106
foreach ($this->getAttributesNS() as $attr) {

src/SAML2/XML/shibmd/Scope.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ public static function fromXML(DOMElement $xml): static
8787
*/
8888
public function toXML(DOMElement $parent = null): DOMElement
8989
{
90-
/** @psalm-var \DOMDocument $e->ownerDocument */
9190
$e = $this->instantiateParentElement($parent);
9291
$e->textContent = $this->getContent();
9392
$e->setAttribute('regexp', $this->isRegexpScope() ? 'true' : 'false');

tests/SAML2/Assertion/ProcessorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ final class ProcessorTest extends MockeryTestCase
3535
private static Processor $processor;
3636

3737
/**
38-
* @var m\MockInterface&Decrypter
38+
* @var MockInterface&Decrypter
3939
*/
4040
private static MockInterface $decrypter;
4141

tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ final class NameIdDecryptionTransformerTest extends TestCase
6868
/** @var \SimpleSAML\SAML2\Configuration\Destination */
6969
protected static Destination $destination;
7070

71-
/** @var \SimpleSAML\SAML2\xml\samlp\Response */
71+
/** @var \SimpleSAML\SAML2\XML\samlp\Response */
7272
protected static Response $response;
7373

7474
/** @var string */

tests/SAML2/Assertion/Validation/AssertionValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ final class AssertionValidatorTest extends TestCase
5656
/** @var \SimpleSAML\SAML2\Configuration\Destination */
5757
protected static Destination $destination;
5858

59-
/** @var \SimpleSAML\SAML2\xml\samlp\Response */
59+
/** @var \SimpleSAML\SAML2\XML\samlp\Response */
6060
protected static Response $response;
6161

6262

tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ final class SpIsValidAudienceTest extends MockeryTestCase
3737
/** @var \SimpleSAML\SAML2\XML\saml\Conditions */
3838
private static Conditions $conditions;
3939

40-
/** @var \SimpleSAML\SAML2\XML\saml\Isssuer */
40+
/** @var \SimpleSAML\SAML2\XML\saml\Issuer */
4141
private static Issuer $issuer;
4242

4343
/** @var \Mockery\MockInterface */

0 commit comments

Comments
 (0)