Skip to content

preserve array comma style without spaces #170

@vkatochka

Description

@vkatochka

Hi!

Current phpfmt settings:

"phpfmt.psr2": false,
"phpfmt.indent_with_space": false,
"phpfmt.passes": [
  "AllmanStyleBraces"  
]

Original code:

#
$e = array('a','b','c','d');

#
if (in_array($e,['a','b','c']))
{
  return;
}

After formatting:

#
$e = array('a', 'b', 'c', 'd');

#
if (in_array($e, ['a', 'b', 'c']))
{
  return;
}

❓Question

Is it possible to add a setting that:

  • does not insert spaces after commas in arrays and function arguments
  • preserves the style like array('a','b')
  • and still uses tabs for indentation?

When using:

"phpfmt.psr2": true

— spaces after commas are not added, however, tabs are not allowed in PSR-2 mode, and formatting fails with an error

🙏 Feature Suggestion

Please consider adding a setting to preserve the original formatting style without spaces after commas, while still allowing tab indentation.

Thank you for a great extension and your continued support!

Best regards,
Vitalii

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions