Skip to content

Add detection of overridden deprecated properties #82

Open
@jnoordsij

Description

@jnoordsij

Feature request: When overriding a class property in a child class, that is marked as deprecated in the parent class, a warning should be given. Currently only accessing such properties within methods of the child class triggers this warning.

This would be particularly useful for cases where an upstream package marks a property as deprecated, and where the intended method of setting the property is through overriding it with a new (default) value within the child class, without explicitly accessing it in any method on the child class.

A real world example of such a case is the planned removal of the dates property in Laravel, which won't be detected as a deprecated property currently when overriding it. A code example that currently does not yield any warning:

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Foo extends Model
{
    protected $dates = ['foo'];
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions