I have class defined like this:
class FileSystem
{
private static $_instance = NULL;
private function __construct()
{
...
}
public static function getInstance()
{
if (self::$_instance === NULL) { // <- line 83
self::$_instance = new FileSystem;
}
return self::$_instance;
}
...
}
The error I get when running it is:
Uncaught Error: Access to undeclared static property: FileSystem::$_instance in /var/www/html/.../FileSystem.php:83
Server on which the code is running has php 7.1.
Method that calls that class is in another class:
public function stream_close()
{
if (!is_resource($this->_stream)) {
return false;
}
FileSystem::getInstance()->fclose($this->_stream);
return true;
}