php空检查param在非空变量上返回false

class Renderer
{
    private $data;

    public function __construct()
    {
        $this->data = array();
    }

    public function __get($key)
    {
        return array_key_exists($key, $this->data) ? $this->data[$key] : null;
    }

    public function __set($key, $value)
    {
        $this->data[$key] = $value;
    }
}

When I check empty($renderer->param) it returns false even if var_dump($renderer->param) returns correct value.

Is it that php checks for parameter inside class when it's stored in array or am I missing something?

You could (should?) implement an __isset() method. The manual on empty() says:

When using empty() on inaccessible object properties, the __isset() overloading method will be called, if declared.