Improve magic function __get.

Is not necessary another conditionals. When __get is called
is only when the the property is not defined, so
only need return null in order to avoid the
PHP notice of undefined property.
This commit is contained in:
KJ 2023-06-04 14:34:24 -04:00
parent d48f24ed98
commit 39a1f9d85a

View File

@ -38,9 +38,8 @@ class Neuron {
* @param string $index
* @return mixed
*/
public function __get(string $index) {
return (isset($this->{$index}) &&
$this->{$index} != '') ? $this->{$index} : null;
public function __get(string $index) : mixed {
return null;
}
}