diff --git a/src/LibExtism.php b/src/LibExtism.php index cc4b5dc..3937218 100644 --- a/src/LibExtism.php +++ b/src/LibExtism.php @@ -72,7 +72,7 @@ function extism_current_plugin_memory_length(FFI\CData $plugin, int $offset): in return $this->ffi->extism_current_plugin_memory_length($plugin, $offset); } - function extism_plugin_new(string $wasm, int $wasm_size, FFI\CData $functions, int $n_functions, bool $with_wasi, ?FFI\CData $errmsg): FFI\CData|null + function extism_plugin_new(string $wasm, int $wasm_size, FFI\CData $functions, int $n_functions, bool $with_wasi, ?FFI\CData $errmsg): ?FFI\CData { $ptr = $this->owned("uint8_t", $wasm); $wasi = $with_wasi ? 1 : 0; @@ -154,7 +154,7 @@ function extism_function_set_namespace(FFI\CData $handle, string $name) $this->ffi->extism_function_set_namespace($handle, $namePtr); } - function toCArray(array $array, string $type): FFI\CData | null + function toCArray(array $array, string $type): ?FFI\CData { if (count($array) == 0) { return $this->ffi->new($type . "*"); @@ -168,7 +168,7 @@ function toCArray(array $array, string $type): FFI\CData | null return $cArray; } - function owned(string $type, string $string): FFI\CData|null + function owned(string $type, string $string): ?FFI\CData { if (strlen($string) == 0) { return null; @@ -179,7 +179,7 @@ function owned(string $type, string $string): FFI\CData|null return $str; } - function ownedZero(string $string): FFI\CData|null + function ownedZero(string $string): ?FFI\CData { return $this->owned("char", "$string\0"); } @@ -189,4 +189,4 @@ function startsWith($haystack, $needle) { } } -?> \ No newline at end of file +?>