On 23 December 2022 13:29:07 GMT, Claude Pache <claude.pa...@gmail.com> wrote:
>> Yes but declaring `self` is more strict than `object`. 
>> And talking about the word itself... Declaring to return (your-)`self` but 
>> you could return someone-else of the same type as you. 
>> But it is ok, it refers to the class name not the instance. just semantic.
>> 
>
>
>It is not about being less or more restricted, it is about being plainly 
>ambiguous.


Another big advantage of "return $this" is that it can't affect any existing 
code. Granted, a function marked :self or :static which currently fails to 
return would be a runtime error, but changing that error into an implicit 
return $this could be very dangerous.

Regards,

-- 
Rowan Tommins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to