From 487509c913cd4e8255ceb4f6bb19c3abea511789 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 31 Aug 2024 16:29:36 +0900 Subject: chore: format --- examples/php-on-wasm/php-wasm.php | 3 ++- src/Stream/BlobStream.php | 1 + src/Stream/FileStream.php | 1 + src/WebAssembly/BinaryFormat/Decoder.php | 1 + src/WebAssembly/Execution/MemInst.php | 1 + tests/src/SpecTestsuites/SpecTestsuiteBase.php | 1 + 6 files changed, 7 insertions(+), 1 deletion(-) 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)); diff --git a/src/Stream/BlobStream.php b/src/Stream/BlobStream.php index 972b8f6..3f8004b 100644 --- a/src/Stream/BlobStream.php +++ b/src/Stream/BlobStream.php @@ -6,6 +6,7 @@ namespace Nsfisis\Waddiwasi\Stream; use function assert; use function ord; +use function sprintf; use function strlen; use function substr; diff --git a/src/Stream/FileStream.php b/src/Stream/FileStream.php index cb5b519..308f617 100644 --- a/src/Stream/FileStream.php +++ b/src/Stream/FileStream.php @@ -10,6 +10,7 @@ use function fclose; use function fopen; use function fread; use function ord; +use function sprintf; use function strlen; final class FileStream implements StreamInterface diff --git a/src/WebAssembly/BinaryFormat/Decoder.php b/src/WebAssembly/BinaryFormat/Decoder.php index 09d5a14..2e59df4 100644 --- a/src/WebAssembly/BinaryFormat/Decoder.php +++ b/src/WebAssembly/BinaryFormat/Decoder.php @@ -42,6 +42,7 @@ use function in_array; use function is_float; use function is_int; use function ord; +use function sprintf; final class Decoder { diff --git a/src/WebAssembly/Execution/MemInst.php b/src/WebAssembly/Execution/MemInst.php index 802f334..deaa6ba 100644 --- a/src/WebAssembly/Execution/MemInst.php +++ b/src/WebAssembly/Execution/MemInst.php @@ -10,6 +10,7 @@ use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\Limits; use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\MemType; use function assert; use function count; +use function sprintf; final class MemInst { diff --git a/tests/src/SpecTestsuites/SpecTestsuiteBase.php b/tests/src/SpecTestsuites/SpecTestsuiteBase.php index 3e3f5a1..6d92ed8 100644 --- a/tests/src/SpecTestsuites/SpecTestsuiteBase.php +++ b/tests/src/SpecTestsuites/SpecTestsuiteBase.php @@ -34,6 +34,7 @@ use PHPUnit\Framework\TestCase; use RuntimeException; use function count; use function is_float; +use function sprintf; abstract class SpecTestsuiteBase extends TestCase { -- cgit v1.2.3-70-g09d2