mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-30 19:50:12 +02:00
PHP8
This commit is contained in:
@@ -4,17 +4,12 @@ namespace DesignPatterns\Structural\DependencyInjection;
|
||||
|
||||
class DatabaseConfiguration
|
||||
{
|
||||
private string $host;
|
||||
private int $port;
|
||||
private string $username;
|
||||
private string $password;
|
||||
|
||||
public function __construct(string $host, int $port, string $username, string $password)
|
||||
{
|
||||
$this->host = $host;
|
||||
$this->port = $port;
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
public function __construct(
|
||||
private string $host,
|
||||
private int $port,
|
||||
private string $username,
|
||||
private string $password
|
||||
) {
|
||||
}
|
||||
|
||||
public function getHost(): string
|
||||
|
@@ -4,11 +4,8 @@ namespace DesignPatterns\Structural\DependencyInjection;
|
||||
|
||||
class DatabaseConnection
|
||||
{
|
||||
private DatabaseConfiguration $configuration;
|
||||
|
||||
public function __construct(DatabaseConfiguration $config)
|
||||
public function __construct(private DatabaseConfiguration $configuration)
|
||||
{
|
||||
$this->configuration = $config;
|
||||
}
|
||||
|
||||
public function getDsn(): string
|
||||
|
Reference in New Issue
Block a user