From 3cc42032265fad02e416c2677d03dd779a7f54a0 Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Sat, 22 Feb 2020 00:48:08 +0100
Subject: [PATCH] Psalm fixes

---
 modules/core/lib/Controller/Exception.php | 17 ++---------------
 modules/core/www/frontpage_auth.php       |  1 -
 modules/core/www/frontpage_federation.php |  1 -
 modules/core/www/frontpage_welcome.php    |  1 -
 modules/core/www/idp/logout-iframe.php    | 18 ------------------
 modules/core/www/no_cookie.php            | 14 +-------------
 modules/core/www/short_sso_interval.php   |  2 --
 7 files changed, 3 insertions(+), 51 deletions(-)

diff --git a/modules/core/lib/Controller/Exception.php b/modules/core/lib/Controller/Exception.php
index 8bf7ce300..b872b377b 100644
--- a/modules/core/lib/Controller/Exception.php
+++ b/modules/core/lib/Controller/Exception.php
@@ -101,21 +101,8 @@ class Exception
         }
 
         $t = new Template($this->config, 'core:no_cookie.twig');
-        $translator = $t->getTranslator();
-
-        /** @var string $header */
-        $header = $translator->t('{core:no_cookie:header}');
-
-        /** @var string $desc */
-        $desc = $translator->t('{core:no_cookie:description}');
-
-        /** @var string $retry */
-        $retry = $translator->t('{core:no_cookie:retry}');
-
-        $t->data['header'] = htmlspecialchars($header);
-        $t->data['description'] = htmlspecialchars($desc);
-        $t->data['retry'] = htmlspecialchars($retry);
         $t->data['retryURL'] = $retryURL;
+
         return $t;
     }
 
@@ -148,10 +135,10 @@ class Exception
         }
 
         $t = new Template($this->config, 'core:short_sso_interval.twig');
-        $translator = $t->getTranslator();
         $t->data['params'] = ['StateId' => $stateId];
         $t->data['trackId'] = $this->session->getTrackID();
         $t->data['autofocus'] = 'contbutton';
+
         return $t;
     }
 }
diff --git a/modules/core/www/frontpage_auth.php b/modules/core/www/frontpage_auth.php
index 859bc5a53..3d2a31a7b 100644
--- a/modules/core/www/frontpage_auth.php
+++ b/modules/core/www/frontpage_auth.php
@@ -38,7 +38,6 @@ $t->data['isadmin'] = $isadmin;
 $t->data['loginurl'] = $loginurl;
 $t->data['logouturl'] = $logouturl;
 
-$t->data['header'] = $t->getTranslator()->t('{core:frontpage:page_title}');
 $t->data['links'] = $links;
 $t->data['links_welcome'] = $links_welcome;
 $t->data['links_config'] = $links_config;
diff --git a/modules/core/www/frontpage_federation.php b/modules/core/www/frontpage_federation.php
index 8ab6ac092..5d683cc17 100644
--- a/modules/core/www/frontpage_federation.php
+++ b/modules/core/www/frontpage_federation.php
@@ -148,7 +148,6 @@ $t->data['links_welcome'] = $links_welcome;
 $t->data['links_config'] = $links_config;
 $t->data['links_auth'] = $links_auth;
 $t->data['links_federation'] = $links_federation;
-$t->data['header'] = $translator->t('{core:frontpage:page_title}');
 
 $t->data['metadata_url'] = \SimpleSAML\Module::getModuleURL('core/show_metadata.php');
 $t->data['metaentries'] = $metaentries;
diff --git a/modules/core/www/frontpage_welcome.php b/modules/core/www/frontpage_welcome.php
index 9a662dafa..4534387c8 100644
--- a/modules/core/www/frontpage_welcome.php
+++ b/modules/core/www/frontpage_welcome.php
@@ -44,6 +44,5 @@ $t->data['links_welcome'] = $links_welcome;
 $t->data['links_config'] = $links_config;
 $t->data['links_auth'] = $links_auth;
 $t->data['links_federation'] = $links_federation;
