Task #94683
Updated by Rozbeh Chiryai Sharahi about 3 years ago
I believe it is a good practice to have fluent setters (return type self) for instance in order to have immutable objects. Sure in that case it should be called with*. Nevertheless I don't find it necessary to force void as a return type on AbstractDomainObject->setPid. Also this avoids clean code styles like:
<pre><code class="php">
$someService->save((new Entity())->setPid(123));
</code></pre>
<pre><code class="php">
/**
* Setter for the pid.
*
* @param int $pid
*/
public function setPid(int $pid): void
{
$this->pid = $pid;
}
</code></pre>
If TYPO3 does not use this i fully understand but at least it should not force void return type, which makes it impossible as an extension developer to have fluent setters apart from creating a different method like setPageUid().
Kind regards and thank you for the great work
Rozbeh Chiryai Sharahi