Skip to content

Commit 7c2d5a6

Browse files
committed
Merge branch '5.4' into 6.4
* 5.4: implement __isset() together with __get()
2 parents 8f2e73a + 24c3fc2 commit 7c2d5a6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

components/property_access.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,16 +258,21 @@ The ``getValue()`` method can also use the magic ``__get()`` method::
258258
{
259259
return $this->children[$id];
260260
}
261+
262+
public function __isset($id): bool
263+
{
264+
return true;
265+
}
261266
}
262267

263268
$person = new Person();
264269

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

267-
.. note::
272+
.. caution::
268273

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

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

0 commit comments

Comments
 (0)