public static function createFromInstance($instance, $propertyName) { return ReflectionClass::createFromInstance($instance)->getProperty($propertyName); }
public function testCreateFromInstance() { $property = ReflectionProperty::createFromInstance(new ClassForHinting(), 'someProperty'); $this->assertInstanceOf(ReflectionProperty::class, $property); $this->assertSame('someProperty', $property->getName()); }