8000 build(tools): Introduce Rector by theofidry · Pull Request #1380 · phpbrew/phpbrew · GitHub
[go: up one dir, main page]

Skip to content

build(tools): Introduce Rector#1380

Draft
theofidry wants to merge 3 commits intophpbrew:masterfrom
theofidry:tools/rector
Draft

build(tools): Introduce Rector#1380
theofidry wants to merge 3 commits intophpbrew:masterfrom
theofidry:tools/rector

Conversation

@theofidry
Copy link
Contributor
@theofidry theofidry commented Jun 24, 2024

This PR introduces Rector.

It is a tool I've been using moderately for the past few years and IMO can help our either punctually for some migration tasks or for some menial tasks.

Here I configured it with:

  • Import symbols when it can (i.e. make use of use statements instead of using a FQCN).
  • Remove unneeded imports (IMO this is more a task of a CS-Fixer but it does not hurt to have it here either, and there is no CS fixer at the moment).
  • Ensure the code is PHP 7.2 compatible. This way if you accidentally add a non PHP 7.2 compatible code, this will be flagged or fixed.

Locally you can use:

# Execute rector lint
make rector_lint

# Execute rector "fix"
make rector

Installing rector is done by using a separate composer.json to keep it simple. This way:

  • Managing rector is just like managing any other dependency, it is simply in a different directory.

  • Rector's dependencies will not pollute the project dependencies and mess up with the platform constraint, which allows us to run it with PHP 8.3 and configured as a PHP 8.3 dependency without any impact on the project main composer.json.

  • Depends on build: Reconfigure dependabot #1376 for the dependabot configuration

  • Depends on ci: Add an AutoReview workflow #1375 for the AutoReview workflow


rector_lint:
runs-on: ubuntu-latest
name: Composer Validate
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: Composer Validate
name: Rector Lint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments

0