Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Class attribute gets duplicated on another class property #2436

Copy link
Copy link
@hackel

Description

@hackel
Issue body actions

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.