Skip to content

Add "Custom fixers" option #161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed

Add "Custom fixers" option #161

wants to merge 5 commits into from

Conversation

devatreides
Copy link

@devatreides devatreides commented Mar 24, 2023

When using a linter tool, sometimes the project requires a custom rule to meet specific needs. To cover such cases, PHP-CS-Fixer provides a custom fixer feature where you can create your own Fixer and register it in Finder. Today, when using Pint, it's not possible to register a custom rule, so when the project has this type of need, the developer ends up using PHP-CS-Fixer instead of Pint.

This PR adds a new option to the pint.json configuration file: custom-fixers. This option allows developers to list an array of custom fixer files they want to register and then declare the custom rule in the rules option.

Here is an example of a pint.json file with this option set:

  "custom-fixers": [
      "path/to/CustomFixer.php"
  ],
  "rules": {
      "custom-rule": true,
      ...
  }

Important to mention that the path is not absolute but relative to the root of the project.

@taylorotwell
Copy link
Member

IMO you should use php-cs-fixer instead of Pint in these cases. The entire purpose of Pint is to be extremely opinionated with minimal configuration.

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.

2 participants