Cannot unset hooked property %s::$%s

Description

It is not allowed to unset a hooked property, aka, a property with a get or set (or both) hook.

Example

<?php

class X {
    public string $property {
        get => $this->x;
    }
}

$x = new X;
unset($x->x);

?>

Literal Examples

  • Cannot unset hooked property x::$property

Solutions

  • Assign null, or a null value to this property.

  • Reset the property to its default value.