0

I have an eloquent model in Laravel that I would like to mark an user_id attribute as deprecated using the @deprectated tag in PHPDoc.

I can add the @property tag to my model to document user_id but if I try to add the deprecated tag my IDE (vscode) still does not inform me that the attribute is deprecated.

Looking at the documentation I can't see any way of combining both @property and @deprecated.

Does anyone know a way for me to document this correctly?

The model

/**
 * App\Task\Models\Task
 *
 * @property null|int $user_id
 */
final class Task extends Model
{
    protected $guarded = ['id'];

    protected $casts = [
        'user_id' => 'int',
    ];

    protected $fillable = [
        'user_id',
    ];

}

Attempted Code

@property @deprecated null|int $user_id

Versions

  • Laravel: 10
  • PHP: 8.2
  • VSCode: 1.80.2
  • VSCode extension PHP Intelephense: 1.9.5
Abdulla Nilam
  • 36,589
  • 17
  • 64
  • 85
Jamie Woods
  • 517
  • 2
  • 10
  • 25
  • Does this answer your question? [How to deprecate PHP's magic property in PHPDoc?](https://stackoverflow.com/questions/37554329/how-to-deprecate-phps-magic-property-in-phpdoc) – Maksim Jul 31 '23 at 23:13

1 Answers1

0

These are two different attributes. So you can't declare it in one line.

/**
 * App\Task\Models\Task
 *
 * @property null|int $user_id
 * @deprecated null|int $user_id This property will be removed.
 */
final class Task extends Model

}
Abdulla Nilam
  • 36,589
  • 17
  • 64
  • 85