BetterReflectionTest\Reflection\ReflectionClassTest::testIsInstance PHP Метод

testIsInstance() публичный Метод

public testIsInstance ( )
    public function testIsInstance()
    {
        // note: ClassForHinting is safe to type-check against, as it will actually be loaded at runtime
        $class = (new ClassReflector(new SingleFileSourceLocator(__DIR__ . '/../Fixture/ClassForHinting.php')))->reflect(ClassForHinting::class);
        $this->assertFalse($class->isInstance(new \stdClass()));
        $this->assertFalse($class->isInstance($this));
        $this->assertTrue($class->isInstance(new ClassForHinting()));
        $this->expectException(NotAnObject::class);
        $class->isInstance('foo');
    }
ReflectionClassTest