diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php
index be144263f1d21cd176718b770fac7a8632cccc98..99976cbd47b6c94751f40ca8fa03ed70a42f5244 100644
--- a/lib/SimpleSAML/XHTML/Template.php
+++ b/lib/SimpleSAML/XHTML/Template.php
@@ -1,7 +1,5 @@
 <?php
 
-namespace SimpleSAML\XHTML;
-
 /**
  * A minimalistic XHTML PHP based template system implemented for SimpleSAMLphp.
  *
@@ -9,6 +7,8 @@ namespace SimpleSAML\XHTML;
  * @package SimpleSAMLphp
  */
 
+namespace SimpleSAML\XHTML;
+
 use SimpleSAML\Configuration;
 use SimpleSAML\Locale\Language;
 use SimpleSAML\Locale\Localization;
diff --git a/modules/admin/lib/FederationController.php b/modules/admin/lib/FederationController.php
index a6d81e45ed392f91e93858c66d773d665cc425b9..f167514972a4a4b3161d4fe2533c4a1162040db0 100644
--- a/modules/admin/lib/FederationController.php
+++ b/modules/admin/lib/FederationController.php
@@ -182,10 +182,9 @@ class FederationController
                 } else {
                     $saml2entities['saml20-idp'] = $this->mdHandler->getMetaDataCurrent('saml20-idp-hosted');
                     $saml2entities['saml20-idp']['url'] = Utils\HTTP::getBaseURL() . 'saml2/idp/metadata.php';
-                    $saml2entities['saml20-idp']['metadata_array'] =
-                        SAML2_IdP::getHostedMetadata(
-                            $this->mdHandler->getMetaDataCurrentEntityID('saml20-idp-hosted')
-                        );
+                    $saml2entities['saml20-idp']['metadata_array'] = SAML2_IdP::getHostedMetadata(
+                        $this->mdHandler->getMetaDataCurrentEntityID('saml20-idp-hosted')
+                    );
                 }
 
                 foreach ($saml2entities as $index => $entity) {
diff --git a/modules/cron/www/croninfo.php b/modules/cron/www/croninfo.php
index ffabdb0fb5c0b2d06e3ff68f923e744c2a4c992d..fce622c1c8bb0c3336083d8fd0560f837e11fc24 100644
--- a/modules/cron/www/croninfo.php
+++ b/modules/cron/www/croninfo.php
@@ -5,7 +5,6 @@
  * initializes the SimpleSAMLphp config class with the correct path.
  */
 
-
 namespace SimpleSAML\Module\cron;
 
 use SimpleSAML\Configuration;
diff --git a/modules/saml/lib/Error/NoAuthnContext.php b/modules/saml/lib/Error/NoAuthnContext.php
index 54a147463ba3dca10f7ac8eeb15c702b3a92257a..c1b47f88cc6939d7ebcf51a2ca857269b0d53040 100644
--- a/modules/saml/lib/Error/NoAuthnContext.php
+++ b/modules/saml/lib/Error/NoAuthnContext.php
@@ -1,7 +1,5 @@
 <?php
 
-namespace SimpleSAML\Module\saml\Error;
-
 /**
  * A SAML error indicating that none of the requested Authentication Contexts can be used.
  *
@@ -9,6 +7,8 @@ namespace SimpleSAML\Module\saml\Error;
  * @package SimpleSAMLphp
  */
 
+namespace SimpleSAML\Module\saml\Error;
+
 use SAML2\Constants;
 
 class NoAuthnContext extends \SimpleSAML\Module\saml\Error
diff --git a/modules/saml/lib/Error/NoAvailableIDP.php b/modules/saml/lib/Error/NoAvailableIDP.php
index 92f78d00b539c5208e978bed6f9d9a3c2d94c41f..3f024c0d0ef57a1985aebfdb7c16b6e778dbb2c2 100644
--- a/modules/saml/lib/Error/NoAvailableIDP.php
+++ b/modules/saml/lib/Error/NoAvailableIDP.php
@@ -1,7 +1,5 @@
 <?php
 
-namespace SimpleSAML\Module\saml\Error;
-
 /**
  * A SAML error indicating that none of the requested IdPs can be used.
  *
@@ -9,6 +7,8 @@ namespace SimpleSAML\Module\saml\Error;
  * @package SimpleSAMLphp
  */
 
+namespace SimpleSAML\Module\saml\Error;
+
 use SAML2\Constants;
 
 class NoAvailableIDP extends \SimpleSAML\Module\saml\Error
diff --git a/modules/saml/lib/Error/NoPassive.php b/modules/saml/lib/Error/NoPassive.php
index 8602bce1fc30db10426bb1d5de5557a3412f9baa..1a5a8d5c18be534dc708207dbd471f604778ee2a 100644
--- a/modules/saml/lib/Error/NoPassive.php
+++ b/modules/saml/lib/Error/NoPassive.php
@@ -1,7 +1,5 @@
 <?php
 
-namespace SimpleSAML\Module\saml\Error;
-
 /**
  * A SAML error indicating that passive authentication cannot be used.
  *
@@ -9,6 +7,8 @@ namespace SimpleSAML\Module\saml\Error;
  * @package SimpleSAMLphp
  */
 
+namespace SimpleSAML\Module\saml\Error;
+
 use SAML2\Constants;
 
 class NoPassive extends \SimpleSAML\Module\saml\Error
diff --git a/modules/saml/lib/Error/NoSupportedIDP.php b/modules/saml/lib/Error/NoSupportedIDP.php
index 5eedd1d27ae13a3e10c84af65fc67da117ec385c..429ddf538ca888175978eb5caa1cf5ab313b9fe0 100644
--- a/modules/saml/lib/Error/NoSupportedIDP.php
+++ b/modules/saml/lib/Error/NoSupportedIDP.php
@@ -1,7 +1,5 @@
 <?php
 
-namespace SimpleSAML\Module\saml\Error;
-
 /**
  * A SAML error indicating that none of the IdPs requested are supported.
  *
@@ -9,6 +7,8 @@ namespace SimpleSAML\Module\saml\Error;
  * @package SimpleSAMLphp
  */
 
+namespace SimpleSAML\Module\saml\Error;
+
 use SAML2\Constants;
 
 class NoSupportedIDP extends \SimpleSAML\Module\saml\Error
diff --git a/modules/saml/lib/Error/ProxyCountExceeded.php b/modules/saml/lib/Error/ProxyCountExceeded.php
index f85216d82298252dd4a7b9f3154bd5ae2c3702a2..99e40182c1fc0df2de25415e47bc22682e865b92 100644
--- a/modules/saml/lib/Error/ProxyCountExceeded.php
+++ b/modules/saml/lib/Error/ProxyCountExceeded.php
@@ -1,7 +1,5 @@
 <?php
 
-namespace SimpleSAML\Module\saml\Error;
-
 /**
  * A SAML error indicating that the maximum amount of proxies traversed has been reached.
  *
@@ -9,6 +7,8 @@ namespace SimpleSAML\Module\saml\Error;
  * @package SimpleSAMLphp
  */
 
+namespace SimpleSAML\Module\saml\Error;
+
 use SAML2\Constants;
 
 class ProxyCountExceeded extends \SimpleSAML\Module\saml\Error
diff --git a/phpcs.xml b/phpcs.xml
index 66b26c8aca9fc7ed4838832edddeb4a66cb54114..b6700449d5cc9a99fa9bfa73882d12a0eb5bcd2e 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -66,6 +66,7 @@
 
     <!-- Ignore files with side effects that we cannot fix -->
     <rule ref="PSR1.Files.SideEffects">
+        <exclude-pattern>bin/*</exclude-pattern>
         <exclude-pattern>lib/_autoload_modules.php</exclude-pattern>
         <exclude-pattern>tests/_autoload_modules.php</exclude-pattern>
         <exclude-pattern>www/_include.php</exclude-pattern>
diff --git a/tests/modules/saml/lib/Auth/Process/NameIDAttributeTest.php b/tests/modules/saml/lib/Auth/Process/NameIDAttributeTest.php
index 4e9ae9bf43c81501514d50fcd0947cedd6b8b560..ee5af3c337f20e7f420a2228df33a88880858912 100644
--- a/tests/modules/saml/lib/Auth/Process/NameIDAttributeTest.php
+++ b/tests/modules/saml/lib/Auth/Process/NameIDAttributeTest.php
@@ -1,7 +1,5 @@
 <?php
 
-namespace SimpleSAML\Test\Module\saml\Auth\Process;
-
 /**
  * Test for the saml:NameIDAttribute filter.
  *
@@ -9,6 +7,8 @@ namespace SimpleSAML\Test\Module\saml\Auth\Process;
  * @package SimpleSAMLphp
  */
 
+namespace SimpleSAML\Test\Module\saml\Auth\Process;
+
 use PHPUnit\Framework\TestCase;
 use SimpleSAML\Module\saml\Auth\Process\NameIDAttribute;
 use SAML2\XML\saml\NameID;
diff --git a/tests/modules/saml/lib/IdP/SQLNameIDTest.php b/tests/modules/saml/lib/IdP/SQLNameIDTest.php
index 5aacfcf59abecc3bcb3b44326dc53aca21363a2c..be43071d2703d7f1bfdc85a51c0cc1af3b2b765b 100644
--- a/tests/modules/saml/lib/IdP/SQLNameIDTest.php
+++ b/tests/modules/saml/lib/IdP/SQLNameIDTest.php
@@ -1,7 +1,5 @@
 <?php
 
-namespace SimpleSAML\Test\Module\saml\IdP;
-
 /**
  * Test for the SQLNameID helper class.
  *
@@ -9,6 +7,8 @@ namespace SimpleSAML\Test\Module\saml\IdP;
  * @package SimpleSAMLphp
  */
 
+namespace SimpleSAML\Test\Module\saml\IdP;
+
 use PHPUnit\Framework\TestCase;
 use SimpleSAML\Configuration;
 use SimpleSAML\Error;