From 488154e3a56f6d047f84f071d7d4598f17e03072 Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Tue, 9 Feb 2021 13:49:04 +0100
Subject: [PATCH] Add www-directory to psalm-config and fix some issues

---
 psalm.xml                                   | 1 +
 www/saml2/idp/ArtifactResolutionService.php | 8 +++-----
 www/saml2/idp/metadata.php                  | 8 +++++---
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/psalm.xml b/psalm.xml
index 289695226..84000454d 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -22,6 +22,7 @@
         <directory name="modules/saml" />
 
         <directory name="tests" />
+        <directory name="www" />
 
         <!-- Ignore deprecated classes -->
         <ignoreFiles>
diff --git a/www/saml2/idp/ArtifactResolutionService.php b/www/saml2/idp/ArtifactResolutionService.php
index 162937c83..8da7681ae 100644
--- a/www/saml2/idp/ArtifactResolutionService.php
+++ b/www/saml2/idp/ArtifactResolutionService.php
@@ -47,10 +47,8 @@ if (!($request instanceof \SAML2\ArtifactResolve)) {
 }
 
 $issuer = $request->getIssuer();
-if (!is_string($issuer)) {
-    $issuer = $issuer->getValue();
-}
-
+\Webmozart\Assert\Assert::notNull($issuer);
+$issuer = $issuer->getValue();
 $spMetadata = $metadata->getMetaDataConfig($issuer, 'saml20-sp-remote');
 
 $artifact = $request->getArtifact();
@@ -60,7 +58,7 @@ $store->delete('artifact', $artifact);
 
 if ($responseData !== null) {
     $document = \SAML2\DOMDocumentFactory::fromString($responseData);
-    $responseXML = $document->firstChild;
+    $responseXML = $document->documentElement;
 } else {
     $responseXML = null;
 }
diff --git a/www/saml2/idp/metadata.php b/www/saml2/idp/metadata.php
index 05a195951..65fff2da7 100644
--- a/www/saml2/idp/metadata.php
+++ b/www/saml2/idp/metadata.php
@@ -200,9 +200,11 @@ try {
 
     $technicalContactEmail = $config->getString('technicalcontact_email', false);
     if ($technicalContactEmail && $technicalContactEmail !== 'na@example.org') {
-        $techcontact['emailAddress'] = $technicalContactEmail;
-        $techcontact['name'] = $config->getString('technicalcontact_name', null);
-        $techcontact['contactType'] = 'technical';
+        $techcontact = [
+            'emailAddress' => $technicalContactEmail,
+            'name' => $config->getString('technicalcontact_name', null),
+            'contactType' => 'technical',
+        ];
         $metaArray['contacts'][] = Metadata::getContact($techcontact);
     }
 
-- 
GitLab