diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php
index f03544dd0ddb4afc32928fb2e71124d8545417a8..062382c9cdfee0c887f12cb2845707bdd693b33b 100644
--- a/lib/SimpleSAML/Session.php
+++ b/lib/SimpleSAML/Session.php
@@ -569,6 +569,7 @@ class Session implements \Serializable, Utils\ClearableState
      * Set remember me expire time.
      *
      * @param int $expire Unix timestamp when remember me session cookies expire.
+     * @return void
      */
     public function setRememberMeExpire($expire = null)
     {
diff --git a/lib/SimpleSAML/Store.php b/lib/SimpleSAML/Store.php
index 3447a9bc0ca8ee8bbede29d130c097f48c36455c..70fca6c395745af92203389d07a065e0de30f3b6 100644
--- a/lib/SimpleSAML/Store.php
+++ b/lib/SimpleSAML/Store.php
@@ -24,7 +24,7 @@ abstract class Store implements Utils\ClearableState
     /**
      * Retrieve our singleton instance.
      *
-     * @return false|\SimpleSAML\Store The data store, or false if it isn't enabled.
+     * @return bool|\SimpleSAML\Store The data store, or false if it isn't enabled.
      *
      * @throws \SimpleSAML\Error\CriticalConfigurationError
      */
diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php
index 22592096035fc26fd976d91b1fcf2d230249718c..33392a458a08e53577860092c8c1d3e53ebb23aa 100644
--- a/lib/SimpleSAML/Utilities.php
+++ b/lib/SimpleSAML/Utilities.php
@@ -120,7 +120,7 @@ class Utilities
      * @deprecated This method will be removed in SSP 2.0. Please use \SimpleSAML\Utils\HTTP::checkURLAllowed() instead.
      * @param string $url
      * @param array|null $trustedSites
-     * @return bool
+     * @return string
      */
     public static function checkURLAllowed($url, array $trustedSites = null)
     {
@@ -141,8 +141,8 @@ class Utilities
 
     /**
      * @deprecated This method will be removed in SSP 2.0.
-     * @param int|null $start
-     * @param int|null $end
+     * @param string|null $start
+     * @param string|null $end
      * @return bool
      */
     public static function checkDateConditions($start = null, $end = null)
@@ -365,7 +365,7 @@ class Utilities
 
     /**
      * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\XML::getDOMChildren() instead.
-     * @param \DOMNode $element
+     * @param \DOMElement $element
      * @param string $localName
      * @param string $namespaceURI
      * @return array
@@ -390,7 +390,7 @@ class Utilities
     /**
      * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::getAcceptLanguage()
      *     instead.
-     * @return string
+     * @return array
      */
     public static function getAcceptLanguage()
     {
@@ -402,7 +402,7 @@ class Utilities
      * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\XML::isValid() instead.
      * @param string $xml
      * @param string $schema
-     * @return bool
+     * @return string|false
      */
     public static function validateXML($xml, $schema)
     {
@@ -415,7 +415,7 @@ class Utilities
      * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\XML::checkSAMLMessage() instead.
      * @param string $message
      * @param string $type
-     * @return bool
+     * @return void
      */
     public static function validateXMLDocument($message, $type)
     {
@@ -465,7 +465,7 @@ class Utilities
 
     /**
      * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::resolveURL() instead.
-     * @param string $path
+     * @param string $url
      * @param string|null $base
      * @return string
      */
@@ -489,7 +489,7 @@ class Utilities
     /**
      * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::parseQueryString() instead.
      * @param string $query_string
-     * @return string
+     * @return array
      */
     public static function parseQueryString($query_string)
     {
@@ -590,7 +590,7 @@ class Utilities
 
     /**
      * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\XML::formatXMLString() instead.
-     * @param \DOMElement $root
+     * @param string $xml
      * @param string $indentBase
      * @return string
      */
@@ -723,7 +723,7 @@ class Utilities
     /**
      * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\System::writeFile() instead.
      * @param string $filename
-     * @param array $data
+     * @param string $data
      * @param int $mode
      * @return void
      */
@@ -745,7 +745,7 @@ class Utilities
 
     /**
      * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Logger::maskErrors() instead.
-     * @param string $mask
+     * @param int $mask
      * @return void
      */
     public static function maskErrors($mask)
@@ -848,6 +848,10 @@ class Utilities
 
     /**
      * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::setCookie() instead.
+     * @param string $name
+     * @param string|null $value
+     * @param array|null $params
+     * @param bool $throw
      * @return void
      */
     public static function setCookie($name, $value, array $params = null, $throw = true)
diff --git a/lib/SimpleSAML/Utils/HttpAdapter.php b/lib/SimpleSAML/Utils/HttpAdapter.php
index 53e78f264c9fdbd2b02425614531779a949a0b3f..b2e90b475a153a297c4cbba2627bae002fcd7fd8 100644
--- a/lib/SimpleSAML/Utils/HttpAdapter.php
+++ b/lib/SimpleSAML/Utils/HttpAdapter.php
@@ -20,7 +20,7 @@ class HttpAdapter
 
     /**
      * @see HTTP::getServerPort()
-     * @return int
+     * @return string
      */
     public function getServerPort()
     {
@@ -55,7 +55,7 @@ class HttpAdapter
      *
      * @param string $url
      * @param array|null $trustedSites
-     * @return bool
+     * @return string
      */
     public function checkURLAllowed($url, array $trustedSites = null)
     {
@@ -77,7 +77,7 @@ class HttpAdapter
 
     /**
      * @see HTTP::getAcceptLanguage()
-     * @return string
+     * @return array
      */
     public function getAcceptLanguage()
     {
@@ -105,7 +105,7 @@ class HttpAdapter
     /**
      * @see HTTP::getFirstPathElement()
      *
-     * @param $bool $trailingslash
+     * @param bool $trailingslash
      * @return string
      */
     public function getFirstPathElement($trailingslash = true)
@@ -116,7 +116,7 @@ class HttpAdapter
     /**
      * @see HTTP::getPOSTRedirectURL()
      *
-     * @param $string $destination
+     * @param string $destination
      * @param array $data
      * @return string
      */
@@ -190,6 +190,7 @@ class HttpAdapter
 
     /**
      * @see HTTP::normalizeURL()
+     * @param string $url
      * @return string
      */
     public function normalizeURL($url)
@@ -200,8 +201,8 @@ class HttpAdapter
     /**
      * @see HTTP::parseQueryString()
      *
-     * @param string
-     * @return string
+     * @param string $query_string
+     * @return array
      */
     public function parseQueryString($query_string)
     {
@@ -213,7 +214,7 @@ class HttpAdapter
      *
      * @param string $url
      * @param array $parameters
-     * @return string
+     * @return void
      */
     public function redirectTrustedURL($url, $parameters = [])
     {
@@ -225,7 +226,7 @@ class HttpAdapter
      *
      * @param string $url
      * @param array $parameters
-     * @return string
+     * @return void
      */
     public function redirectUntrustedURL($url, $parameters = [])
     {
diff --git a/lib/SimpleSAML/Utils/XML.php b/lib/SimpleSAML/Utils/XML.php
index b5833953805606b435a0fd75d7082ab69a24cd36..da5e66e3c798778a78e4511a89388ccc46835f8d 100644
--- a/lib/SimpleSAML/Utils/XML.php
+++ b/lib/SimpleSAML/Utils/XML.php
@@ -69,7 +69,7 @@ class XML
             case 'saml-meta':
                 $result = self::isValid($message, 'saml-schema-metadata-2.0.xsd');
         }
-        if ($result !== true) {
+        if (is_string($result)) {
             Logger::warning($result);
         }
     }
@@ -405,7 +405,7 @@ class XML
      * @param string|\DOMDocument $xml The XML string or document which should be validated.
      * @param string              $schema The filename of the schema that should be used to validate the document.
      *
-     * @return boolean|string Returns a string with errors found if validation fails. True if validation passes ok.
+     * @return bool|string Returns a string with errors found if validation fails. True if validation passes ok.
      * @throws \InvalidArgumentException If $schema is not a string, or $xml is neither a string nor a \DOMDocument.
      *
      * @author Olav Morken, UNINETT AS <olav.morken@uninett.no>
diff --git a/lib/SimpleSAML/XML/Shib13/AuthnRequest.php b/lib/SimpleSAML/XML/Shib13/AuthnRequest.php
index 680d2aebb7d4beff5b140cbb115f4033e5b14df1..80bd641c21f03ef8f521f63c2242cbde6bc18015 100644
--- a/lib/SimpleSAML/XML/Shib13/AuthnRequest.php
+++ b/lib/SimpleSAML/XML/Shib13/AuthnRequest.php
@@ -39,7 +39,7 @@ class AuthnRequest
     
 
     /**
-     * @param string|null $relayState
+     * @param string|null $issuer
      * @return void
      */
     public function setIssuer($issuer)
diff --git a/lib/SimpleSAML/XML/Shib13/AuthnResponse.php b/lib/SimpleSAML/XML/Shib13/AuthnResponse.php
index f943c1925a3fe086a7842a7de18effb510ec0af8..0a0bf47e1d2a7287712811da590ce8055f6712a3 100644
--- a/lib/SimpleSAML/XML/Shib13/AuthnResponse.php
+++ b/lib/SimpleSAML/XML/Shib13/AuthnResponse.php
@@ -41,9 +41,9 @@ class AuthnResponse
 
 
     /**
-     * @var \DOMDocument The DOMDocument which represents this message.
+     * @var \DOMDocument|null The DOMDocument which represents this message.
      */
-    private $dom;
+    private $dom = null;
 
     /**
      * @var string|null The relaystate which is associated with this response.
diff --git a/lib/SimpleSAML/XML/Validator.php b/lib/SimpleSAML/XML/Validator.php
index 52c5b57d7c460c0d36c3fccab2999823b657307e..848445ac01590a0fb5d2080d98c4f572bdd888c2 100644
--- a/lib/SimpleSAML/XML/Validator.php
+++ b/lib/SimpleSAML/XML/Validator.php
@@ -201,6 +201,7 @@ class Validator
      * @param string $certificate The X509 certificate we should validate.
      * @param array $fingerprints The valid fingerprints.
      * @throws \Exception
+     * @return void
      */
     private static function validateCertificateFingerprint($certificate, $fingerprints)
     {