Interfaces may not include properties¶
Description¶
Interfaces can define methods and constants, but they can’t define properties. Actually, they can only define properties with a property hook, as the property hooks are methods.
Example¶
<?php
interface I {
private $property;
}
?>
Solutions¶
Upgrade PHP version to 8.4.
Turn the interface in an abstract class.
Turn the interface in a trait.
Add a property hook to a property.
In previous PHP versions, this error message used to be Interfaces may only include hooked properties.