Skip to content

Incorrect lineno for property and class const variance check #14874

Open
@iluuu1994

Description

@iluuu1994

Description

The following code:

<?php

class C extends P {
    public const int X = 42;
}

class P {
    public const string X = 'X';
}

https://3v4l.org/IKY5H#v8.3.9

Resulted in this output:

Fatal error: Type of C::X must be compatible with P::X of type string in /in/ZAZYv on line 3

But I expected this output instead:

Fatal error: Type of C::X must be compatible with P::X of type string in /in/ZAZYv on line 4

Same goes for properties. From property hooks feedback:

#13455 (comment)

PHP Version

*

Operating System

No response

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