/** * @param string $interface * @param null|object $bind * @param null|ResolverInterface $resolver */ public function __construct($interface, $bind = null, ResolverInterface $resolver = null) { try { ClassInfo::assertInterface($interface); parent::__construct(new \ReflectionClass($interface), $bind, $resolver); } catch (\Exception $exception) { throw $this->getConstructorException(['interface name string', $interface]); } }
/** * @param string $class * @param string $property * @param null|object $bindTo * @param null|ResolverInterface $resolver */ public function __construct($class, $property, $bindTo = null, ResolverInterface $resolver = null) { try { parent::__construct(new \ReflectionProperty($class, $property), $bindTo, $resolver); $this->declaringClass = new ClassInspector($class); } catch (\Exception $exception) { throw $this->getConstructorException(['class name string', $class], ['property name string', $property]); } }
/** * @param string $class * @param string $constant * @param null|object $bindTo * @param null|ResolverInterface $resolver */ public function __construct($class, $constant, $bindTo = null, ResolverInterface $resolver = null) { try { parent::__construct(new ReflectionConstant($class, $constant), $bindTo, $resolver); if (ClassInfo::isInterface($class)) { $this->declaringClass = new InterfaceInspector($class); } elseif (ClassInfo::isClass($class)) { $this->declaringClass = new ClassInspector($class); } } catch (\Exception $exception) { throw $this->getConstructorException(['class name string', $class], ['constant name string', $constant]); } }
/** * @param string $class * @param string $method * @param null|object $bindTo * @param null|ResolverInterface $resolver */ public function __construct($class, $method, $bindTo = null, ResolverInterface $resolver = null) { try { parent::__construct(new \ReflectionMethod($class, $method), $bindTo, $resolver); if (ClassInfo::isTrait($class)) { $this->declaringClass = new TraitInspector($class); } if (!ClassInfo::isTrait($class) && ClassInfo::isClass($class)) { $this->declaringClass = new ClassInspector($class); } } catch (\Exception $exception) { throw $this->getConstructorException(['class name string', $class], ['method name string', $method]); } }