Skip to content

Commit e4dea49

Browse files
Matthew-Htheseer
authored andcommitted
Fix implicit null deprecation warnings for PHP 8.4
1 parent 30732da commit e4dea49

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/Html.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function extractAsSnippets(Selector $selector, string $targetId): Snippet
107107
return $list;
108108
}
109109

110-
public function asString(Filter $filter = null): string {
110+
public function asString(?Filter $filter = null): string {
111111
$content = $this->serializeDomDocument();
112112
$content = (new EmptyElementsFilter())->apply($content);
113113
$content = (new ClearRedundantHtmlNamespaceDefinitionsFilter($this->dom->documentElement->nodeName))->apply($content);

src/TempladoException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class TempladoException extends Exception {
66
/** @var \LibXMLError[] */
77
private $errorList;
88

9-
public function __construct(string $message, int $code = 0, Exception $previous = null) {
9+
public function __construct(string $message, int $code = 0, ?Exception $previous = null) {
1010
parent::__construct($message, $code, $previous);
1111
$this->errorList = \libxml_get_errors();
1212
\libxml_clear_errors();

src/snippet/SnippetLoader.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use DOMDocument;
55

66
class SnippetLoader {
7-
public function load(FileName $fileName, string $id = null): Snippet {
7+
public function load(FileName $fileName, ?string $id = null): Snippet {
88
$this->ensureFileExists($fileName);
99
$this->ensureIsReadableFile($fileName);
1010

@@ -26,7 +26,7 @@ public function load(FileName $fileName, string $id = null): Snippet {
2626
);
2727
}
2828

29-
private function loadAsText(FileName $fileName, string $id = null): TextSnippet {
29+
private function loadAsText(FileName $fileName, ?string $id = null): TextSnippet {
3030
return new TextSnippet(
3131
$id ?? $fileName->getName(),
3232
(new DOMDocument())->createTextNode(\file_get_contents($fileName->asString()))
@@ -36,7 +36,7 @@ private function loadAsText(FileName $fileName, string $id = null): TextSnippet
3636
/**
3737
* @throws SnippetLoaderException
3838
*/
39-
private function loadAsSnippet(FileName $fileName, string $id = null): Snippet {
39+
private function loadAsSnippet(FileName $fileName, ?string $id = null): Snippet {
4040
$dom = $this->loadFile($fileName);
4141

4242
if ($this->isTempladoSnippetDocument($dom)) {
@@ -123,11 +123,11 @@ private function ensureIsReadableFile(FileName $fileName): void {
123123
}
124124
}
125125

126-
private function parseAsTempladoSnippet(DOMDocument $dom, string $id = null): TempladoSnippet {
126+
private function parseAsTempladoSnippet(DOMDocument $dom, ?string $id = null): TempladoSnippet {
127127
return new TempladoSnippet($id ?? $dom->documentElement->getAttribute('id'), $dom);
128128
}
129129

130-
private function parseAsHTML(DOMDocument $dom, string $id = null): SimpleSnippet {
130+
private function parseAsHTML(DOMDocument $dom, ?string $id = null): SimpleSnippet {
131131
$id = $id ?? $dom->documentElement->getAttribute('id');
132132

133133
if ($id === '') {

0 commit comments

Comments
 (0)