Skip to content

Allow other namespaces for @Inject in JmsInjectAnnotationRector #1400

@holtkamp

Description

@holtkamp

I was checking whether I could use rector to change my PHP-DI @Inject annotation-based dependency injections to constructor based injections.

To my big surprise I found out about an already existing rector:

https://github.com/rectorphp/rector/blob/master/docs/AllRectorsOverview.md#jmsinjectannotationrector

The only difference seems to be that the PHP-DI @Inject annotation does not have/use a namespace. That made me wonder, instead of making a new rector, would it be a (good) idea to change https://github.com/rectorphp/rector/blob/fac1503915aea843a3c123a5c622ecf0708bda62/packages/Jms/src/Rector/Property/JmsInjectAnnotationRector.php in such a way that the namespace of the annotation can be configured / left empty, probably defaulting to

private const INJECT_ANNOTATION = 'JMS\DiExtraBundle\Annotation\Inject';

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions