Skip to content

[1.x] Merge pull request #1146 from phpDocumentor/feature/post-parse-mutable #1147

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions packages/guides/src/Event/PostParseDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,30 @@
*/
final class PostParseDocument
{
public function __construct(private readonly string $fileName, private readonly DocumentNode|null $documentNode)
{
public function __construct(
private readonly string $fileName,
private DocumentNode|null $documentNode,
private readonly string $originalFile,
) {
}

public function getDocumentNode(): DocumentNode|null
{
return $this->documentNode;
}

public function setDocumentNode(DocumentNode|null $documentNode): void
{
$this->documentNode = $documentNode;
}

public function getFileName(): string
{
return $this->fileName;
}

public function getOriginalFileName(): string
{
return $this->originalFile;
}
}
2 changes: 1 addition & 1 deletion packages/guides/src/Handlers/ParseFileHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private function createDocument(
);
}

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

return $event->getDocumentNode();
Expand Down
Loading