plugin-php
plugin-php copied to clipboard
prettier-ignore breaking the ignored line
@prettier/plugin-php v0.11.2 Playground link
Input:
<?php
namespace App;
class Carousel extends Model
{
protected $table = 'carousels';
// prettier-ignore
protected $fillable = [
'status_id',
'type',
'image_path',
'alt_text',
'url',
'begin_datetime',
'end_datetime',
];
protected $casts = [
'begin_datetime' => 'datetime',
'end_datetime' => 'datetime',
];
}
Output:
<?php
namespace App;
class Carousel extends Model
{
protected $table = 'carousels';
// prettier-ignore
$fillable = [
'status_id',
'type',
'image_path',
'alt_text',
'url',
'begin_datetime',
'end_datetime',
]
protected $casts = [
'begin_datetime' => 'datetime',
'end_datetime' => 'datetime'
];
}
This is due to a bug in the parser: https://github.com/glayzzle/php-parser/issues/511
@c17r @czosel I found a workaround to this issue, just put the // prettier-ignore inside the array, and it will be formatted correctly
<?php
namespace App;
class Carousel extends Model
{
protected $fillable = [
// prettier-ignore
'status_id',
'type',
'image_path',
'alt_text',
'url',
'begin_datetime',
'end_datetime',
];
}