1
0
Fork 0
mirror of synced 2024-10-01 01:37:56 +13:00

Cast port to integer

This commit is contained in:
Eldad Fux 2022-10-15 15:32:59 +03:00
parent daecc1aa76
commit daa0ab51a6

View file

@ -25,9 +25,9 @@ class DSN
protected string $host;
/**
* @var ?string
* @var ?int
*/
protected ?string $port;
protected ?int $port;
/**
* @var ?string
@ -58,7 +58,7 @@ class DSN
$this->user = $parts['user'] ?? null;
$this->password = $parts['pass'] ?? null;
$this->host = $parts['host'] ?? null;
$this->port = $parts['port'] ?? null;
$this->port = (int)$parts['port'] ?? null;
$this->database = $parts['path'] ?? null;
$this->query = $parts['query'] ?? null;
}
@ -106,9 +106,9 @@ class DSN
/**
* Return the port
*
* @return ?string
* @return ?int
*/
public function getPort(): ?string
public function getPort(): ?int
{
return $this->port;
}