Really excited to see the discussion about this feature being brought up again, 
thanks for working on this :)

One thing I would suggest is to add a base interface `Attribute` and multiple 
sub-interfaces such as `ClassAttribute`, `MethodAttribute`, and 
`PropertyAttribute` just like hack lang ( 
https://docs.hhvm.com/search?term=HH%20Attribute )

This allows one to declare attributes that can only be used with classes ( e.g 
`ORM\Entity` ), so PHP and check against them at runtime and throws an error 
when an attribute is used in the wrong place.

```php

namespace ORM {

  class Entity implements \ClassAttribute { ... }

}

namespace Foo {
  use ORM;

  <<ORM\Entity(...)>>  // <-- Error
  function bar(): void {}
}
```


I also question whether the following syntax would be supported:

```php
<<ORM\Entity(...), ORM\Table(...)>>
class Use {...}
```



I'm really looking forward to this since it can help bring more features into 
PHP such as :

- https://docs.hhvm.com/hack/attributes/predefined-attributes#__entrypoint
- https://docs.hhvm.com/hack/attributes/predefined-attributes#__memoize
- https://docs.hhvm.com/hack/attributes/predefined-attributes#__sealed


Regards.

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

Reply via email to