Am trying to get the constructor’s arguments from the class of $object:
$reflectionClass = new \ReflectionClass($object);
$constructor = $reflectionClass->getConstructor();
$constructor_params = $constructor -> getParameters();
The error I get:
Fatal error: Call to a member function getParameters() on a non-object
Update:
It turns out that it doesn’t have a constructor. How can I check that it does first?
Check whether it has a constructor with:
However, that doesn’t necessarily mean you can instantiate an object (e.g. when the constructor is private):