Cannot use ‘final’ as constant modifier

Description

final` is an option for methods, and it is not available for class constants and properties. It becomes a feature with class constants in PHP 8.0.

Example

<?php

class X {
     private static const A  = 1;
}

?>

Solutions

  • Remove the option from the constant signature.