diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/php-on-wasm/php-wasm.php | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/php-on-wasm/php-wasm.php b/examples/php-on-wasm/php-wasm.php index 78196d6..2401985 100644 --- a/examples/php-on-wasm/php-wasm.php +++ b/examples/php-on-wasm/php-wasm.php @@ -190,7 +190,8 @@ function makeHostFunc(string $typeDef, callable $fn): Externs\Func 'f64' => ValType::F64, default => throw new \RuntimeException('Invalid type: ' . $s), }; - preg_match('/^\(([^)]*)\) -> \(([^)]*)\)$/', $typeDef, $matches); + $ok = preg_match('/^\(([^)]*)\) -> \(([^)]*)\)$/', $typeDef, $matches); + \assert($ok === 1); $paramsDef = $matches[1]; $resultsDef = $matches[2]; $params = array_map($stringToType, $paramsDef === '' ? [] : explode(', ', $paramsDef)); |
