Skip to content

Commit

Permalink
refactor: PHPStan max level > Fix 'Property does not accept null'
Browse files Browse the repository at this point in the history
  • Loading branch information
tienvx committed Sep 30, 2024
1 parent 74c3599 commit 81bb236
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/PhpPact/Xml/XmlElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ public function __construct(callable ...$options)

public function setName(string $name): self
{
$this->name = preg_replace('/(^[0-9]+|[^a-zA-Z0-9\-\_\:]+)/', '', $name);
if (preg_match('/^[0-9]+|[^a-zA-Z0-9\-\_\:]+/', $name) !== 0) {
throw new InvalidXmlElementException("Xml element's name is invalid");
}
$this->name = $name;

return $this;
}
Expand Down

0 comments on commit 81bb236

Please sign in to comment.