-
Notifications
You must be signed in to change notification settings - Fork 56
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
Forbidden usage of settype function #46
Conversation
Can we also ban |
@Majkl578 Isn't |
No, |
Isn't a <?php
$foo = (unknow value);
switch(gettype($foo)) {
case 'string': /* do someting */;
case 'int': /* do someting */;
case 'array': /* do someting */;
}
// vs
if (is_string($foo)) {
// do something
} elseif (is_int($foo)) {
// do something
} elseif (is_array($foo)) {
//do something
} |
switch (true) {
case is_string($foo) :
// do something
case is_int($foo) :
// do something
case is_array($foo) :
//do something
} |
I don't like So feel free to propose it :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL settype
is a thing o.O
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please add tests to verify this behaviour?
3ea9c92
@lcobucci Added 👍 Gosh, I amend the commit, all reviews were gone 🤦♂️ |
I didn't even know |
@deeky666 Feel free to vote with a review |
I'd like to propose the forbidden usage of the
settype
function. cast should be used instead: