I have a class's name and I want to call a static method on this class without instantiate it because of the logic in the constructor and the constructor arguments.
Here some basic code of what I want :
class MyClass {
// Complex constructor
public function __construct(string $var1, int $var2) {
// Side effects here
}
public static function myStatic(): string {
return '';
}
}
// Then I have a function later
function myFunction(string $class) {
$res = $class::myStatic() // <-- The goal (obviously don't work since $class is a string...)
}