D
D
dev4002016-09-26 19:52:46
PHP
dev400, 2016-09-26 19:52:46

How to get constructor arguments through reflection?

Is it possible to somehow pull out what the class constructor takes?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vadim Kot, 2016-09-26
@vadimkot

You can get constructor parameters

$construct = new ReflectionMethod('SomeClass',  '__construct');
$parameters =  $construct->getParameters();
var_dump($parameters);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question