Re: [PHP-DEV] Methods which auto-return the class instance

2022-12-23 Thread joke2k
Thanks for the feedback! On Fri, 23 Dec 2022, 09:33 Claude Pache, wrote: > It is very common for fluent class methods to have a verbose `return > $this;` ending in their body. > But If you have declared `self` as return type into a non-static class > method you have only two options to return: >

[PHP-DEV] Methods which auto-return the class instance

2022-12-22 Thread joke2k
Hi folks, What do you think about having a method which returns the class instance `$this` by default only IF its return type is set as `self`? It is very common for fluent class methods to have a verbose `return $this;` ending in their body. But If you have declared `self` as return type into a