Skip to content

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

Closed

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

Activity

  1. added a commit that references this issue on Dec 12, 2021
    42f77be
  2. added a commit that references this issue on Dec 12, 2021
    dd6b1b7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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