kokororin / vscode-phpfmt

Integrates phpfmt into VS Code
https://marketplace.visualstudio.com/items?itemName=kokororin.vscode-phpfmt
BSD 3-Clause "New" or "Revised" License
130 stars 30 forks source link

Constant names incorrectly reformatted to lowercase when named after keyword #84

Closed wosevision closed 1 year ago

wosevision commented 5 years ago

Hey!

I've noticed some incorrect lowercasing when constant names match certain PHP keywords. The casing-changes keep accidentally slipping into my commits and it's driving me crazy! I couldn't find a supported way to disable this 'rule' (not sure if it is even a rule) so I figured I'd raise an issue since a const shouldn't really be renamed by a formatter!

To see this, run phpfmt on a class with constants whose names match keywords, for example, print or list in uppercase:

abstract class MyConstants
{
    const EXAMPLE = 'example';
    const LIST = 'list';
    const PRINT = 'print';
    const TESTING = 'testing';
    const ECHO = 'echo';
}

The const names get changed upon formatting:

abstract class MyConstants
{
    const EXAMPLE = 'example';
    const list = 'list';    // <<<
    const print = 'print';    // <<<
    const TESTING = 'testing';
    const echo = 'echo';    // <<<
}

Is there some way to disable this?

Thanks for the great formatter!