Skip to content

Commit a258a5d

Browse files
committed
Refactor Host class to utilize typed properties and return types
1 parent c748567 commit a258a5d

File tree

1 file changed

+5
-22
lines changed

1 file changed

+5
-22
lines changed

src/Host/Host.php

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@
2121

2222
class Host
2323
{
24-
/**
25-
* @var Configuration $config
26-
*/
27-
private $config;
24+
private Configuration $config;
2825

2926
public function __construct(string $hostname)
3027
{
@@ -44,10 +41,7 @@ public function config(): Configuration
4441
return $this->config;
4542
}
4643

47-
/**
48-
* @param mixed $value
49-
*/
50-
public function set(string $name, $value): self
44+
public function set(string $name, mixed $value): self
5145
{
5246
if ($name === 'alias') {
5347
throw new ConfigurationException("Can not update alias of the host.\nThis will change only host own alias,\nbut not the key it is stored in HostCollection.");
@@ -75,11 +69,7 @@ public function hasOwn(string $name): bool
7569
return $this->config->hasOwn($name);
7670
}
7771

78-
/**
79-
* @param mixed|null $default
80-
* @return mixed|null
81-
*/
82-
public function get(string $name, $default = null)
72+
public function get(string $name, mixed $default = null): mixed
8373
{
8474
return $this->config->get($name, $default);
8575
}
@@ -122,20 +112,13 @@ public function getRemoteUser(): ?string
122112
return $this->config->get('remote_user', null);
123113
}
124114

125-
/**
126-
* @param string|int|null $port
127-
* @return $this
128-
*/
129-
public function setPort($port): self
115+
public function setPort(int|string|null $port): self
130116
{
131117
$this->config->set('port', $port);
132118
return $this;
133119
}
134120

135-
/**
136-
* @return string|int|null
137-
*/
138-
public function getPort()
121+
public function getPort(): int|string|null
139122
{
140123
return $this->config->get('port', null);
141124
}

0 commit comments

Comments
 (0)