Skip to content

Commit 32fdf8a

Browse files
committed
Psalm-fixes
1 parent 10338ad commit 32fdf8a

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

src/XMLSecEnc.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,16 @@ class XMLSecEnc
7070
/** @var string */
7171
public const XMLENCNS = 'http://www.w3.org/2001/04/xmlenc#';
7272

73-
/** @var null|\DOMDocument */
73+
/** @var \DOMDocument|null */
7474
private $encdoc = null;
7575

76-
/** @var null|\DOMNode */
76+
/** @var \DOMNode|null */
7777
private $rawNode = null;
7878

79-
/** @var null|string */
79+
/** @var string|null */
8080
public $type = null;
8181

82-
/** @var null|\DOMElement */
82+
/** @var \DOMElement|null */
8383
public $encKey = null;
8484

8585
/** @var array */
@@ -111,10 +111,6 @@ private function resetTemplate(): void
111111
*/
112112
public function addReference(string $name, DOMNode $node, string $type): void
113113
{
114-
if (!($node instanceof DOMNode)) {
115-
throw new Exception('$node is not of type DOMNode');
116-
}
117-
118114
$curencdoc = $this->encdoc;
119115
$this->resetTemplate();
120116
$encdoc = $this->encdoc;

src/XMLSecurityDSig.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ private function canonicalizeData(
305305

306306
if (
307307
is_null($arXPath)
308-
&& ($node instanceof DOMNode)
309308
&& ($node->ownerDocument !== null)
310309
&& $node->isSameNode($node->ownerDocument->documentElement)
311310
) {
@@ -432,9 +431,9 @@ public function validateDigest(DOMNode $refNode, string $data): bool
432431
* @param \DOMNode $refNode
433432
* @param \DOMNode $objData
434433
* @param bool $includeCommentNodes
435-
* @return string
434+
* @return \DOMNode|string
436435
*/
437-
public function processTransforms(DOMNode $refNode, DOMNode $objData, bool $includeCommentNodes = true): string
436+
public function processTransforms(DOMNode $refNode, DOMNode $objData, bool $includeCommentNodes = true)
438437
{
439438
$data = $objData;
440439
$xpath = new DOMXPath($refNode->ownerDocument);
@@ -822,7 +821,7 @@ public function addReferenceList(
822821

823822

824823
/**
825-
* @param \DOMElement|string $data
824+
* @param \DOMElement $data
826825
* @param string|null $mimetype
827826
* @param string|null $encoding
828827
* @return \DOMElement

src/XMLSecurityKey.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -842,9 +842,9 @@ public function serializeKey($parent): void
842842
* Will return the X509 certificate in PEM-format if this key represents
843843
* an X509 certificate.
844844
*
845-
* @return string The X509 certificate or null if this key doesn't represent an X509-certificate.
845+
* @return string|null The X509 certificate or null if this key doesn't represent an X509-certificate.
846846
*/
847-
public function getX509Certificate(): string
847+
public function getX509Certificate(): ?string
848848
{
849849
return $this->x509Certificate;
850850
}
@@ -857,9 +857,9 @@ public function getX509Certificate(): string
857857
* The thumbprint as a lowercase 40-character hexadecimal number, or null
858858
* if this isn't a X509 certificate.
859859
*
860-
* @return string Lowercase 40-character hexadecimal number of thumbprint
860+
* @return string|null Lowercase 40-character hexadecimal number of thumbprint
861861
*/
862-
public function getX509Thumbprint(): string
862+
public function getX509Thumbprint(): ?string
863863
{
864864
return $this->X509Thumbprint;
865865
}

0 commit comments

Comments
 (0)