From 2efe8c06474f717e2a85132c9eb7895f53bddaf1 Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Sat, 26 Oct 2019 18:15:56 +0200
Subject: [PATCH] PSR-12

---
 lib/SimpleSAML/XHTML/Template.php                          | 4 ++--
 modules/admin/lib/FederationController.php                 | 7 +++----
 modules/cron/www/croninfo.php                              | 1 -
 modules/saml/lib/Error/NoAuthnContext.php                  | 4 ++--
 modules/saml/lib/Error/NoAvailableIDP.php                  | 4 ++--
 modules/saml/lib/Error/NoPassive.php                       | 4 ++--
 modules/saml/lib/Error/NoSupportedIDP.php                  | 4 ++--
 modules/saml/lib/Error/ProxyCountExceeded.php              | 4 ++--
 phpcs.xml                                                  | 1 +
 .../modules/saml/lib/Auth/Process/NameIDAttributeTest.php  | 4 ++--
 tests/modules/saml/lib/IdP/SQLNameIDTest.php               | 4 ++--
 11 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php
index be144263f..99976cbd4 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 a6d81e45e..f16751497 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 ffabdb0fb..fce622c1c 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 54a147463..c1b47f88c 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 92f78d00b..3f024c0d0 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 8602bce1f..1a5a8d5c1 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 5eedd1d27..429ddf538 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 f85216d82..99e40182c 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 66b26c8ac..b6700449d 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 4e9ae9bf4..ee5af3c33 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 5aacfcf59..be43071d2 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;
-- 
GitLab