Skip to content

Class attribute gets duplicated on another class property #2436

@hackel

Description

@hackel

The Deprecated attribute is being copied from the TYPES constant to the neighbouring $attributes property for some reason. I have to remove it manually whenever I format this file.

@prettier/plugin-php v0.22.4
Playground link

Input:

<?php

namespace App\Models;

class QuoteSearch extends Model
{
    #[Deprecated(message: 'use \App\Enums\MoveType')]
    public const TYPES = [
        'IMPORT' => 'import',
        'EXPORT' => 'export',
    ];

    protected $attributes = [
        'search_job_completed' => false,
    ];
}

Output:

<?php

namespace App\Models;

class QuoteSearch extends Model
{
    #[Deprecated(message: "use \App\Enums\MoveType")]
    public const TYPES = [
        "IMPORT" => "import",
        "EXPORT" => "export",
    ];

    #[Deprecated(message: "use \App\Enums\MoveType")]
    protected $attributes = [
        "search_job_completed" => false,
    ];
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions