get hook of property %s::$%s must not have a parameter list

Description

The get hook property cannot be specified with a parameter list: not with a parameter, nor even with the empty parenthesis.

Example

<?php

class X {
    private int $p {
        get($a) => 1;
    }

    private int $q {
        get() => 1;
    }
}


?>

Literal Examples

  • get hook of property X::$p must not have a parameter list

Solutions

  • Remove the parenthesis that follows the get keyword, and their content.

Changed Behavior

This error may appear following an evolution in behavior, in previous versions. See ` <https://php-changed-behaviors.readthedocs.io/en/latest/behavior/.html>`_.