phptools-docs icon indicating copy to clipboard operation
phptools-docs copied to clipboard

PHP 8.4 Object Interfaces not supported?

Open gremo opened this issue 5 months ago • 3 comments

Sorry if this has been already addressed.

Seems that Object Interfaces are not supported. The extensions show no errors, you get a fatal error:

interface I
{
    // An implementing class MUST have a publicly-readable property,
    // but whether or not it's publicly settable is unrestricted.
    public string $readable { get; }

    // An implementing class MUST have a publicly-writeable property,
    // but whether or not it's publicly readable is unrestricted.
    public string $writeable { set; }

    // An implementing class MUST have a property that is both publicly
    // readable and publicly writeable.
    public string $both { get; set; }
}

// This class fails in implementing the interface
class C1 implements I
{
}

gremo avatar Jun 18 '25 18:06 gremo

Good point @gremo ,

We support object interfaces of course, but we don't check that the interface property is implemented by its class (so there is no warning in problems window).

Will be implemented!

jakubmisek avatar Jun 19 '25 12:06 jakubmisek

@jakubmisek Yes, of course — I meant that no error is reported. Thanks, and as always, great job and thanks for the speed with which you handle issues!

gremo avatar Jun 19 '25 13:06 gremo

@gremo thank you, we'll try to add property checks on interfaces in future update!

jakubmisek avatar Jun 22 '25 11:06 jakubmisek