Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function initialize(BindingType $type)
 {
     if ($this->typeName !== $type->getName()) {
         throw new InvalidArgumentException(sprintf('The passed type "%s" does not match the configured type "%s".', $type->getName(), $this->typeName));
     }
     if (!$type->acceptsBinding($this)) {
         throw BindingNotAcceptedException::forBindingClass($type->getName(), get_class($this));
     }
     // Merge default parameter values of the type
     $this->assertParameterValuesValid($this->userParameterValues, $type);
     $this->type = $type;
     $this->parameterValues = array_replace($type->getParameterValues(), $this->userParameterValues);
     ksort($this->parameterValues);
 }
 public function testUnrestrictedBindingClasses()
 {
     $type = new BindingType(Foo::clazz);
     $this->assertTrue($type->acceptsBinding(self::RESOURCE_BINDING));
     $this->assertTrue($type->acceptsBinding(self::CLASS_BINDING));
     $this->assertSame(array(), $type->getAcceptedBindings());
 }