Skip to content

Signature of abstract set hook not enforced #15140

Closed

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

Activity

  1. self-assigned this
    on Jul 28, 2024
  2. added a commit that references this issue on Aug 5, 2024
    2f27e0b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions