public function named(string $name) : Parameter { if ($this->contains($name)) { return $this->parameters[$name]; } throw MissingParameter::named($name, $this->method); }
function it_provides_a_parameter_by_name(Parameter $parameter) { $this->named('foo')->shouldBe($parameter); $this->shouldThrow(MissingParameter::named('bar', 'MyClass::myMethod'))->during('named', ['bar']); }