I am working on something, just practicing and I don't have that much experience. I am using namespaces and I have one functions in class namespaced under 'App\Core' which should include another file with different class and namespaced under 'App\Diff' and return that new class. i.e.
namespace App\Core;
class Test {
public function testFunc($file) {
require_once "../folder/" . $file . ".php";
return new $file();
}
}
now class inside $file
namespace App\Diff;
class Test2 {
}
I tried something like return
new App\Diff . "\{$file()}";
but I got an error "Class App\Code\App\Diff not found ..."