示例#1
0
 /**
  * @param FunctionInterface $method
  * Any method
  *
  * @param FullyQualifiedMethodName $fqsen
  * The FQSEN for the method
  *
  * @return null
  */
 private function addMethodWithMethodFQSEN(FunctionInterface $method, FullyQualifiedMethodName $fqsen)
 {
     $this->addMethodInScope($method, $fqsen->getFullyQualifiedClassName());
 }
示例#2
0
 /**
  * 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;
 }