class ClassName {
public function f1() {
//...
return $this;
}
public function f2() {
//...
return $this;
}
// and for a static
public static function sf1() {
// ...
return self;
}
}
But, method chaining is a bad idea. It makes for hard to read code.
If you are returning an instance of the same object, it is not directly harmful. But, when you start writing code like $locator->get('MySQL')->connection()->query('SELECT 1');
, then it is possible that people who are stuck maintaining your code will find where you live and punish you.
Also, if you are going by "but jquery does it" reasoning, I am sorry to inform you, but that - more often than not - is a sign that something is a bad practice.