Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Moving from PHP Annotations to Attributes? Use this helpful Rector script! #1047

@BusterNeece

Description

@BusterNeece

This isn't a bug report, but rather a helpful tool that might save folks moving from annotations to attributes a lot of time.

Rector has a tool that can automatically migrate annotations to attributes, so long as you provide the class mapping for it.

Here's a sample script I set up that (crudely) does the migration from annotations to attributes:

https://gist.github.com/BusterNeece/230f1bf619740b0564b88a69978de82c

It's not perfect, but it gets you to a really good starting point and takes care of a task that is extremely boring to do otherwise.

Edit: See below for a link to a repo that does this in an improved manner!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions