Skip to content
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
14 changes: 3 additions & 11 deletions src/Document/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,14 @@
*/
final class Type
{
/** @var non-empty-string */
private string $name;
private string $publicId;
private string $systemId;

/**
* @param non-empty-string $name
*/
private function __construct(
string $name,
string $publicId,
string $systemId,
private string $name,
private string $publicId,
private string $systemId,
) {
$this->name = $name;
$this->publicId = $publicId;
$this->systemId = $systemId;
}

/**
Expand Down
25 changes: 10 additions & 15 deletions src/Document/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,21 @@
*/
final class Version
{
/** @var 0|positive-int */
private int $major;
/** @var 0|positive-int */
private int $minor;

/**
* @param 0|positive-int $major
* @param 0|positive-int $minor
* @param int<0, max> $major
* @param int<0, max> $minor
*/
private function __construct(int $major, int $minor)
{
$this->major = $major;
$this->minor = $minor;
private function __construct(
private int $major,
private int $minor,
) {
}

/**
* @psalm-pure
*
* @param 0|positive-int $major
* @param 0|positive-int $minor
* @param int<0, max> $major
* @param int<0, max> $minor
*
* @throws DomainException
*/
Expand Down Expand Up @@ -58,15 +53,15 @@ public static function maybe(int $major, int $minor = 0): Maybe
}

/**
* @return 0|positive-int
* @return int<0, max>
*/
public function major(): int
{
return $this->major;
}

/**
* @return 0|positive-int
* @return int<0, max>
*/
public function minor(): int
{
Expand Down
5 changes: 1 addition & 4 deletions src/Node/CharacterData.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@
*/
final class CharacterData implements Implementation
{
private string $value;

private function __construct(string $value)
private function __construct(private string $value)
{
$this->value = $value;
}

/**
Expand Down
5 changes: 1 addition & 4 deletions src/Node/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@
*/
final class Comment implements Implementation
{
private string $value;

private function __construct(string $value)
private function __construct(private string $value)
{
$this->value = $value;
}

/**
Expand Down
5 changes: 1 addition & 4 deletions src/Node/EntityReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@
*/
final class EntityReference implements Implementation
{
private string $data;

private function __construct(string $data)
private function __construct(private string $data)
{
$this->data = $data;
}

/**
Expand Down
11 changes: 4 additions & 7 deletions src/Node/ProcessingInstruction.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@
*/
final class ProcessingInstruction implements Implementation
{
private string $kind;
private string $value;

private function __construct(string $kind, string $value)
{
$this->kind = $kind;
$this->value = $value;
private function __construct(
private string $kind,
private string $value,
) {
}

/**
Expand Down
9 changes: 3 additions & 6 deletions src/Node/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@
*/
final class Text implements Implementation
{
private CharacterData $data;

private function __construct(string $data)
private function __construct(private string $data)
{
$this->data = CharacterData::of($data);
}

/**
Expand All @@ -27,14 +24,14 @@ public static function of(string $data): self
#[\Override]
public function content(): string
{
return $this->data->content();
return $this->data;
}

#[\Override]
public function render(\XMLWriter $writer): string
{
/** @psalm-suppress ImpureMethodCall */
$writer->text($this->data->content());
$writer->text($this->data);

/** @psalm-suppress ImpureMethodCall */
return $writer->outputMemory();
Expand Down