Skip to content
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

Added fix subcommand options #4746

Merged
merged 1 commit into from
Apr 7, 2024
Merged

Conversation

kevinvanleer
Copy link
Contributor

@kevinvanleer kevinvanleer commented Mar 22, 2024

php-cs-fixer command line options are ordered. Options that appear after the main command are applied to the main command. Options that appear after the subcommands are applied to the subcommands. Baseline behavior will not apply a custom configuration.

// Does not work
php-cs-fixer --config ./custom-config.php fix target-file.php

That option must be applied to the fix subcommand.

// Works!
php-cs-fixer fix --config ./custom-config.php target-file.php

This change enables a user to fix options (like --config) in addition to base command options (like -nq).

After this change a user can set:

  let g:ale_php_cs_fixer_fix_options = '--config ' . fnamemodify(findfile('.php-cs-fixer.php', './;'), ':p')

in init.vim and php-cs-fixer will behave like eslint. A more sophisticated fixer definition might try to apply this strategy for finding the configuration before falling back to default behavior if no configuration is found.

php-cs-fixer command line options are ordered. Options that appear after the
main command are applied to the main command. Options that appear after the
subcommands are applied to the subcommands. This change enables a user to
specific fix options (like --config). This change also sets the plugin to
find the the configuraiton file in the current project tree. This matches
the default behavior of other linters like eslint.
Copy link
Contributor

@hsanson hsanson left a comment

Choose a reason for hiding this comment

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

Thanks.

@hsanson hsanson merged commit 6db58b3 into dense-analysis:master Apr 7, 2024
7 checks passed
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