Re: Annotation PHP 7
| From: | Florian Anderiasch | Date: | Tue, 04 Nov 2014 18:33:15 +0000 |
| Subject: | Re: Annotation PHP 7 | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78666@lists.php.net to get a copy of this message | ||
On 04.11.2014 17:34, Andrea Faulds wrote:
> In Python, a decorator is a function (or callable object), and you use one like this:
>
> @some_decorator(foo, bar)
> def myfunc():
> # function source code here
I wonder how feasible it would be to add something like this and allow
everything that's allowed in a php function/method call as parameters
inside the annotation call - kind of like python does it, which seems to
be one of the simplest (in usage, not implementation) forms possible.
/**
* @ORM\Entity
* @Table(name="message")
*/
class User {}
becomes something like
@ORM\Entity
@Table(['name' => 'message'])
class User {}
with Entity and Table being callables, obviously. Maybe classes, with
User being the first argument, but I haven't thought that through.
~Florian