filename = $filename; } public function getConnection(?string $name = null): Connection { if ($name !== null) { throw new InvalidArgumentException('Only one connection is supported'); } if (! file_exists($this->filename)) { throw FileNotFound::new($this->filename); } $params = include $this->filename; if ($params instanceof Connection) { return $params; } if ($params instanceof ConnectionLoader) { return $params->getConnection(); } if (is_array($params)) { return DriverManager::getConnection($params); } throw InvalidConfiguration::invalidArrayConfiguration(); } }