Skip to content

Commit

Permalink
Merge branch '5.4' into 6.4
Browse files Browse the repository at this point in the history
* 5.4:
  implement __isset() together with __get()
  • Loading branch information
OskarStark committed May 24, 2024
2 parents 8f2e73a + 24c3fc2 commit 7c2d5a6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions components/property_access.rst
Original file line number Diff line number Diff line change
Expand Up @@ -258,16 +258,21 @@ The ``getValue()`` method can also use the magic ``__get()`` method::
{
return $this->children[$id];
}

public function __isset($id): bool
{
return true;
}
}

$person = new Person();

var_dump($propertyAccessor->getValue($person, 'Wouter')); // [...]

.. note::
.. caution::

The ``__get()`` method support is enabled by default.
See `Enable other Features`_ if you want to disable it.
When implementing the magic ``__get()`` method, you also need to implement
``__isset()``.

.. _components-property-access-magic-call:

Expand Down

0 comments on commit 7c2d5a6

Please sign in to comment.