-$t->data['header'] = $t->getTranslator()->t('{core:frontpage:page_title}');
 
 $t->send();
diff --git a/modules/core/www/idp/logout-iframe.php b/modules/core/www/idp/logout-iframe.php
index 0145a9aa7..759e6fdf8 100644
--- a/modules/core/www/idp/logout-iframe.php
+++ b/modules/core/www/idp/logout-iframe.php
@@ -127,27 +127,9 @@ if ($type === 'nojs') {
     $t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:logout-iframe.twig');
 }
 
-/**
- * @deprecated The "id" variable will be removed. Please use "auth_state" instead.
- */
 $id = \SimpleSAML\Auth\State::saveState($state, 'core:Logout-IFrame');
-$t->data['id'] = $id;
 $t->data['auth_state'] = $id;
-
-$t->data['header'] = $t->getTranslator()->t('{logout:progress}');
 $t->data['type'] = $type;
 $t->data['terminated_service'] = $terminated;
 $t->data['remaining_services'] = $remaining;
-
-/** @deprecated The "from" array will be removed in 2.0, use the "terminated_service" array instead */
-$t->data['from'] = $state['core:Logout-IFrame:From'];
-
-/** @deprecated The "SPs" array will be removed, use the "remaining_services" array instead */
-$t->data['SPs'] = $state['core:Logout-IFrame:Associations'];
-
-if ($type !== 'nojs') {
-    /** @deprecated The "jquery" array will be removed in 2.0 */
-    $t->data['jquery'] = ['core' => true, 'ui' => false, 'css' => false];
-}
-
 $t->send();
diff --git a/modules/core/www/no_cookie.php b/modules/core/www/no_cookie.php
index f5dd285ed..b79aeefd9 100644
--- a/modules/core/www/no_cookie.php
+++ b/modules/core/www/no_cookie.php
@@ -1,7 +1,7 @@
 <?php
 
 if (isset($_REQUEST['retryURL'])) {
-    $retryURL = (string) $_REQUEST['retryURL'];
+    $retryURL = strval($_REQUEST['retryURL']);
     $retryURL = \SimpleSAML\Utils\HTTP::checkURLAllowed($retryURL);
 } else {
     $retryURL = null;
@@ -9,17 +9,5 @@ if (isset($_REQUEST['retryURL'])) {
 
 $globalConfig = \SimpleSAML\Configuration::getInstance();
 $t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:no_cookie.twig');
-$translator = $t->getTranslator();
-
-/** @var string $header */
-$header = $translator->t('{core:no_cookie:header}');
-/** @var string $desc */
-$desc = $translator->t('{core:no_cookie:description}');
-/** @var string $retry */
-$retry = $translator->t('{core:no_cookie:retry}');
-
-$t->data['header'] = htmlspecialchars($header);
-$t->data['description'] = htmlspecialchars($desc);
-$t->data['retry'] = htmlspecialchars($retry);
 $t->data['retryURL'] = $retryURL;
 $t->send();
diff --git a/modules/core/www/short_sso_interval.php b/modules/core/www/short_sso_interval.php
index 2d1de11d8..79c499a25 100644
--- a/modules/core/www/short_sso_interval.php
+++ b/modules/core/www/short_sso_interval.php
@@ -24,10 +24,8 @@ if (array_key_exists('continue', $_REQUEST)) {
 
 $globalConfig = \SimpleSAML\Configuration::getInstance();
 $t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:short_sso_interval.twig');
-$translator = $t->getTranslator();
 $t->data['target'] = \SimpleSAML\Module::getModuleURL('core/short_sso_interval.php');
 $t->data['params'] = ['StateId' => $id];
 $t->data['trackId'] = $session->getTrackID();
-$t->data['header'] = $translator->t('{core:short_sso_interval:warning_header}');
 $t->data['autofocus'] = 'contbutton';
 $t->send();
-- 
GitLab