diff --git a/lib/SimpleSAML/XML/Errors.php b/lib/SimpleSAML/XML/Errors.php
index 48d93b73d3ef16c09c0f90a09a23f25aa60729c5..af4d3dc91e453e9768ca35e03ee1a0447e274c54 100644
--- a/lib/SimpleSAML/XML/Errors.php
+++ b/lib/SimpleSAML/XML/Errors.php
@@ -16,13 +16,12 @@ class Errors
 {
 
     /**
-     * This is an stack of error logs. The topmost element is the one we are
-     * currently working on.
+     * @var array This is an stack of error logs. The topmost element is the one we are currently working on.
      */
     private static $errorStack = array();
 
     /**
-     * This is the xml error state we had before we began logging.
+     * @var bool This is the xml error state we had before we began logging.
      */
     private static $xmlErrorState;
 
@@ -104,7 +103,7 @@ class Errors
      *
      * This function formats the given LibXMLError object as a string.
      *
-     * @param $error \LibXMLError  The LibXMLError which should be formatted.
+     * @param \LibXMLError $error  The LibXMLError which should be formatted.
      * @return string  A string representing the given LibXMLError.
      */
     public static function formatError($error)
@@ -121,7 +120,7 @@ class Errors
      * This fucntion takes an array of LibXMLError objects and creates a string with all the errors.
      * Each error will be separated by a newline, and the string will end with a newline-character.
      *
-     * @param $errors array  An array of errors.
+     * @param array $errors  An array of errors.
      * @return string  A string representing the errors. An empty string will be returned if there were no
      *          errors in the array.
      */
diff --git a/lib/SimpleSAML/XML/Shib13/AuthnResponse.php b/lib/SimpleSAML/XML/Shib13/AuthnResponse.php
index a8f4fc32b21d3951ea5c0cecdc210bdfd73257ec..de3e99eabb9507ad4a4fc591c8c472ec61296ea7 100644
--- a/lib/SimpleSAML/XML/Shib13/AuthnResponse.php
+++ b/lib/SimpleSAML/XML/Shib13/AuthnResponse.php
@@ -20,15 +20,13 @@ class AuthnResponse
 {
 
     /**
-     * @var Validator This variable contains an XML validator for this message.
+     * @var \SimpleSAML\XML\Validator This variable contains an XML validator for this message.
      */
     private $validator = null;
 
 
     /**
-     * Whether this response was validated by some external means (e.g. SSL).
-     *
-     * @var bool
+     * @var bool Whether this response was validated by some external means (e.g. SSL).
      */
     private $messageValidated = false;
 
@@ -38,16 +36,12 @@ class AuthnResponse
 
 
     /**
-     * The DOMDocument which represents this message.
-     *
-     * @var \DOMDocument
+     * @var \DOMDocument The DOMDocument which represents this message.
      */
     private $dom;
 
     /**
-     * The relaystate which is associated with this response.
-     *
-     * @var string|NULL
+     * @var string|null The relaystate which is associated with this response.
      */
     private $relayState = null;
 
@@ -131,10 +125,11 @@ class AuthnResponse
     }
 
 
-    /* Checks if the given node is validated by the signature on this response.
+    /**
+     * Checks if the given node is validated by the signature on this response.
      *
-     * Returns:
-     *  TRUE if the node is validated or FALSE if not.
+     * @param \DOMElement Node to be validated.
+     * @return bool TRUE if the node is validated or FALSE if not.
      */
     private function isNodeValidated($node)
     {
@@ -161,8 +156,8 @@ class AuthnResponse
     /**
      * This function runs an xPath query on this authentication response.
      *
-     * @param $query string   The query which should be run.
-     * @param $node \DOMNode  The node which this query is relative to. If this node is NULL (the default)
+     * @param string $query   The query which should be run.
+     * @param \DOMNode $node  The node which this query is relative to. If this node is NULL (the default)
      *                        then the query will be relative to the root of the response.
      * @return \DOMNodeList
      */
@@ -187,7 +182,7 @@ class AuthnResponse
     /**
      * Retrieve the session index of this response.
      *
-     * @return string|NULL  The session index of this response.
+     * @return string|null  The session index of this response.
      */
     public function getSessionIndex()
     {
@@ -303,10 +298,10 @@ class AuthnResponse
     /**
      * Build a authentication response.
      *
-     * @param $idp \SimpleSAML_Configuration  Metadata for the IdP the response is sent from.
-     * @param $sp \SimpleSAML_Configuration  Metadata for the SP the response is sent to.
+     * @param \SimpleSAML_Configuration $idp Metadata for the IdP the response is sent from.
+     * @param \SimpleSAML_Configuration $sp Metadata for the SP the response is sent to.
      * @param string $shire The endpoint on the SP the response is sent to.
-     * @param array|NULL $attributes The attributes which should be included in the response.
+     * @param array|null $attributes The attributes which should be included in the response.
      * @return string The response.
      */
     public function generate(\SimpleSAML_Configuration $idp, \SimpleSAML_Configuration $sp, $shire, $attributes)
diff --git a/lib/SimpleSAML/XML/Signer.php b/lib/SimpleSAML/XML/Signer.php
index b62c94a1342fa404c73af481d935b2bd336f33d3..b9bb9fce8b2477a1d0a5ec877e624b4a17451f0a 100644
--- a/lib/SimpleSAML/XML/Signer.php
+++ b/lib/SimpleSAML/XML/Signer.php
@@ -55,7 +55,7 @@ class Signer
      *  - publickey_array  The public key, as an array returned from SimpleSAML_Utilities::loadPublicKey.
      *  - id               The name of the ID attribute.
      *
-     * @param $options array  Associative array with options for the constructor. Defaults to an empty array.
+     * @param array $options  Associative array with options for the constructor. Defaults to an empty array.
      */
     public function __construct($options = array())
     {
@@ -119,9 +119,9 @@ class Signer
      *
      * Will throw an exception if unable to load the private key.
      *
-     * @param $file string  The file which contains the private key. The path is assumed to be relative
+     * @param string $file  The file which contains the private key. The path is assumed to be relative
      *                      to the cert-directory.
-     * @param $pass string|null  The passphrase on the private key. Pass no value or NULL if the private
+     * @param string|null $pass  The passphrase on the private key. Pass no value or NULL if the private
      *                           key is unencrypted.
      * @throws \Exception
      */
@@ -176,7 +176,7 @@ class Signer
      * If this function isn't called, no certificate will be included.
      * Will throw an exception if unable to load the certificate.
      *
-     * @param $file string  The file which contains the certificate. The path is assumed to be relative to
+     * @param string $file  The file which contains the certificate. The path is assumed to be relative to
      *                      the cert-directory.
      * @throws \Exception
      */
@@ -199,7 +199,7 @@ class Signer
     /**
      * Set the attribute name for the ID value.
      *
-     * @param $idAttrName string  The name of the attribute which contains the id.
+     * @param string $idAttrName  The name of the attribute which contains the id.
      */
     public function setIDAttribute($idAttrName)
     {
@@ -215,7 +215,7 @@ class Signer
      * Extra certificates will be added to the certificate chain in the order they
      * are added.
      *
-     * @param $file string  The file which contains the certificate, relative to the cert-directory.
+     * @param string $file  The file which contains the certificate, relative to the cert-directory.
      * @throws \Exception
      */
     public function addCertificate($file)
@@ -241,9 +241,9 @@ class Signer
      *
      * The private key must be set before calling this function.
      *
-     * @param $node \DOMElement  The DOMElement we should generate a signature for.
-     * @param $insertInto \DOMElement  The DOMElement we should insert the signature element into.
-     * @param $insertBefore \DOMElement  The element we should insert the signature element before. Defaults to NULL,
+     * @param \DOMElement $node  The DOMElement we should generate a signature for.
+     * @param \DOMElement $insertInto  The DOMElement we should insert the signature element into.
+     * @param \DOMElement $insertBefore  The element we should insert the signature element before. Defaults to NULL,
      *                                   in which case the signature will be appended to the element spesified in
      *                                   $insertInto.
      * @throws \Exception
diff --git a/lib/SimpleSAML/XML/Validator.php b/lib/SimpleSAML/XML/Validator.php
index 09c2a077ecadabe8c73a3b7db2619e3cf00385e8..3cb6df9cf551138f52ff73d9e04d99334a03fb9b 100644
--- a/lib/SimpleSAML/XML/Validator.php
+++ b/lib/SimpleSAML/XML/Validator.php
@@ -17,13 +17,13 @@ class Validator
 {
 
     /**
-     * This variable contains the X509 certificate the XML document
-     * was signed with, or NULL if it wasn't signed with an X509 certificate.
+     * @var string This variable contains the X509 certificate the XML document
+     *             was signed with, or NULL if it wasn't signed with an X509 certificate.
      */
     private $x509Certificate;
 
     /**
-     * This variable contains the nodes which are signed.
+     * @var array This variable contains the nodes which are signed.
      */
     private $validNodes = null;
 
@@ -155,7 +155,7 @@ class Validator
     /**
      * Calculates the fingerprint of an X509 certificate.
      *
-     * @param $x509cert string  The certificate as a base64-encoded string. The string may optionally
+     * @param string $x509cert  The certificate as a base64-encoded string. The string may optionally
      *                          be framed with '-----BEGIN CERTIFICATE-----' and '-----END CERTIFICATE-----'.
      * @return string  The fingerprint as a 40-character lowercase hexadecimal number. NULL is returned if the
      *                 argument isn't an X509 certificate.
@@ -237,7 +237,7 @@ class Validator
      * is an array, then any string (certificate) in the array can match. If this is a string,
      * then that string must match,
      *
-     * @param $fingerprints  string|array The fingerprints which should match. This can be a single string,
+     * @param string|array $fingerprints  The fingerprints which should match. This can be a single string,
      *                                    or an array of fingerprints.
      * @throws \Exception
      */
@@ -268,7 +268,7 @@ class Validator
     /**
      * This function checks if the given XML node was signed.
      *
-     * @param $node \DOMNode  The XML node which we should verify that was signed.
+     * @param \DOMNode $node  The XML node which we should verify that was signed.
      *
      * @return bool  TRUE if this node (or a parent node) was signed. FALSE if not.
      */
@@ -296,7 +296,7 @@ class Validator
      *
      * This function throws an exception if unable to validate against the given CA file.
      *
-     * @param $caFile string  File with trusted certificates, in PEM-format.
+     * @param string $caFile  File with trusted certificates, in PEM-format.
      * @throws \Exception
      */
     public function validateCA($caFile)