public static function callMethod($objectOrClass, string $methodName, ...$args)
    {
        $objectOrClass = self::getObject($objectOrClass);
        $closure =
            /**
             * @param string $methodName
             * @param array $args
             * @return mixed
             */
            function (string $methodName, ...$args) {
                if (\method_exists($this, $methodName)) {
                    return $this->$methodName(...$args);
                }
                throw new \RuntimeException(
                    Picklock::errorMessage($this, $methodName, true)
                );
            };
        return
            $closure->call($objectOrClass, $methodName, ...$args);
    }
public static function callMethod($objectOrClass, string $methodName, ...$args)
    {
        $objectOrClass = self::getObject($objectOrClass);
        $closure =
            /**
             * @param string $methodName
             * @param array $args
             * @return mixed
             */
            function (string $methodName, ...$args) {
                if (\method_exists($this, $methodName)) {
                    return $this->$methodName(...$args);
                }
                throw new \RuntimeException(
                    Picklock::errorMessage($this, $methodName, true)
                );
            };
        return
            $closure->call($objectOrClass, $methodName, ...$args);
    }
public static function callMethod ( $ objectOrClass , string $ methodName , ... $ args ) { $ objectOrClass = self :: getObject ( $ objectOrClass ) ; $ closure = /**
             * @param string $methodName
             * @param array $args
             * @return mixed
             */ function ( string $ methodName , ... $ args ) { if ( \ method_exists ( $ this , $ methodName ) ) { return $ this -> $ methodName ( ... $ args ) ; } throw new \ RuntimeException ( Picklock :: errorMessage ( $ this , $ methodName , true ) ) ; } ; return $ closure -> call ( $ objectOrClass , $ methodName , ... $ args ) ; }
Calls a private or protected method of an object.

@psalm-suppress InvalidScope

@param mixed $objectOrClass
@param string $methodName
@param mixed ...$args

@return mixed
Calls a private or protected method of an object .