diff --git a/modules/admin/lib/Controller/Federation.php b/modules/admin/lib/Controller/Federation.php
index 0db39f8680d71b8d384a461973d7f7a7d8925188..56da242f630b1de362e60ac4902e6084bf8e3def 100644
--- a/modules/admin/lib/Controller/Federation.php
+++ b/modules/admin/lib/Controller/Federation.php
@@ -24,6 +24,7 @@ use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\Response;
 use Symfony\Component\HttpFoundation\ResponseHeaderBag;
 use Symfony\Component\VarExporter\VarExporter;
+use Webmozart\Assert\Assert;
 
 /**
  * Controller class for the admin module.
@@ -147,6 +148,8 @@ class Federation
         ];
 
         Module::callHooks('federationpage', $t);
+        Assert::isInstanceOf($t, Template::class);
+
         $this->menu->addOption('logout', $t->data['logouturl'], Translate::noop('Log out'));
         return $this->menu->insert($t);
     }
diff --git a/modules/admin/lib/Controller/Test.php b/modules/admin/lib/Controller/Test.php
index e722280aaf3dce66eaf006295618df228d1173fa..75dd3d1ce6196e69f59405012e6ebdb471225d22 100644
--- a/modules/admin/lib/Controller/Test.php
+++ b/modules/admin/lib/Controller/Test.php
@@ -89,9 +89,7 @@ class Test
 
             $attributes = $authsource->getAttributes();
             $authData = $authsource->getAuthDataArray();
-            $nameId = !is_null($authsource->getAuthData('saml:sp:NameID'))
-                ? $authsource->getAuthData('saml:sp:NameID')
-                : false;
+            $nameId = $authsource->getAuthData('saml:sp:NameID') ?? false;
 
             $t = new Template($this->config, 'admin:status.twig', 'attributes');
             $t->data = [
@@ -108,6 +106,8 @@ class Test
         }
 
         Module::callHooks('configpage', $t);
+        Assert::isInstanceOf($t, Template::class);
+
         $this->menu->addOption('logout', Utils\Auth::getAdminLogoutURL(), Translate::noop('Log out'));
         return $this->menu->insert($t);
     }