Skip to content

Inherited final constant causes fatal error (if the same interface is inherited multiple times) #7757

Closed
@internalsystemerror

Description

@internalsystemerror

Description

The following code:

<?php

interface EntityInterface {
    final public const TEST = 'this';
}

interface KeyInterface extends EntityInterface {
}

interface StringableInterface extends EntityInterface {
}

class SomeTestClass implements KeyInterface, StringableInterface {
}

Resulted in this output:

Fatal error: EntityInterface::TEST cannot override final constant EntityInterface::TEST in /in/UiiTf on line 13

Process exited with code 255.

But I expected this output instead:

No error

PHP Version

PHP 8.1.0

Operating System

Ubuntu 20.04

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