Skip to content

Commit a9c46a5

Browse files
committed
add global defaults support
1 parent 5e8376e commit a9c46a5

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/Parsem/Parser.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ public static function parseString(mixed $string, array $arguments = [], bool $s
9696
$default = static::getDefaultValue($matches[2][$key]);
9797
if ($default !== static::LITERALLY_NULL) {
9898
$args[] = $default;
99+
} else if (isset($arguments["default:$match"])) {
100+
$args[] = $arguments["default:$match"];
101+
} else if ($strict) {
102+
throw new RuntimeException("Variable '$match' not found in arguments.");
99103
} else {
100-
if ($strict) {
101-
throw new RuntimeException("Variable '$match' not found in arguments.");
102-
}
103-
104104
$args[] = null;
105105
}
106106
}

0 commit comments

Comments
 (0)