Re: Suggestion Method Constant
| From: | Mathias Grimm | Date: | Thu, 12 Oct 2017 18:28:03 +0000 |
| Subject: | Re: Suggestion Method Constant | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-100884@lists.php.net to get a copy of this message | ||
The only problem with the @ symbol is the lack of consistency with the
other constants class constants are also MyClass::MY_CONST, or
MyClass::class, so I think it makes sense to also be
MyClass::myMethod::method
On 12 October 2017 at 20:24, Michael Döhler <michaeldoehler@me.com> wrote:
> Hi,
>
> Same i have in mind, for example: MyClass@myMethod
>
> To make also some method call routing easier, e.g. in userland routers.
>
> Transform the current approach:
>
> $app->get("/foo", [MyClass::class, "myMethod"]);
>
> To:
>
> $app->get("/foo", MyClass@myMethod);
>
> This will ease a lot, e.g. for refactoring, IDE usage and completes the
> code as configuration approach for PHP.
>
> Thanks
> Michael
>
> > Am 12.10.2017 um 19:43 schrieb Mathias Grimm <mathiasgrimm@gmail.com>:
> >
> > I would like to suggest a method constant that could be used the same way
> > we use the ::class one
> >
> > I don't have a strong personal preference but it could be something like:
> >
> > MyController::myActionMethod::method, no sure about the internals but it
> > would be consistent with the one for the class.
> >
> > Cheers,
>