The IDE in functions.php $result; will either tell me that the variable is undefined, and if I change it to $result = null; the IDE will tell me that it is an unused variable.
Why does this happen?
This underlines in PHPStorm as undefined variable:
function emptyInputSignup($name, $email, $username, $pwd, $pwdRepeat)
{
$result;
if (empty($name) || empty($email) || empty($username) || empty($pwd) || empty($pwdRepeat)) {
$result = true;
} else {
$result = false;
}
return $result;
}
This underlines in PHPStorm as unused variable:
function emptyInputSignup($name, $email, $username, $pwd, $pwdRepeat)
{
$result = null;
if (empty($name) || empty($email) || empty($username) || empty($pwd) || empty($pwdRepeat)) {
$result = true;
} else {
$result = false;
}
return $result;
}
>Solution :
I guess your IDE is frowning because, for instance :
$result;
if (empty($name) || empty($email) || empty($username) || empty($pwd) || empty($pwdRepeat)) {
$result = true;
} else {
$result = false;
}
return $result;
Could easily be replaced by :
if (empty($name) || empty($email) || empty($username) || empty($pwd) || empty($pwdRepeat)) {
return true;
}
return false;
So the use of a $result variable is indeed moot.