Let's assume you have something like this:
<?php
class Foo {
public function external() {
$this->setValue1()->setValue2();
}
/**
* @return Foo
* Returns the called object.
*/
protected function setValue1() {
$this->foo = mt_rand(1, 10);
return $this;
}
/**
* @return Foo
* Returns the called object.
*/
protected function setValue2() {
$this->foo = mt_rand(1, 10);
return $this;
}
}
?>
What about document this using @return Foo|$this, so it's a bit easier to read, and can be understood by IDEs, so they don't show problems when calling protected methods in a chain.