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:
parent
d48f24ed98
commit
39a1f9d85a
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user