PhpParser\Node\FunctionLike::getParams PHP Метод

getParams() публичный Метод

List of parameters
public getParams ( ) : Param[]
Результат Param[]
    public function getParams();

Usage Example

Пример #1
0
 /**
  * @param \PhpParser\Node\FunctionLike $function
  * @param \PHPStan\Analyser\Scope $scope
  * @param string $parameterMessage
  * @param string $returnMessage
  * @return string[]
  */
 public function checkFunction(FunctionLike $function, Scope $scope, string $parameterMessage, string $returnMessage) : array
 {
     if ($function instanceof ClassMethod && $scope->getClass() !== null) {
         return $this->checkParametersAcceptor($this->broker->getClass($scope->getClass())->getMethod($function->name), $parameterMessage, $returnMessage);
     }
     if ($function instanceof Function_) {
         $functionName = $function->name;
         if (isset($function->namespacedName)) {
             $functionName = $function->namespacedName;
         }
         return $this->checkParametersAcceptor($this->broker->getFunction(new Name($functionName)), $parameterMessage, $returnMessage);
     }
     $errors = [];
     foreach ($function->getParams() as $param) {
         $class = (string) $param->type;
         if ($class && !in_array($class, self::VALID_TYPEHINTS, true) && !$this->broker->hasClass($class)) {
             $errors[] = sprintf($parameterMessage, $param->name, $class);
         }
     }
     $returnType = (string) $function->getReturnType();
     if ($returnType && !in_array($returnType, self::VALID_TYPEHINTS, true) && !$this->broker->hasClass($returnType)) {
         $errors[] = sprintf($returnMessage, $returnType);
     }
     return $errors;
 }
All Usage Examples Of PhpParser\Node\FunctionLike::getParams