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:
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user