This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 271377

Summary: instantiate a class dynamically
Product: php Reporter: abdelaziz_slim
Component: CodeAssignee: issues@php <issues>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.2   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Attachments: the method that instantiate classes dynamically

Description abdelaziz_slim 2017-08-27 07:10:29 UTC
Created attachment 165019 [details]
the method that instantiate classes dynamically

//when we have an abstract class like this
abstract class Controller{}

// and in another class we make a method to instantiate classes dynamically
private function addController($controller) {
    $object = new $controller($this->app);
}

# that shouldn't give us an error but this message appears
//==================================================
//Abstract class Controller can not be instantiated
//==================================================

thanks a lot for your great work;