Disabling the alert message is not a way to solve the problem. Despite the PHP core is continue to work it makes a dangerous assumptions and actions.
Never ignore the error where PHP should make an assumptions of something!!!!
If the class organized as a singleton you can always use function getInstance() and then use getData()
Likse:
$classObj = MyClass::getInstance();
$classObj->getData();
If the class is not a singleton, use
$classObj = new MyClass();
$classObj->getData();