Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Cannot declare hooks for static property

Description

Static properties are not supported for property hooks. Property hooks are only for non-static methods.

Example

<?php

class X
{
    public static string $property {
        set => $this->property . _1;

        SET {
            $this->property = $value;
        }
    }
}
?>

Alternatives

  • Make the property non-static.
  • Create accessors for the static property.