@param  string $method_id
@param  array<int, PhpParser\Node\Arg> $args

@return array<int, FunctionLikeParameter>
195354
public function getMethodParams(
        $method_id,
        StatementsSource $source = null,
        array $args = null,
        Context $context = null
    ) : array {
        list($fq_class_name, $method_name) = explode('::', $method_id);

        if ($this->params_provider->has($fq_class_name)) {
            $method_params = $this->params_provider->getMethodParams(
                $fq_class_name,
                $method_name,
                $args,
                $source,
                $context
            );

            if ($method_params !== null) {
                return $method_params;
            }
        }

        $declaring_method_id = $this->getDeclaringMethodId($method_id);

        // functions
        if (CallMap::inCallMap($declaring_method_id ?: $method_id)) {
            $declaring_fq_class_name = explode('::', $declaring_method_id ?: $method_id)[0];

            $class_storage = $this->classlike_storage_provider->get($declaring_fq_class_name);

            if (!$class_storage->stubbed) {
                $function_param_options = CallMap::getParamsFromCallMap($declaring_method_id ?: $method_id);

                if ($function_param_options === null) {
                    throw new \UnexpectedValueException(
                        'Not expecting $function_param_options to be null for ' . $declaring_method_id
                    );
                }

                if (!$source || $args === null || count($function_param_options) === 1) {
                    return $function_param_options[0];
                }

                if ($context && $source instanceof \Psalm\Internal\Analyzer\StatementsAnalyzer) {
                    foreach ($args as $arg) {
                        \Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::analyze(
                            $source,
                            $arg->value,
                            $context
                        );
                    }
                }

                return FunctionLikeAnalyzer::getMatchingParamsFromCallMapOptions(
                    $source->getCodebase(),
                    $function_param_options,
                    $args
                );
            }
        }

        if ($declaring_method_id) {
            $storage = $this->getStorage($declaring_method_id);

            $params = $storage->params;

            if ($storage->has_docblock_param_types) {
                return $params;
            }

            $appearing_method_id = $this->getAppearingMethodId($declaring_method_id);

            if (!$appearing_method_id) {
                return $params;
            }

            list($appearing_fq_class_name, $appearing_method_name) = explode('::', $appearing_method_id);

            $class_storage = $this->classlike_storage_provider->get($appearing_fq_class_name);

            if (!isset($class_storage->overridden_method_ids[$appearing_method_name])) {
                return $params;
            }

            if (!isset($class_storage->documenting_method_ids[$appearing_method_name])) {
                return $params;
            }

            $overridden_method_id = $class_storage->documenting_method_ids[$appearing_method_name];
            $overridden_storage = $this->getStorage($overridden_method_id);

            list($overriding_fq_class_name) = explode('::', $overridden_method_id);

            foreach ($params as $i => $param) {
                if (isset($overridden_storage->params[$i]->type)
                    && $overridden_storage->params[$i]->has_docblock_type
                    && $overridden_storage->params[$i]->name === $param->name
                ) {
                    $params[$i] = clone $param;
                    /** @var Type\Union $params[$i]->type */
                    $params[$i]->type = clone $overridden_storage->params[$i]->type;

                    if ($source) {
                        $params[$i]->type = self::localizeParamType(
                            $source->getCodebase(),
                            $params[$i]->type,
                            $appearing_fq_class_name,
                            $overriding_fq_class_name
                        );
                    }

                    if ($params[$i]->signature_type
                        && $params[$i]->signature_type->isNullable()
                    ) {
                        $params[$i]->type->addType(new Type\Atomic\TNull);
                    }

                    $params[$i]->type_location = $overridden_storage->params[$i]->type_location;
                }
            }

            return $params;
        }

        throw new \UnexpectedValueException('Cannot get method params for ' . $method_id);
    }
1153906
public static function afterMethodCallAnalysis(
        Expr $expr,
        string $method_id,
        string $appearing_method_id,
        string $declaring_method_id,
        Context $context,
        StatementsSource $statements_source,
        Codebase $codebase,
        array &$file_replacements = [],
        Union &$return_type_candidate = null
    ) {
        if (!$expr->name instanceof PhpParser\Node\Identifier) {
            return;
        }

        try {
            $function_storage = $codebase->methods->getStorage($declaring_method_id);

            if ($function_storage->cased_name === '__call') {
                return;
            }

            if ($function_storage->cased_name !== (string)$expr->name) {
                if (\Psalm\IssueBuffer::accepts(
                    new IncorrectFunctionCasing(
                        'Function is incorrectly cased, expecting ' . $function_storage->cased_name,
                        new CodeLocation($statements_source, $expr->name)
                    ),
                    $statements_source->getSuppressedIssues()
                )) {
                    // fall through
                }
            }
        } catch (\Exception $e) {
            // can throw if storage is missing
        }
    }
202733
public Statement invokeVoid(MethodRef method, Expression... args) {
    return method.invokeVoid(ImmutableList.<Expression>builder().add(this).add(args).build());
  }
655696
protected JSONArray callMethod(String method, Object ... args) throws Exception {
        return new QueryBuilder().retrieveResult(storedId).call(method, args).storeResult("LAST_" + getStoredId()).execute();
    }
890657
public function getMethodMutations($method_id, Context $this_context, bool $from_project_analyzer = false)
    {
        list($fq_class_name, $method_name) = explode('::', $method_id);

        if (isset($this->class_analyzers_to_analyze[strtolower($fq_class_name)])) {
            $class_analyzer_to_examine = $this->class_analyzers_to_analyze[strtolower($fq_class_name)];
        } else {
            if (!$from_project_analyzer) {
                $this->project_analyzer->getMethodMutations(
                    $method_id,
                    $this_context,
                    $this->getRootFilePath(),
                    $this->getRootFileName()
                );
            }

            return;
        }

        $call_context = new Context($this_context->self);
        $call_context->collect_mutations = $this_context->collect_mutations;
        $call_context->collect_initializations = $this_context->collect_initializations;
        $call_context->initialized_methods = $this_context->initialized_methods;
        $call_context->include_location = $this_context->include_location;

        foreach ($this_context->vars_possibly_in_scope as $var => $_) {
            if (strpos($var, '$this->') === 0) {
                $call_context->vars_possibly_in_scope[$var] = true;
            }
        }

        foreach ($this_context->vars_in_scope as $var => $type) {
            if (strpos($var, '$this->') === 0) {
                $call_context->vars_in_scope[$var] = $type;
            }
        }

        $call_context->vars_in_scope['$this'] = $this_context->vars_in_scope['$this'];

        $class_analyzer_to_examine->getMethodMutations($method_name, $call_context);

        foreach ($call_context->vars_possibly_in_scope as $var => $_) {
            $this_context->vars_possibly_in_scope[$var] = true;
        }

        foreach ($call_context->vars_in_scope as $var => $type) {
            $this_context->vars_in_scope[$var] = $type;
        }
    }
821923
private function magicWhere($method, $args)
    {
        $whereStatement = explode('_', $method);

        // Get where
        if (count($whereStatement) == 2) {
            return $this->getWhere($args[0], '=', $args[1]);
        }

        $operators = [
            'in', 'between', 'like', 'null',
            'not',
            'first', 'last',
            'many',
        ];

        // If an operator is found then add operators.
        if (array_intersect($whereStatement, $operators)) {
            list($operator, $firstOrLast, $inverse) = $this->determineMagicWhereDetails($whereStatement);

            $column = $args[0];
            $value  = (isset($args[1]) ? $args[1] : null);

            return $this->getWhere(
                $column,
                $operator,
                $value,
                $inverse,
                $firstOrLast
            );
        }
    }
