Static property x::$y cannot be readonly

Description

Static properties cannot be made readonly. Only properties can be readonly.

Example

<?php

class x {
     static readonly int $y;
}

?>

Solutions

  • Remove the readonly option on that property.

  • Make the property non-static .