Skip to content

Commit 554bdc9

Browse files
authored
Merge pull request #1147 from phpDocumentor/backport/1.x/pr-1146
[1.x] Merge pull request #1146 from phpDocumentor/feature/post-parse-mutable
2 parents 8409e2e + eec78f6 commit 554bdc9

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

packages/guides/src/Event/PostParseDocument.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,30 @@
2222
*/
2323
final class PostParseDocument
2424
{
25-
public function __construct(private readonly string $fileName, private readonly DocumentNode|null $documentNode)
26-
{
25+
public function __construct(
26+
private readonly string $fileName,
27+
private DocumentNode|null $documentNode,
28+
private readonly string $originalFile,
29+
) {
2730
}
2831

2932
public function getDocumentNode(): DocumentNode|null
3033
{
3134
return $this->documentNode;
3235
}
3336

37+
public function setDocumentNode(DocumentNode|null $documentNode): void
38+
{
39+
$this->documentNode = $documentNode;
40+
}
41+
3442
public function getFileName(): string
3543
{
3644
return $this->fileName;
3745
}
46+
47+
public function getOriginalFileName(): string
48+
{
49+
return $this->originalFile;
50+
}
3851
}

packages/guides/src/Handlers/ParseFileHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private function createDocument(
103103
);
104104
}
105105

106-
$event = $this->eventDispatcher->dispatch(new PostParseDocument($fileName, $document));
106+
$event = $this->eventDispatcher->dispatch(new PostParseDocument($fileName, $document, $path));
107107
assert($event instanceof PostParseDocument);
108108

109109
return $event->getDocumentNode();

0 commit comments

Comments
 (0)