public static function getValue($objectOrClass, string $propertyName)
    {
        $objectOrClass = self::getObject($objectOrClass);
        $closure =
            /**
             * @return mixed
             */
            function () use ($propertyName) {
                if (\property_exists($this, $propertyName)) {
                    $class = new \ReflectionClass(typeOf($this));
                    $property = $class->getProperty($propertyName);
                    $property->setAccessible(true);
                    return $property->getValue($this);
                }
                throw new \RuntimeException(
                    Picklock::errorMessage($this, $propertyName, false)
                );
            };
        return
            $closure->bindTo($objectOrClass, $objectOrClass)();
    }
public static function getValue($objectOrClass, string $propertyName)
    {
        $objectOrClass = self::getObject($objectOrClass);
        $closure =
            /**
             * @return mixed
             */
            function () use ($propertyName) {
                if (\property_exists($this, $propertyName)) {
                    $class = new \ReflectionClass(typeOf($this));
                    $property = $class->getProperty($propertyName);
                    $property->setAccessible(true);
                    return $property->getValue($this);
                }
                throw new \RuntimeException(
                    Picklock::errorMessage($this, $propertyName, false)
                );
            };
        return
            $closure->bindTo($objectOrClass, $objectOrClass)();
    }
public static function getValue ( $ objectOrClass , string $ propertyName ) { $ objectOrClass = self :: getObject ( $ objectOrClass ) ; $ closure = /**
             * @return mixed
             */ function ( ) use ( $ propertyName ) { if ( \ property_exists ( $ this , $ propertyName ) ) { $ class = new \ ReflectionClass ( typeOf ( $ this ) ) ; $ property = $ class -> getProperty ( $ propertyName ) ; $ property -> setAccessible ( true ) ; return $ property -> getValue ( $ this ) ; } throw new \ RuntimeException ( Picklock :: errorMessage ( $ this , $ propertyName , false ) ) ; } ; return $ closure -> bindTo ( $ objectOrClass , $ objectOrClass ) ( ) ; }
Gets a value of a private or protected property of an object.

@psalm-suppress InvalidScope
@psalm-suppress PossiblyInvalidFunctionCall
@psalm-suppress TypeCoercion

@param mixed $objectOrClass
@param string $propertyName

@return mixed
Gets a value of a private or protected property of an object .