bug fix
This commit is contained in:
parent
a7c81577c7
commit
763bba9b89
@ -81,8 +81,7 @@ class InterfaceInjector
|
||||
if (is_string($object)) {
|
||||
$reflection = new \ReflectionClass($object);
|
||||
|
||||
return $reflection->implementsInterface($this->class)
|
||||
|| $reflection->isSubClassOf($this->class)
|
||||
return $reflection->isSubClassOf($this->class)
|
||||
|| $object === $this->class;
|
||||
}
|
||||
|
||||
|
@ -146,6 +146,9 @@ class InterfaceInjectorTest extends \PHPUnit_Framework_TestCase
|
||||
array(new InterfaceInjector('Symfony\Tests\Component\DependencyInjection\SubService'), 'Symfony\Tests\Component\DependencyInjection\Service', false),
|
||||
array(new InterfaceInjector('Symfony\Tests\Component\DependencyInjection\Service'), 'Symfony\Tests\Component\DependencyInjection\SubService', true),
|
||||
array(new InterfaceInjector('Symfony\Tests\Component\DependencyInjection\SubService'), 'Symfony\Tests\Component\DependencyInjection\SubService', true),
|
||||
array(new InterfaceInjector('Symfony\Tests\Component\DependencyInjection\FooInterface'), 'Symfony\Tests\Component\DependencyInjection\SubService', true),
|
||||
array(new InterfaceInjector('Symfony\Tests\Component\DependencyInjection\FooInterface'), 'Symfony\Tests\Component\DependencyInjection\Service', false),
|
||||
array(new InterfaceInjector('Symfony\Tests\Component\DependencyInjection\FooInterface'), 'Symfony\Tests\Component\DependencyInjection\ServiceWithConstructor', false),
|
||||
);
|
||||
}
|
||||
|
||||
@ -168,5 +171,7 @@ class InterfaceInjectorTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
}
|
||||
|
||||
class ServiceWithConstructor { public function __construct(\DateTime $required) {} }
|
||||
class Service {}
|
||||
class SubService extends Service {}
|
||||
class SubService extends Service implements FooInterface {}
|
||||
interface FooInterface {}
|
Reference in New Issue
Block a user