使用命名空间在扩展类中访问$ this

B.php:

class B extends A {
    function foo() {
        $this->get['id'];
    }
}

C.php:

namespace NAME;
class C extends B {
    function foo() {
        $b = new \B();
        $b->get['id'] = $params['userToken'];
    }
}

The above works but how to I access $this instead of creating a new instance of B?

If I try and access it like this:

namespace NAME;
class C extends B {
    function foo() {
        $this->get['id'] = $params['userToken'];
    }
}

It returns the error: Using $this when not in object context. $this is protected but as it C is extending B it shouldn't cause an issue and if it does, shouldn't return that error.

Your last piece of code will work, but when you use call_user_func() to call a method that uses $this you need to pass an instance instead of the class name, i.e.

call_user_func([new C, 'foo']);