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

Remove unneeded isset check #22809

Merged
merged 1 commit into from
Sep 14, 2020

Conversation

nickvergessen
Copy link
Member

Due to the and the later part was checked anyway, but isset also works if a parent key does not exist, so removing it

Signed-off-by: Joas Schilling <coding@schilljs.com>
@@ -317,7 +317,7 @@ public function setUserValue($userId, $appName, $key, $value, $preCondition = nu
*/
public function getUserValue($userId, $appName, $key, $default = '') {
$data = $this->getUserValues($userId);
if (isset($data[$appName]) and isset($data[$appName][$key])) {
if (isset($data[$appName][$key])) {
Copy link
Contributor

@kesselb kesselb Sep 11, 2020

Choose a reason for hiding this comment

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

return $data[$appName][$key] ?? $default;

https://3v4l.org/J6vOL should also work. But current approach is also fine.

Copy link
Member Author

Choose a reason for hiding this comment

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

One step after the other.

Copy link
Member

@rullzer rullzer left a comment

Choose a reason for hiding this comment

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

Sure

@nickvergessen nickvergessen merged commit a053aa7 into master Sep 14, 2020
@nickvergessen nickvergessen deleted the bugfix/noid/remove-unneeded-isset-check branch September 14, 2020 06:49
@rullzer rullzer mentioned this pull request Sep 14, 2020
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants