Skip to content

Commit daee9c1

Browse files
committed
Use promoted properties
I removed the addLine() method as it was redundant. The type safety is covered by static analysis.
1 parent cb3ffb3 commit daee9c1

File tree

2 files changed

+8
-34
lines changed

2 files changed

+8
-34
lines changed

src/HtaccessClient.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@
77

88
final class HtaccessClient
99
{
10-
private ClientInterface $httpClient;
11-
private ServerRequestFactoryInterface $requestFactory;
12-
13-
public function __construct(ClientInterface $httpClient, ServerRequestFactoryInterface $requestFactory)
14-
{
15-
$this->httpClient = $httpClient;
16-
$this->requestFactory = $requestFactory;
10+
public function __construct(
11+
private ClientInterface $httpClient,
12+
private ServerRequestFactoryInterface $requestFactory
13+
) {
1714
}
1815

1916
/**

src/HtaccessResult.php

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,13 @@
55
final class HtaccessResult
66
{
77
/**
8-
* @var string
8+
* @param ResultLine[] $lines
99
*/
10-
private $outputUrl;
11-
12-
/**
13-
* @var ResultLine[]
14-
*/
15-
private $lines = [];
16-
17-
/**
18-
* @var int?
19-
*/
20-
private $outputStatusCode;
21-
2210
public function __construct(
23-
string $outputUrl,
24-
array $lines,
25-
?int $outputStatusCode
11+
private string $outputUrl,
12+
private array $lines,
13+
private ?int $outputStatusCode
2614
) {
27-
$this->outputUrl = $outputUrl;
28-
$this->outputStatusCode = $outputStatusCode;
29-
30-
foreach ($lines as $line) {
31-
$this->addLine($line);
32-
}
3315
}
3416

3517
public function getOutputUrl(): string
@@ -49,9 +31,4 @@ public function getOutputStatusCode(): ?int
4931
{
5032
return $this->outputStatusCode;
5133
}
52-
53-
private function addLine(ResultLine $line): void
54-
{
55-
$this->lines[] = $line;
56-
}
5734
}

0 commit comments

Comments
 (0)