Skip to content

Commit 9582eb6

Browse files
committed
fix: improve subject code extraction logic in Note class
1 parent 78e2f25 commit 9582eb6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • src/Ubl21/CreditNote/DataType/Basic

src/Ubl21/CreditNote/DataType/Basic/Note.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static function fromXML(\DOMXPath $xpath, \DOMElement $currentElement): a
5858
foreach ($noteElements as $noteElement) {
5959
preg_match($pattern, $noteElement->nodeValue, $matches);
6060

61-
$subjectCode = $matches[1] ? TextSubjectCodeUNTDID4451::tryFrom($matches[1]) : null;
61+
$subjectCode = !empty($matches[1]) ? TextSubjectCodeUNTDID4451::tryFrom($matches[1]) : null;
6262
$content = $matches[2] ?? $noteElement->nodeValue;
6363

6464
$note = new self($subjectCode, $content);

0 commit comments

Comments
 (0)