Skip to content

Commit

Permalink
Merge pull request #665 from tienvx/phpstan-max-xml-element
Browse files Browse the repository at this point in the history
refactor: PHPStan max level > Fix 'Property does not accept null'
  • Loading branch information
tienvx authored Oct 1, 2024
2 parents 449f80e + 81bb236 commit baf5f76
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 baf5f76

Please sign in to comment.