Property hook cannot be both abstract and final

Description

This error is emitted when a property is defined in an interface, with the final option. There, a property hook is automatically abstract, as it is part of an interface, so the abstract option is understated.

In a class or a trait, the reported error is that abstract is not allowed on a property hook.

Example

<?php

interface I {
    public int $p {
        final get;
    }
}

?>

Solutions

  • Remove the final option from the property hook.

Changed Behavior

This error may appear following an evolution in behavior, in previous versions. See ` <https://php-changed-behaviors.readthedocs.io/en/latest/behavior/.html>`_.