No Final Parameter
<?php
class X {
function __construct(
//Cannot use the final modifier on a parameter
private final $property
) {}
}
Final is reserved for class elements, such as property, methods and constants. They do not apply to parameters, unless the parameter is a promoted property, in the constructor signature.
In that case, the property cannot be declared in the constructor, and must be declared independently, or without the final key word.
See Also
- Final (PHP manual)
- Final On A Parameter [Try me]
PHP Error Messages
PHP Features
Last updated: 10 September 2026