Re: Re: [RFC] [DISCUSSION] Consistent Function Names
| From: | Rowan Collins | Date: | Sun, 08 Mar 2015 13:53:59 +0000 |
| Subject: | Re: Re: [RFC] [DISCUSSION] Consistent Function Names | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-84435@lists.php.net to get a copy of this message | ||
On 08/03/2015 01:25, Yasuo Ohgaki wrote:
Hi Rowan, On Sun, Mar 8, 2015 at 8:31 AM, Rowan Collins <rowan.collins@gmail.com <mailto:rowan.collins@gmail.com>> wrote:In favour of what? We have no other way of telling a function expecting a callback to use an existing method. And why? Because one particular function signature you want to create would be possible if "array" and "callback" were non-overlapping type hints? Is there something wrong with having a function that explicitly tells people it takes callbacks, rather than guessing based on the arguments you pass in? Regards, -- Rowan Collins [IMSoP]What? That's not the same thing at all. I'm pretty sure those functions are deprecated *because* we have array callback forms, so you can use call_user_func to call a method.PHP has a well-defined definition of "callable", as used by is_callable() and function parameter typehints, and literally everywhere that wants a callback. Since there's no such thing as a function or method pointer, that definition includes a string identifying a plain function, and two array forms, [string, string] and [object, string], representing static and instance methods, respectively. You can't not accept those forms as a callback parameter in one particular function just to make things tidier.I should have written "Let deprecate _all_ array callbacks" by document and raise deprecate error in PHP7. Remove array callbacks in PHP 8.