Skip to content

Premium rules are not ignored when null and used without premium activated #522

@SharakPL

Description

@SharakPL

I use PSR12, which extends previous standards like PSR1 and PSR2:

"php.format.codeStyle": "PSR-12",

So by default the extension should use this standard in formatting, but it looks like extension settings, even if not set, override chosen standard. First of all you might want to add null to acceptable value types to avoid warnings (unless it's a bug within VSCode itself):
obraz

Even though I don't set any styling rules in settings.json (means this should be null and the rule directly from PSR12 standard should be used) and I don't even have premium active, these rules are used anyway like they were true instead of null:

obraz

For example:

if (isset($myVar)) {
    ...
}

if (!empty($myVar)) {
    ...
{

is formatted as

if (isset ($myVar)) {
    ...
}

if (!empty ($myVar)) {
    ...
{

It breaks rule PSR2.Methods.FunctionCallSignature.SpaceBeforeOpenBracket:

obraz

These are control structures:

  • if
  • else
  • elseif/else if
  • while
  • do-while
  • for
  • foreach
  • break
  • continue
  • switch
  • match
  • declare
  • return
  • require
  • include
  • require_once
  • include_once
  • goto

Of course I'm just guessing that's the rule causing this problem here. It would really help with debugging these if there was code style inspection available 🙏 Something like PHP Sniffer extension has:

obraz

showing specific rule that triggers styling error:

obraz

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions