From 39a1f9d85a409092d28f22a6969392d927c02a8a Mon Sep 17 00:00:00 2001 From: KJ Date: Sun, 4 Jun 2023 14:34:24 -0400 Subject: [PATCH] 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. --- src/Libs/Neuron.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Libs/Neuron.php b/src/Libs/Neuron.php index 913a1e8..59678b1 100644 --- a/src/Libs/Neuron.php +++ b/src/Libs/Neuron.php @@ -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; } }