PHP Singleton design pattern inheritance error
<p>From php singleton class below</p>

<pre><code>&lt;?php
class Singleton
{
    /**
     * @var Singleton The reference to *Singleton* instance of this class
     */
    private static $instance;

    /**
     * Returns the *Singleton* instance of this class.
     *
     * @return Singleton The *Singleton* instance.
     */
    public static function getInstance()
    {
        if (null === static::$instance) {
            static::$instance = new static();
        }

        return static::$instance;
    }

    /**
     * Protected constructor to prevent creating a new instance of the
     * *Singleton* via the `new` operator from outside of this class.
     */
    protected function __construct()
    {
    }
}
</code></pre>

<p>I am trying to inherit new child class</p>

<pre><code>class SingletonChild extends Singleton {
}
</code></pre>

<p>but when I do testing</p>

<pre><code>$obj = Singleton::getInstance();
$obj_two = SingletonChild::getInstance();
var_dump($obj === Singleton::getInstance());             // bool(true)
var_dump($obj === $obj_two);   // false
</code></pre>

<p>I'm getting php fatal error.</p>

<blockquote>
  <p>PHP Fatal error:  Uncaught Error: Cannot access  property
  SingletonChild::$instance</p>
</blockquote>