Skip to content

Attribute "Override" cannot target property #19086

Closed as not planned
Closed as not planned
@rino1

Description

@rino1
$ cat test.php 
<?php
interface XXX {
    public $yyy { get; }
}
new class implements XXX {
    #[Override]public $yyy;
};

$ php /data/test.php 
Fatal error: Attribute "Override" cannot target property (allowed targets: method) in /data/test.php on line 6

But wouldn't it be a great idea to use Override attribute for properties too?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions