Enable Auto-Fix#
Code actions can be applied automatically as auto-fix or on file save.
Set Code Action as Auto-Fix#
Set the code action convention to autofix
in the .editorconfig
file, as shown on example below:
This applies the code action as automatic (preferred) fix. Such actions can be applied using Auto Fix ...
command, and marked with a blue light bulb (by default).
Auto-Fix on File Save#
Code actions marked as autofix can be applied automatically on file save using the following setting:
Auto-Fix and Code Style#
Setting a code style (setting "php.format.codeStyle"
) may enable auto-fix on code actions that are required by the selected code style. For example setting PER
code style implicitly enables "Remove Redundant Closing Tag ?>
" code action.
In future update, code style may also change the severity of code code actiun, so it will appear as error.