Nelmio\Alice\Throwable\Exception\ParameterNotFoundExceptionFactory::createForWhenResolvingParameter PHP Method

createForWhenResolvingParameter() public static method

public static createForWhenResolvingParameter ( string $key, Parameter $parameter ) : ParameterNotFoundException
$key string
$parameter Nelmio\Alice\Parameter
return ParameterNotFoundException
    public static function createForWhenResolvingParameter(string $key, Parameter $parameter) : ParameterNotFoundException
    {
        return new ParameterNotFoundException(sprintf('Could not find the parameter "%s" when resolving "%s".', $key, $parameter->getKey()));
    }

Usage Example

 public function testTestCreateForWhenResolvingParameter()
 {
     $exception = ParameterNotFoundExceptionFactory::createForWhenResolvingParameter('foo', new Parameter('bar', 'baz'));
     $this->assertEquals('Could not find the parameter "foo" when resolving "bar".', $exception->getMessage());
     $this->assertEquals(0, $exception->getCode());
     $this->assertNull($exception->getPrevious());
 }
All Usage Examples Of Nelmio\Alice\Throwable\Exception\ParameterNotFoundExceptionFactory::createForWhenResolvingParameter
ParameterNotFoundExceptionFactory