PHP code example of it-bens / reflection-constructor
1. Go to this page and download the library: Download it-bens/reflection-constructor library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
it-bens / reflection-constructor example snippets
use ITB\ReflectionConstructor\ReflectionConstructor;
$constructor = new ReflectionConstructor(SomeClass::class);
$parameterName = $constructor->extractParameterNameForClassName(SomeOtherClass::class);
// or
$someObject = new SomeOtherClass();
$parameterName = $constructor->extractParameterNameForObject($someObject)
class SomeClass {
public function __construct(Type1 $propertyOne, Type2 $propertyTwo, Type2 $propertyThree) {
// ...
}
}