Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert three assignment statements to the usage of combined operators #174

Open
elfring opened this issue Nov 25, 2021 · 0 comments
Open

Comments

@elfring
Copy link

elfring commented Nov 25, 2021

👀 Some source code analysis tools can help to find opportunities for improving software components.
💭 I propose to increase the usage of combined operators accordingly.

diff --git a/src/IsoCodes/CreditCard.php b/src/IsoCodes/CreditCard.php
index b663322..3fd260e 100644
--- a/src/IsoCodes/CreditCard.php
+++ b/src/IsoCodes/CreditCard.php
@@ -35,7 +35,7 @@ class CreditCard implements IsoCodeInterface
             if ((($length - $i) % 2) == 0) {
                 $digit = (int) $digit * 2;
                 if ($digit > 9) {
-                    $digit = $digit - 9;
+                    $digit -= 9;
                 }
             }
             $tot += (int) $digit;
diff --git a/src/IsoCodes/Iban.php b/src/IsoCodes/Iban.php
index 4bb97c8..52d9a9b 100644
--- a/src/IsoCodes/Iban.php
+++ b/src/IsoCodes/Iban.php
@@ -110,7 +110,7 @@ class Iban implements IsoCodeInterface
             return false;
         }
         // Fetch needed string for validation
-        $check = $check.substr($iban, 0, 4);
+        $check .= substr($iban, 0, 4);
         // Replace characters by decimal values
         $check = str_replace(
             ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'],
diff --git a/src/IsoCodes/Iswc.php b/src/IsoCodes/Iswc.php
index 9ead1a7..82a8394 100644
--- a/src/IsoCodes/Iswc.php
+++ b/src/IsoCodes/Iswc.php
@@ -28,7 +28,7 @@ class Iswc extends Luhn implements IsoCodeInterface
         $sum = 1;
 
         for ($i = 1; $i <= 9; ++$i) {
-            $sum = $sum + $i * (int) $iswc[$i];
+            $sum += $i * (int) $iswc[$i];
         }
 
         $rem = $sum % 10;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant