From d693ddf97b961a9cbd019d89b3c1db0344cfdd8b Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Mon, 30 May 2022 23:43:54 +0200
Subject: [PATCH] PSR12: fix long lines

---
 modules/admin/src/Controller/Config.php           | 9 ++++++---
 modules/core/src/Auth/Source/IPSourceSelector.php | 6 +++++-
 modules/saml/src/Controller/ServiceProvider.php   | 3 ++-
 phpcs.xml                                         | 2 +-
 4 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/modules/admin/src/Controller/Config.php b/modules/admin/src/Controller/Config.php
index 80628775d..924d76db3 100644
--- a/modules/admin/src/Controller/Config.php
+++ b/modules/admin/src/Controller/Config.php
@@ -204,6 +204,7 @@ class Config
             ]
         ];
         $store = $this->config->getOptionalString('store.type', null);
+        $checkforupdates = $this->config->getOptionalBoolean('admin.checkforupdates', true);
 
         // check dependencies used via normal functions
         $functions = [
@@ -268,7 +269,7 @@ class Config
                 ]
             ],
             'curl_init' => [
-                'required' => $this->config->getOptionalBoolean('admin.checkforupdates', true) ? 'required' : 'optional',
+                'required' => ($checkforupdates === true) ? 'required' : 'optional',
                 'descr' => [
                     'optional' => Translate::noop(
                         'cURL (might be required by some modules)'
@@ -345,10 +346,11 @@ class Config
         }
 
         // perform some basic configuration checks
+        $technicalcontact = $this->config->getOptionalString('technicalcontact_email', 'na@example.org');
         $matrix[] = [
             'required' => 'optional',
             'descr' => Translate::noop('The <code>technicalcontact_email</code> configuration option should be set'),
-            'enabled' => $this->config->getOptionalString('technicalcontact_email', 'na@example.org') !== 'na@example.org',
+            'enabled' => $technicalcontact !== 'na@example.org',
         ];
 
         $matrix[] = [
@@ -449,7 +451,8 @@ class Config
          * Check for updates. Store the remote result in the session so we don't need to fetch it on every access to
          * this page.
          */
-        if ($this->config->getOptionalBoolean('admin.checkforupdates', true) && $this->config->getVersion() !== 'master') {
+        $checkforupdates = $this->config->getOptionalBoolean('admin.checkforupdates', true);
+        if (($checkforupdates === true) && $this->config->getVersion() !== 'master') {
             if (!function_exists('curl_init')) {
                 $warnings[] = Translate::noop(
                     'The cURL PHP extension is missing. Cannot check for SimpleSAMLphp updates.'
diff --git a/modules/core/src/Auth/Source/IPSourceSelector.php b/modules/core/src/Auth/Source/IPSourceSelector.php
index 3264513de..37a80f867 100644
--- a/modules/core/src/Auth/Source/IPSourceSelector.php
+++ b/modules/core/src/Auth/Source/IPSourceSelector.php
@@ -97,7 +97,11 @@ class IPSourceSelector extends AbstractSourceSelector
             foreach ($zone['subnet'] as $subnet) {
                 if ($netUtils->ipCIDRcheck($subnet, $ip)) {
                     // Client's IP is in one of the ranges for the secondary auth source
-                    Logger::info(sprintf("core:IPSourceSelector:  Selecting zone `%s` based on client IP %s", $name, $ip));
+                    Logger::info(sprintf(
+                        "core:IPSourceSelector:  Selecting zone `%s` based on client IP %s",
+                        $name,
+                        $ip
+                    ));
                     $source = $zone['source'];
                     break;
                 }
diff --git a/modules/saml/src/Controller/ServiceProvider.php b/modules/saml/src/Controller/ServiceProvider.php
index 21c193a46..b7fd83580 100644
--- a/modules/saml/src/Controller/ServiceProvider.php
+++ b/modules/saml/src/Controller/ServiceProvider.php
@@ -247,7 +247,8 @@ class ServiceProvider
             Assert::keyExists($state, 'saml:sp:AuthId');
             if ($state['saml:sp:AuthId'] !== $sourceId) {
                 throw new Error\Exception(
-                    "The authentication source id in the URL doesn't match the authentication source that sent the request."
+                    "The authentication source id in the URL doesn't match the authentication"
+                    . " source that sent the request."
                 );
             }
 
diff --git a/phpcs.xml b/phpcs.xml
index 93a1bfbd5..18988c096 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -32,7 +32,7 @@
         <!-- Exclude files with long lines that we cannot immediately fix -->
         <exclude-pattern>tests/src/SimpleSAML/Metadata/MetaDataStorageSourceTest.php</exclude-pattern>
         <exclude-pattern>tests/src/SimpleSAML/Metadata/SAMLParserTest.php</exclude-pattern>
-        <exclude-pattern>tests/modules/saml/lib/Controller/ServiceProviderTest.php</exclude-pattern>
+        <exclude-pattern>tests/modules/saml/src/Controller/ServiceProviderTest.php</exclude-pattern>
     </rule>
 
     <!-- Ignore files with side effects that we cannot fix -->
-- 
GitLab