- This topic has 8 replies, 1 voice, and was last updated 2 months, 2 weeks ago by afuiasdyfuiay.
- November 5, 2020 at 12:12 pm #1605autopoietic_sapienParticipant
PHP 8.0 feature focus: nullsafe methodsNovember 5, 2020 at 12:12 pm #1606helloworderGuest
I’d rather call that nullsafe method **calls**November 5, 2020 at 12:12 pm #1607monstermudder78Guest
Fuckin finally.November 5, 2020 at 12:12 pm #1608tamasmagyarhunorGuest
I am a Mid PHP Developer in my job, more like an advanced junior in general and both this and last weeks article (about weak maps) were amazing and super good insight. thanks for taking the time to write and post them! <3November 5, 2020 at 12:12 pm #1609oojacobooGuest
Trying to think of where I’d use this. In general, if I’m expecting an object and don’t get it, there is a business logic issue and an exception is warranted.
What would be nice, is if I could define that exception.November 5, 2020 at 12:12 pm #1610SavishSalaciousGuest
I would love to see the C implementation for this.November 5, 2020 at 12:12 pm #1611tomtheimpalerGuest
Thanks Larry. Can’t wait to use this personally, an old inherited project will be really helped by thisNovember 5, 2020 at 12:12 pm #1612rreynierGuest
Can someone explain to me why nulls are so bad. If I have a User who can optionally have an Address, to me it makes sense that $user->get address() would return null. I’m not sure what else is should return if nulls were not a thing?November 5, 2020 at 12:12 pm #1613afuiasdyfuiayGuest
`$state = get_user($id)?->getAddress()?->state;`
?? sorry but this sucks. the operator is easy to miss and could make bugs harder to track down to fix the root cause.
- You must be logged in to reply to this topic.