Nelmio\Alice\Throwable\Exception\Generator\Resolver\RecursionLimitReachedExceptionFactory::create PHP Method

create() public static method

public static create ( integer $limit, string $key ) : RecursionLimitReachedException
$limit integer
$key string
return RecursionLimitReachedException
    public static function create(int $limit, string $key) : RecursionLimitReachedException
    {
        return new RecursionLimitReachedException(sprintf('Recursion limit (%d tries) reached while resolving the parameter "%s"', $limit, $key));
    }

Usage Example

 /**
  * @throws RecursionLimitReachedException
  */
 private function incrementCounter(int $counter, int $limit, string $parameterKey) : int
 {
     if ($counter >= $limit) {
         throw RecursionLimitReachedExceptionFactory::create($limit, $parameterKey);
     }
     return ++$counter;
 }
RecursionLimitReachedExceptionFactory