.. _cannot-use-the-final-modifier-on-a-parameter:
Cannot use the final modifier on a parameter
--------------------------------------------
.. meta::
:description:
Cannot use the final modifier on a parameter: The ``final`` option is not available for promoted properties, until PHP 8.
:og:image: https://php-errors.readthedocs.io/en/latest/_static/logo.png
:og:type: article
:og:title: Cannot use the final modifier on a parameter
:og:description: The ``final`` option is not available for promoted properties, until PHP 8
:og:url: https://php-errors.readthedocs.io/en/latest/messages/cannot-use-the-final-modifier-on-a-parameter.html
:og:locale: en
:twitter:card: summary_large_image
:twitter:site: @exakat
:twitter:title: Cannot use the final modifier on a parameter
:twitter:description: Cannot use the final modifier on a parameter: The ``final`` option is not available for promoted properties, until PHP 8
:twitter:creator: @exakat
:twitter:image:src: https://php-errors.readthedocs.io/en/latest/_static/logo.png
.. raw:: html
Description
___________
The ``final`` option is not available for promoted properties, until PHP 8.5. Until then, the property shall be ``final`` but not ``promoted``, or it has to be declared the traditional way.
Example
_______
.. code-block:: php
Solutions
_________
+ Upgrade to PHP 8.5 or more recent.
+ Remove the final property from the promoted property.
+ Create the property in the class body.
Changed Behavior
________________
This error may appear following an evolution in behavior, in previous versions. See ` `_.