Skip to content

Commit

Permalink
Psalm-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed May 11, 2020
1 parent 10338ad commit 32fdf8a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
12 changes: 4 additions & 8 deletions src/XMLSecEnc.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ class XMLSecEnc
/** @var string */
public const XMLENCNS = 'http://www.w3.org/2001/04/xmlenc#';

/** @var null|\DOMDocument */
/** @var \DOMDocument|null */
private $encdoc = null;

/** @var null|\DOMNode */
/** @var \DOMNode|null */
private $rawNode = null;

/** @var null|string */
/** @var string|null */
public $type = null;

/** @var null|\DOMElement */
/** @var \DOMElement|null */
public $encKey = null;

/** @var array */
Expand Down Expand Up @@ -111,10 +111,6 @@ private function resetTemplate(): void
*/
public function addReference(string $name, DOMNode $node, string $type): void
{
if (!($node instanceof DOMNode)) {
throw new Exception('$node is not of type DOMNode');
}

$curencdoc = $this->encdoc;
$this->resetTemplate();
$encdoc = $this->encdoc;
Expand Down
7 changes: 3 additions & 4 deletions src/XMLSecurityDSig.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ private function canonicalizeData(

if (
is_null($arXPath)
&& ($node instanceof DOMNode)
&& ($node->ownerDocument !== null)
&& $node->isSameNode($node->ownerDocument->documentElement)
) {
Expand Down Expand Up @@ -432,9 +431,9 @@ public function validateDigest(DOMNode $refNode, string $data): bool
* @param \DOMNode $refNode
* @param \DOMNode $objData
* @param bool $includeCommentNodes
* @return string
* @return \DOMNode|string
*/
public function processTransforms(DOMNode $refNode, DOMNode $objData, bool $includeCommentNodes = true): string
public function processTransforms(DOMNode $refNode, DOMNode $objData, bool $includeCommentNodes = true)
{
$data = $objData;
$xpath = new DOMXPath($refNode->ownerDocument);
Expand Down Expand Up @@ -822,7 +821,7 @@ public function addReferenceList(


/**
* @param \DOMElement|string $data
* @param \DOMElement $data
* @param string|null $mimetype
* @param string|null $encoding
* @return \DOMElement
Expand Down
8 changes: 4 additions & 4 deletions src/XMLSecurityKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,9 @@ public function serializeKey($parent): void
* Will return the X509 certificate in PEM-format if this key represents
* an X509 certificate.
*
* @return string The X509 certificate or null if this key doesn't represent an X509-certificate.
* @return string|null The X509 certificate or null if this key doesn't represent an X509-certificate.
*/
public function getX509Certificate(): string
public function getX509Certificate(): ?string
{
return $this->x509Certificate;
}
Expand All @@ -857,9 +857,9 @@ public function getX509Certificate(): string
* The thumbprint as a lowercase 40-character hexadecimal number, or null
* if this isn't a X509 certificate.
*
* @return string Lowercase 40-character hexadecimal number of thumbprint
* @return string|null Lowercase 40-character hexadecimal number of thumbprint
*/
public function getX509Thumbprint(): string
public function getX509Thumbprint(): ?string
{
return $this->X509Thumbprint;
}
Expand Down

0 comments on commit 32fdf8a

Please sign in to comment.