Elektrine lite

← Feed

@dseguy@phpc.social

Post #3499185

2026-06-30 20:31 UTC

So, it seems that it is possible to paint oneself in a corner and write an unreachable method. How would you call A::foo() in this code below? Come on, #PHP, there must be something here. #phptip #phptrick https://php-tips.readthedocs.io/en/latest/tips/unreachable_method.html

Replies (3)

  • @timwolla@phpc.social 2026-06-30 21:41

    @dseguy@phpc.social https://www.reddit.com/r/PHP/comments/1uk14cw/comment/ousgzt2/

    Open ##3499184

  • @gmazzap@phpc.social 2026-06-30 23:18

    @dseguy@phpc.social If it's public, it's easy https://3v4l.org/GGTeV#v

    Open ##3506001

  • @awoodsnet@phpc.social 2026-07-02 20:13

    @dseguy@phpc.social Here's my approach. Maybe it's considered “cheating” by creating a new method. However, I wanted to do it without changing the external call. This makes the output `CA` instead of `CB`. If only parent::parent::foo() could work :D

    Open ##3883196