Index

tPropertyGetter

MMO\core\classes · 1 symbol · generated 5 Oct 2026

trait

tPropertyGetter

tPropertyGetter.php:14

Trait to make protected and private properties readable from outside the class, as $obj->propertyName, through PHP's __get/__isset magic methods. Properties remain read-only from the outside: nothing in this trait implements __set, so $obj->propertyName = ... still fails with PHP's own visibility error.

trait MMO\core\classes\tPropertyGetter
Namespace
MMO\core\classes
class Thing {use tPropertyGetter; protected string $name = 'Marc';} (new Thing())->name; // 'Marc', even though $name is protected

Index

__get($key)__get -- allow read access to a protected/private property from outside the class.
__isset($key)__isset

Methods2

__get($key)

tPropertyGetter.php:25

__get -- allow read access to a protected/private property from outside the class.

function __get($key)
$key
returns
throwsif no such property exists at all (a declared-but-uninitialized typed property is returned as-is here, and would raise PHP's own "must not be accessed before initialization" error, not this exception)
$thing->name; // 'Marc'$thing->doesNotExist; // throws eNotFound