php-src icon indicating copy to clipboard operation
php-src copied to clipboard

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

Open internalsystemerror opened this issue 4 years ago • 0 comments

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

internalsystemerror avatar Dec 11 '21 11:12 internalsystemerror