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

Warnings: "continue" targeting switch is equivalent to "break". #100

Closed
r0max opened this issue Apr 23, 2019 · 1 comment
Closed

Warnings: "continue" targeting switch is equivalent to "break". #100

r0max opened this issue Apr 23, 2019 · 1 comment

Comments

@r0max
Copy link

r0max commented Apr 23, 2019

When accessing linfo, two warnings are spilled out:

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /srv/http/linfo/src/Linfo/OS/Linux.php on line 1034

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /srv/http/linfo/src/Linfo/OS/Linux.php on line 1351

The fix is simply to delete the "continue" from the switch-case.

UPDATE: considering the logic, it makes more sense to break out to the upper switch.

diff --git a/src/Linfo/OS/Linux.php b/src/Linfo/OS/Linux.php
index d77ef91..66a6447 100644
--- a/src/Linfo/OS/Linux.php
+++ b/src/Linfo/OS/Linux.php
@@ -1031,7 +1031,7 @@ class Linux extends Unixcommon
                     $charge_now = Common::getIntFromFile($b.'/charge_now');
                     break;
                 default:
-                    continue;
+                    continue 2;
                     break;
             }
 
@@ -1348,7 +1348,7 @@ class Linux extends Unixcommon
                                 $state = 'Up (Stopped)';
                             break;
                             default:
-                                continue;
+                                continue 3;
                             break;
                         }
                     break;
@jrgp
Copy link
Owner

jrgp commented Apr 24, 2019

Hey, thanks for pointing this out. Will follow up

@jrgp jrgp closed this as completed in d7c8b3a May 3, 2019
Gummibeer added a commit to Astrotomic/laravel-linfo that referenced this issue Jun 29, 2020
jrgp added a commit that referenced this issue Nov 15, 2024
jrgp added a commit that referenced this issue Nov 16, 2024
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

2 participants