Skip to content
Merged
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
27 changes: 10 additions & 17 deletions src/Report/Xml/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,18 @@
*/
final class Project extends Node
{
/**
* @phpstan-ignore constructor.missingParentCall
*/
public function __construct(string $directory)
{
$this->init();
$dom = new DOMDocument;
$dom->loadXML('<?xml version="1.0" ?><phpunit xmlns="https://schema.phpunit.de/coverage/1.0"><build/><project/></phpunit>');

parent::__construct(
$dom->getElementsByTagNameNS(
Facade::XML_NAMESPACE,
'project',
)->item(0),
);

$this->setProjectSourceDirectory($directory);
}

Expand Down Expand Up @@ -79,19 +85,6 @@ public function asDom(): DOMDocument
return $this->dom();
}

private function init(): void
{
$dom = new DOMDocument;
$dom->loadXML('<?xml version="1.0" ?><phpunit xmlns="https://schema.phpunit.de/coverage/1.0"><build/><project/></phpunit>');

$this->setContextNode(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this call was equivalent to the baseclass __construct() implementation.. but we shouldn't rely on implementation knowledge across classes, when not necessary

$dom->getElementsByTagNameNS(
Facade::XML_NAMESPACE,
'project',
)->item(0),
);
}

private function setProjectSourceDirectory(string $name): void
{
$this->contextNode()->setAttribute('source', $name);
Expand Down