public function pathValue($key) { if (!$this->hasValue($key) || !$this->value($key) instanceof Path) { throw new \InvalidArgumentException(sprintf('value for %s is not of type %s', $key, Path::class)); } return $this->value($key); }