Skip to content

Signature of abstract set hook not enforced #15140

Closed
@nikic

Description

@nikic

Description

The following code:

<?php
interface I {
    public string $prop {
        set(int|string $value);
    }
}
class C implements I {
    public string $prop;
}

Currently does not produce an error, but should, because the implementing class does not satisfy the set(int|string) constraint.

Alternatively, explicitly specifying the set parameter in an abstract hook could be forbidden.

PHP Version

PHP 8.4 (a7d856)

Operating System

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions