diff --git a/lib/SimpleSAML/Configuration.php b/lib/SimpleSAML/Configuration.php
index 7ef65661a4f6c105446248348460aa336ba0610e..aa0a84b8cb5031dadfafd60fcacd21400c5c5244 100644
--- a/lib/SimpleSAML/Configuration.php
+++ b/lib/SimpleSAML/Configuration.php
@@ -9,7 +9,6 @@
  */
 class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState
 {
-
     /**
      * A default value which means that the given option is required.
      *
@@ -1294,7 +1293,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState
      * @param string $prefix The prefix which should be used when reading from the metadata
      *                       array. Defaults to ''.
      *
-     * @return array|null Public key data, or null if no public key or was found.
+     * @return array Public key data, or null if no public key or was found.
      *
      * @throws Exception If the certificate or public key cannot be loaded from a file.
      * @throws SimpleSAML_Error_Exception If the file does not contain a valid PEM-encoded certificate, or there is no
@@ -1359,11 +1358,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState
             );
         }
 
-        if ($required) {
-            throw new SimpleSAML_Error_Exception($this->location.': Missing certificate in metadata.');
-        } else {
-            return null;
-        }
+        throw new SimpleSAML_Error_Exception($this->location.': Missing certificate in metadata.');
     }
 
     /**