Created
November 29, 2020 00:24
-
-
Save paramientos/afcbda67a7b5f04c44fe055edc9806de to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// before | |
$user = get_user($id); | |
if (!is_null($user)) { | |
$address = $user->getAddress(); | |
if (!is_null($address)) { | |
$state = $address->state; | |
If (!is_null($state)) { | |
// And so on. | |
} | |
} | |
} | |
//after | |
$state = get_user($id)?->getAddress()?->state; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment