PHP 8.0 feature focus: nullsafe methods

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1605
    autopoietic_sapien
    Participant

    PHP 8.0 feature focus: nullsafe methods

    #1606
    helloworder
    Guest

    I’d rather call that nullsafe method **calls**

    #1607
    monstermudder78
    Guest

    Fuckin finally.

    #1608
    tamasmagyarhunor
    Guest

    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! <3

    #1609
    oojacoboo
    Guest

    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.

    #1610
    SavishSalacious
    Guest

    I would love to see the C implementation for this.

    #1611
    tomtheimpaler
    Guest

    Thanks Larry. Can’t wait to use this personally, an old inherited project will be really helped by this

    #1612
    rreynier
    Guest

    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?

    #1613
    afuiasdyfuiay
    Guest

    `$state = get_user($id)?->getAddress()?->state;`

    &#x200B;

    ?? sorry but this sucks. the operator is easy to miss and could make bugs harder to track down to fix the root cause.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.