aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-31 16:29:36 +0900
committernsfisis <nsfisis@gmail.com>2024-08-31 16:29:48 +0900
commit487509c913cd4e8255ceb4f6bb19c3abea511789 (patch)
treee1860ab80c7ac1e672b317c85cacbd5718e9581b
parent699f6ef036ed8eb01c1b4fb386464fabf5fa9443 (diff)
downloadphp-waddiwasi-487509c913cd4e8255ceb4f6bb19c3abea511789.tar.gz
php-waddiwasi-487509c913cd4e8255ceb4f6bb19c3abea511789.tar.zst
php-waddiwasi-487509c913cd4e8255ceb4f6bb19c3abea511789.zip
chore: format
-rw-r--r--examples/php-on-wasm/php-wasm.php3
-rw-r--r--src/Stream/BlobStream.php1
-rw-r--r--src/Stream/FileStream.php1
-rw-r--r--src/WebAssembly/BinaryFormat/Decoder.php1
-rw-r--r--src/WebAssembly/Execution/MemInst.php1
-rw-r--r--tests/src/SpecTestsuites/SpecTestsuiteBase.php1
6 files changed, 7 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));
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
{