So i was wondering if there is a way to method chain, when the initial method is a static function. Here is what I mean:
class foo
{
public static function a()
{
$foo = new foo;
return $foo->bar();
}
public function bar()
{
return $this;
}
public function b()
{
return 1;
}
}
print foo::a()->b();
EDIT
print foo::a()->b(); not print foo:a()->b();
bar(), you are calling propertybar. Demo of this working: codepad.org/5kPLusX8a(), you aren't returningbar(), you are returningbar. Something in your testing is off, you should have taken the time to at least share the code you meant, or something that actually works to demonstrate the issue.$foo->bar();) this code works for me and gives 1. What do you get?foo::a()->bar()->bar()->b();even if pointless.