BetterReflection\Reflection\ReflectionProperty::createFromName PHP Метод

createFromName() публичный статический Метод

Create a reflection of a class's property by it's name
public static createFromName ( string $className, string $propertyName ) : BetterReflection\Reflection\ReflectionMethod
$className string
$propertyName string
Результат BetterReflection\Reflection\ReflectionMethod
    public static function createFromName($className, $propertyName)
    {
        return ReflectionClass::createFromName($className)->getProperty($propertyName);
    }

Usage Example

 public function testCreateFromName()
 {
     $property = ReflectionProperty::createFromName(\ReflectionFunctionAbstract::class, 'name');
     $this->assertInstanceOf(ReflectionProperty::class, $property);
     $this->assertSame('name', $property->getName());
 }