Skip to content

Commit f57d614

Browse files
authored
add PHP 8.4 compatibility (#26)
1 parent 54f067b commit f57d614

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
}
1414
],
1515
"require": {
16-
"php": ">=7.0",
16+
"php": ">=7.1",
1717
"ltd-beget/stringstream" : "^1.0 || ^2.0"
1818
},
1919
"require-dev": {

src/LTDBeget/dns/SyntaxErrorException.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class SyntaxErrorException extends \RuntimeException
3737
* @param int $code
3838
* @param Exception|null $previous
3939
*/
40-
public function __construct(StringStream $stream, int $code = 0, Exception $previous = NULL)
40+
public function __construct(StringStream $stream, int $code = 0, ?Exception $previous = NULL)
4141
{
4242
if ($stream->isEnd()) {
4343
$stream->end();
@@ -101,4 +101,4 @@ public function getUnexpectedChar()
101101
{
102102
return $this->unexpected_char;
103103
}
104-
}
104+
}

src/LTDBeget/dns/record/Record.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ class Record
5656
public function __construct
5757
(
5858
StringStream $stream,
59-
string $globalOrigin = NULL,
60-
string $globalTtl = NULL,
59+
?string $globalOrigin = NULL,
60+
?string $globalTtl = NULL,
6161
bool $isFirst = false,
62-
string $previousName = NULL
62+
?string $previousName = NULL
6363
)
6464
{
6565
$this->stream = $stream;
@@ -103,12 +103,12 @@ public function tokenize() : array
103103
}
104104
goto in;
105105
}
106-
106+
107107
$this->defaultExtractor('TTL');
108108
$this->stream->ignoreHorizontalSpace();
109109
in:
110110
$this->extractClass();
111-
111+
112112
$this->stream->ignoreHorizontalSpace();
113113
$this->extractRData();
114114

@@ -119,7 +119,7 @@ public function tokenize() : array
119119
$this->tokens['NAME'] .= '.'.$this->globalOrigin;
120120
}
121121
}
122-
122+
123123
return $this->tokens;
124124
}
125125

@@ -170,11 +170,11 @@ private function extractClass()
170170
$this->stream->next();
171171
if ($this->stream->currentAscii()->is(AsciiChar::N_UPPERCASE)) {
172172
$this->stream->next();
173-
173+
174174
$this->stream->ignoreHorizontalSpace();
175175
$this->defaultExtractor('TYPE');
176176
$this->stream->ignoreHorizontalSpace();
177-
177+
178178
} else {
179179
throw new SyntaxErrorException($this->stream);
180180
}
@@ -228,4 +228,4 @@ private function extractRData()
228228
{
229229
$this->tokens['RDATA'] = (new RData($this->stream, $this->tokens['TYPE']))->tokenize();
230230
}
231-
}
231+
}

0 commit comments

Comments
 (0)