Plugin-php: Incorrect behavior of // prettier-ignore

Created on 13 Feb 2021  Â·  2Comments  Â·  Source: prettier/plugin-php

Look how the static keyword disappearing.

@prettier/plugin-php v0.16.1
Playground link

Input:

<?php

namespace DataMincerPlugins\Fields;

use DataMincerCore\Exception\PluginException;
use DataMincerCore\Plugin\PluginFieldBase;
use DataMincerCore\Plugin\PluginFieldInterface;

/**
 * @property PluginFieldInterface source
 * @property string[] levels
 */
class Balance extends PluginFieldBase {
  protected static $pluginId = "balance";
  // prettier-ignore
  static function getSchemaChildren() {
    return parent::getSchemaChildren() + [
      'source' => [ '_type' => 'partial', '_required' => TRUE, '_partial' => 'field' ],
      'levels' => [ '_type' => 'prototype', '_required' => TRUE, '_prototype' => [
        '_type' => 'text', '_required' => TRUE,
      ]]
    ];
  }
}

Output:

<?php

namespace DataMincerPlugins\Fields;

use DataMincerCore\Exception\PluginException;
use DataMincerCore\Plugin\PluginFieldBase;
use DataMincerCore\Plugin\PluginFieldInterface;

/**
 * @property PluginFieldInterface source
 * @property string[] levels
 */
class Balance extends PluginFieldBase {
  protected static $pluginId = "balance";
  // prettier-ignore
  function getSchemaChildren() {
    return parent::getSchemaChildren() + [
      'source' => [ '_type' => 'partial', '_required' => TRUE, '_partial' => 'field' ],
      'levels' => [ '_type' => 'prototype', '_required' => TRUE, '_prototype' => [
        '_type' => 'text', '_required' => TRUE,
      ]]
    ];
  }
}

bug ignore

Most helpful comment

Hehe, thanks for the most convenient way to report issues — the button in the right bottom in the playground!

All 2 comments

Thanks for the bug report @OnkelTem !

Hehe, thanks for the most convenient way to report issues — the button in the right bottom in the playground!

Was this page helpful?
0 / 5 - 0 ratings