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

Update check on set parameter to empty check. #85

Merged
merged 3 commits into from
Feb 13, 2020

Conversation

garretthyder
Copy link
Contributor

Update not-isset to empty on the second parameter check, fixing #84

Copy link
Contributor

@amostajo amostajo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to test this before approving, since empty will not validate if the index exists.

@garretthyder
Copy link
Contributor Author

Sounds good, if you'd like we can chain it with an array_key_exists but it shouldn't be needed as empty will return false if the index doesn't exist.
"No warning is generated if the variable does not exist. That means empty() is essentially the concise equivalent to !isset($var) || $var == false."
Reference: https://www.php.net/manual/en/function.empty.php

Testing the following all produce the correct message;
php ayuco set version
php ayuco set version:
php ayuco set version: 1.0.0
*Previously with the isset method the 2nd & 3rd would reset the version to an empty string as $object[1] was set but empty.

@amostajo amostajo added this to the 1.1.10 milestone Feb 13, 2020
@amostajo amostajo merged commit 2442ecf into 10quality:v1.0 Feb 13, 2020
@garretthyder garretthyder deleted the setvalueempty branch February 13, 2020 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants