/** * @return Func[] * One or more (alternate) methods begotten from * reflection info and internal method data */ public static function functionListFromSignature(CodeBase $code_base, FullyQualifiedFunctionName $fqsen, array $signature) : array { $context = new Context(); $return_type = UnionType::fromStringInContext(array_shift($signature), $context); $func = new Func($context, $fqsen->getName(), $return_type, 0, $fqsen); return self::functionListFromFunction($func, $code_base); }
/** * A list of types for parameters associated with the * given builtin function with the given name * * @param FullyQualifiedMethodName|FullyQualifiedFunctionName $function_fqsen * * @see internal_varargs_check * Formerly `function internal_varargs_check` */ public static function internalFunctionSignatureMapForFQSEN($function_fqsen) : array { $context = new Context(); $map = self::internalFunctionSignatureMap(); if ($function_fqsen instanceof FullyQualifiedMethodName) { $class_fqsen = $function_fqsen->getFullyQualifiedClassName(); $class_name = $class_fqsen->getName(); $function_name = $class_name . '::' . $function_fqsen->getName(); } else { $function_name = $function_fqsen->getName(); } $function_name_original = $function_name; $alternate_id = 0; $configurations = []; while (isset($map[$function_name])) { // Get some static data about the function $type_name_struct = $map[$function_name]; if (empty($type_name_struct)) { continue; } // Figure out the return type $return_type_name = array_shift($type_name_struct); $return_type = $return_type_name ? UnionType::fromStringInContext($return_type_name, $context) : null; $name_type_name_map = $type_name_struct; $property_name_type_map = []; foreach ($name_type_name_map as $name => $type_name) { $property_name_type_map[$name] = empty($type_name) ? new UnionType() : UnionType::fromStringInContext($type_name, $context); } $configurations[] = ['return_type' => $return_type, 'property_name_type_map' => $property_name_type_map]; $function_name = $function_name_original . '\'' . ++$alternate_id; } return $configurations; }
/** * @return Method[] * One or more (alternate) methods begotten from * reflection info and internal method data */ public static function methodListFromSignature(CodeBase $code_base, FullyQualifiedFunctionName $fqsen, array $signature) : array { $context = new Context(); $return_type = UnionType::fromStringInContext(array_shift($signature), $context); $method = new Method($context, $fqsen->getName(), $return_type, 0); $method->setFQSEN($fqsen); return self::methodListFromMethod($method, $code_base); }