Closed francescolaffi closed 11 months ago
4 is also fine 😂 But really, I haven't added support for other targets because it was more work at the time and the extension doesn't support properties elsewhere (which I admit is more of an excuse). But I thought I had at least documented it which turned out that I haven't, sorry!
I'm fine with adding support for just properties plus document the limitation, or add full support, and then probably no documentation changes needed. Not sure what's easier now 😅
Duck typing doesn't sound like something I'd like to see but may be needed, I don't know right now. PR is always welcome!
Hey @francescolaffi I got somehow interested more now (= can't sleep) 😄 and created #225. It's marked as Draft because there are more nodes (in PhpParser
teminology) that can be targeted with an atribute like enums, and possibly more, that are not yet supported. You can work on that PR if you want/can, otherwise I'll probably add those in the upcoming days.
All targets are now supported, would still like to add tests for attributes for arrow function, closure, function, interface, trait.
thanks @spaze! that was fast :)
tested it out from the main branch and it works as intended, notices something minor addressed in #229
Currently
disallowedAttributes
support only on attributes that target classes/interfaces/... or functions/methods (byAttributeUsages::processNode
)But attributes can have other targets, I discovered this limitation while trying to restrict an attributes that is used on class properties.
I think it should be possible for
AttributeUsages
to support nodes for the other targets, but I'd like to know where @spaze stands on this:I'd go for 2, let me know what you thing and if you'd welcome a PR (probably in a few weeks) or if you'd like to handle it directly