Phan\Language\Element\FunctionInterface::getParameterList PHP Method

getParameterList() public method

public getParameterList ( ) : Parameter[]
return Parameter[] A list of parameters on the method
    public function getParameterList();

Usage Example

示例#1
0
 /**
  * Check method parameters to make sure they're valid
  *
  * @return null
  */
 public static function analyzeParameterTypes(CodeBase $code_base, FunctionInterface $method)
 {
     // Look at each parameter to make sure their types
     // are valid
     foreach ($method->getParameterList() as $parameter) {
         $union_type = $parameter->getUnionType();
         // Look at each type in the parameter's Union Type
         foreach ($union_type->getTypeSet() as $type) {
             // If its a native type or a reference to
             // self, its OK
             if ($type->isNativeType() || $type->isSelfType()) {
                 continue;
             }
             if ($type instanceof TemplateType) {
                 if ($method instanceof Method) {
                     if ($method->isStatic()) {
                         Issue::maybeEmit($code_base, $method->getContext(), Issue::TemplateTypeStaticMethod, $method->getFileRef()->getLineNumberStart(), (string) $method->getFQSEN());
                     }
                 }
             } else {
                 // Make sure the class exists
                 $type_fqsen = $type->asFQSEN();
                 if (!$code_base->hasClassWithFQSEN($type_fqsen)) {
                     Issue::maybeEmit($code_base, $method->getContext(), Issue::UndeclaredTypeParameter, $method->getFileRef()->getLineNumberStart(), (string) $type_fqsen);
                 }
             }
         }
     }
     if ($method instanceof Method) {
         self::analyzeOverrideSignature($code_base, $method);
     }
 }
All Usage Examples Of Phan\Language\Element\FunctionInterface::getParameterList