public function getParameterByName($name) {
    $name = ltrim($name, '$');
    /** @var ParameterNode $parameter */
    foreach ($this->getParameters()->reverse() as $parameter) {
      if ($parameter->getName() === $name) {
        return $parameter;
      }
    }
    throw new \UnexpectedValueException("Parameter {$name} does not exist.");
  }