1128347
protected function decorateWhere($method, &$args)
    {
        $column = $args[0];
        $expression = isset($args[1]) ? $args[1] : null;
        $value = isset($args[2]) ? $args[2] : null;

        if (!$expression instanceof Entity && !$value instanceof Entity) {
            return;
        }

        $entity_class = $this->entity_class;
        $relation = $entity_class::getRelationDefinition($column);
        $column = $relation[3];
        $relation_column = $relation[2];
        if ($expression instanceof Entity) {
            $expression = $expression->getRaw($relation_column);
        } else {
            $value = $value->getRaw($relation_column);
        }

        $args = [$column, $expression, $value];
    }
274113
public static Object[] findMethodWithExactParameters(Object service, String methodName, List<?> args) {
        Object[] arguments = new Object[args.size()];
        for (int i = 0; i < args.size(); i++) {
            arguments[i] = args.get(i);
        }
        return findMethodWithExactParameters(service, methodName, arguments);
    }
103994
private function parseAround($method, &$args, &$returnValue, $callback)
    {
        $aroundAspectDoList = [];
        $this->doAspect($method, 'around', function($aspectClassName, $methodName) use(&$aroundAspectDoList){
            $aroundAspectDoList[] = [new $aspectClassName, $methodName];
        });
        if(!isset($aroundAspectDoList[0]))
        {
            return false;
        }
        $aroundAspectDoList = array_reverse($aroundAspectDoList);

        $nextJoinPoint = null;
        $nextAroundAspectDo = null;

        foreach($aroundAspectDoList as $aroundAspectDo)
        {
            $joinPoint = new AroundJoinPoint('around', $method, $args, $this->object, $this, (null === $nextJoinPoint ? function($inArgs = null) use($method, &$args, $callback){
                if(null !== $inArgs)
                {
                    $args = $inArgs;
                }
                return $this->callOrigin($method, $args, $callback);
            } : function($inArgs = null) use($nextAroundAspectDo, $nextJoinPoint, &$args){
                if(null !== $inArgs)
                {
                    $args = $inArgs;
                }
                return call_user_func($nextAroundAspectDo, $nextJoinPoint);
            }));
            $nextJoinPoint = $joinPoint;
            $nextAroundAspectDo = $aroundAspectDo;
        }
        $returnValue = call_user_func($nextAroundAspectDo, $nextJoinPoint);
        return true;
    }
89270
public function getClassLikeStorageForMethod($method_id)
    {
        list($fq_class_name, $method_name) = explode('::', $method_id);

        if ($this->existence_provider->has($fq_class_name)) {
            if ($this->existence_provider->doesMethodExist(
                $fq_class_name,
                $method_name,
                null,
                null
            )) {
                return $this->classlike_storage_provider->get($fq_class_name);
            }
        }

        $declaring_method_id = $this->getDeclaringMethodId($method_id);

        if (!$declaring_method_id) {
            if (CallMap::inCallMap($method_id)) {
                $declaring_method_id = $method_id;
            } else {
                throw new \UnexpectedValueException('$storage should not be null for ' . $method_id);
            }
        }

        list($declaring_fq_class_name) = explode('::', $declaring_method_id);

        return $this->classlike_storage_provider->get($declaring_fq_class_name);
    }
1295885
public function methodExists(
        string $method_id,
        CodeLocation $code_location = null,
        $calling_method_id = null,
        string $file_path = null
    ) {
        return $this->methods->methodExists(
            $method_id,
            $calling_method_id,
            $code_location,
            null,
            $file_path
        );
    }
841820
function filter_call ($instance, $method, ...$args)
  {
    if (is_object ($instance)) {
      if (is_object ($instance) && method_exists ($instance, $method)) return $instance->$method (...$args);
      if (isset($instance[$method]) && is_callable ($instance[$method])) {
        $m = $instance[$method];
        return $m(...$args);
      }
    }
    return null;
  }
939686
protected function map_filter( $id, $method, $arg_count ) {
		if ( empty( $this->filter_map[ $id ] ) ) {
			$this->filter_map[ $id ] = function () use ( $method, $arg_count ) {
				return call_user_func_array( [ $this, $method ], array_slice( func_get_args(), 0, $arg_count ) );
			};
		}

		return $this->filter_map[ $id ];
	}
