On 19/01/2023 19:25, Ilija Tovilo wrote:
This has been suggested before and we're consider it. Here's a
comparable PHP implementation.

https://3v4l.org/6Ua8t


I'm confused what all the complexity here is doing. I get the same result for that example with this one liner, using a tightly limited backtrace with no objects:

function get_calling_scope() {
    return debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3)[2]['class'] ?? null;
}

https://3v4l.org/VQARq3


In the RFC and this thread you talk a lot about parent::__get() needing special cases, but I don't understand why. In my mind, parent::__get('name') is just a regular method call, so why does it change the meaning of "calling scope"?

Regards,

--
Rowan Tommins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to