724467
public static function getReturnTypeFromCallMap($function_id)
    {
        $call_map_key = strtolower($function_id);

        $call_map = self::getCallMap();

        if (!isset($call_map[$call_map_key])) {
            throw new \InvalidArgumentException('Function ' . $function_id . ' was not found in callmap');
        }

        if (!$call_map[$call_map_key][0]) {
            return Type::getMixed();
        }

        $call_map_type = Type::parseString($call_map[$call_map_key][0]);

        if ($call_map_type->isNullable()) {
            $call_map_type->from_docblock = true;
        }

        return $call_map_type;
    }
982636
public static function checkMethodExists(
        Codebase $codebase,
        $method_id,
        CodeLocation $code_location,
        array $suppressed_issues,
        $calling_method_id = null
    ) {
        if ($codebase->methods->methodExists(
            $method_id,
            $calling_method_id,
            $calling_method_id !== $method_id ? $code_location : null,
            null,
            $code_location->file_path
        )) {
            return true;
        }

        if (IssueBuffer::accepts(
            new UndefinedMethod('Method ' . $method_id . ' does not exist', $code_location, $method_id),
            $suppressed_issues
        )) {
            return false;
        }

        return null;
    }
1082288
public function callWith($method, $args, $object, $returnRelation = false)
    {
        if (is_string($object)) {
            $object = Reflect::create($object);
        }

        /**
         * Check if $method prefix is listed in autocallPrefixes.
         */
        foreach ($this->autocallPrefixes as $prefix) {
            if (substr($method, 0, strlen($prefix)) === $prefix
                && strtoupper(substr($method, strlen($prefix), 1)) == substr($method, strlen($prefix), 1)
            ) {
                /**
                 * We are calling relation function without arguments: $entity->something();.
                 */
                $relationMethod = lcfirst(substr($method, strlen($prefix)));
                $relation = Reflect::method($object, $relationMethod, $args);
                // $relation = $object->{$relationMethod}();

                if (isset($args[0]) && ($args[0] instanceof Closure || is_only_callable($args[0]))) {
                    /**
                     * If callback was added, we run it.
                     * Now, this is a problem if we're making join because query was already merged.
                     * So, we'll call this magically and provide both - relation and query.
                     *
                     * @T00D00
                     */
                    if (in_array($prefix, ['join', 'leftJoin', 'innerJoin'])) {
                        $rightEntity = $relation->getRightEntity();
                        $oldEntityQuery = $rightEntity->getQuery();
                        $rightEntity->setQuery($relation->getQuery());
                        Reflect::call($args[0], [$relation, $relation->getQuery()]);
                        $rightEntity->setQuery($oldEntityQuery);
                    } else {
                        Reflect::call($args[0], [$relation, $relation->getQuery()]);
                    }
                }

                if ($prefix == 'leftJoin') {
                    $relation->leftJoin();
                }
                /**
                 * We'll call $entity->with($relation), $entity->join($relation) or $entity->required($relation), and return Relation;
                 */
                $return = $object->{$prefix == 'leftJoin' ? 'join' : $prefix}($relation);

                /**
                 * Then we return relation.
                 */
                return $returnRelation
                    ? $relation
                    : $return;
            }
        }

        if (!method_exists($object, $method)) {
            throw new Exception('Method ' . $method . ' does not exist in ' . get_class($object));
        }

        /**
         * Autoprefixes failed, return relation, probably?
         */
        $relation = Reflect::method($object, $method, $args);

        if (isset($args[0]) && ($args[0] instanceof Closure || is_only_callable($args[0]))) {
            Reflect::call($args[0], [$relation, $relation->getQuery()]);
        }

        return $relation;
    }
701726
public function buildRequest($resource, $args = [], $method = 'get')
    {
        $query = [];

        if (isset($args[0]) && count($args[0]) == 1 && is_int($args[0])) {
            $resource = $resource.'/'.$args[0];
        }

        if (!empty($this->query)) {
            $query = $this->query;
        }

        return $this->sendRequest($resource, $query, $method);
    }