aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-php-rpc/php/stubs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-03 01:05:57 +0900
committernsfisis <nsfisis@gmail.com>2026-08-03 01:05:57 +0900
commit2f28d8112970960dbb9b6b582a3c6cd259337d21 (patch)
treeaf8bc223b3af9098e6925cbf6c47e198459ac818 /crates/shirabe-php-rpc/php/stubs
parentbf2c6fa58ae51f44fa0ec65c615f8e62de87812c (diff)
downloadphp-shirabe-2f28d8112970960dbb9b6b582a3c6cd259337d21.tar.gz
php-shirabe-2f28d8112970960dbb9b6b582a3c6cd259337d21.tar.zst
php-shirabe-2f28d8112970960dbb9b6b582a3c6cd259337d21.zip
feat(php-rpc): rework the RPC channel into the tagged plugin protocol
Replace the name\0arg framing with the plugin wire protocol: tagged frames with corr_id multiplexing, a MAX_FRAME_LEN bound, a thread-ID based reentrant SessionLock, and the PluginValue codec (encoder plus the first recursive decoder, iterative with a 512-level depth cap). Float formatting is ported from php-src into shirabe-php-src so the encoder is byte-compatible with serialize() under serialize_precision=-1, which the spawned worker now pins. The worker gains a standing dispatch loop, CallRustMethod reentrancy, hand-written Event proxy stubs, and explicit-error answers for everything not implemented yet. The public query API (get_php_version and friends) is unchanged and now rides the new protocol; the codec is verified against real PHP by roundtrip oracle tests covering floats, non-UTF-8 bytes and deep nesting. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-php-rpc/php/stubs')
-rw-r--r--crates/shirabe-php-rpc/php/stubs/Composer/EventDispatcher/Event.php59
-rw-r--r--crates/shirabe-php-rpc/php/stubs/Composer/Script/Event.php37
2 files changed, 96 insertions, 0 deletions
diff --git a/crates/shirabe-php-rpc/php/stubs/Composer/EventDispatcher/Event.php b/crates/shirabe-php-rpc/php/stubs/Composer/EventDispatcher/Event.php
new file mode 100644
index 00000000..9ce9c12f
--- /dev/null
+++ b/crates/shirabe-php-rpc/php/stubs/Composer/EventDispatcher/Event.php
@@ -0,0 +1,59 @@
+<?php
+
+// Hand-written proxy stub for Composer\EventDispatcher\Event, kept in the shape the future stub
+// generator will output: the real public methods, each forwarding to the Rust-side entity.
+
+namespace Composer\EventDispatcher;
+
+class Event implements \ShirabeRustStub
+{
+ /** @var int */
+ protected $__rhandle;
+ /** @var int */
+ protected $__epoch;
+
+ public function __construct(int $rhandle, int $epoch)
+ {
+ $this->__rhandle = $rhandle;
+ $this->__epoch = $epoch;
+ }
+
+ public function __destruct()
+ {
+ \ShirabeRustObjectRegistry::release($this->__rhandle);
+ }
+
+ public function __shirabeRustHandleDescriptor(): array
+ {
+ return [
+ '__rhandle' => $this->__rhandle,
+ '__class' => static::class,
+ '__epoch' => $this->__epoch,
+ ];
+ }
+
+ public function getName(): string
+ {
+ return \ShirabeRpcRuntime::callRust($this->__rhandle, 'getName', []);
+ }
+
+ public function getArguments(): array
+ {
+ return \ShirabeRpcRuntime::callRust($this->__rhandle, 'getArguments', []);
+ }
+
+ public function getFlags(): array
+ {
+ return \ShirabeRpcRuntime::callRust($this->__rhandle, 'getFlags', []);
+ }
+
+ public function isPropagationStopped(): bool
+ {
+ return \ShirabeRpcRuntime::callRust($this->__rhandle, 'isPropagationStopped', []);
+ }
+
+ public function stopPropagation(): void
+ {
+ \ShirabeRpcRuntime::callRust($this->__rhandle, 'stopPropagation', []);
+ }
+}
diff --git a/crates/shirabe-php-rpc/php/stubs/Composer/Script/Event.php b/crates/shirabe-php-rpc/php/stubs/Composer/Script/Event.php
new file mode 100644
index 00000000..80afe1b7
--- /dev/null
+++ b/crates/shirabe-php-rpc/php/stubs/Composer/Script/Event.php
@@ -0,0 +1,37 @@
+<?php
+
+// Hand-written proxy stub for Composer\Script\Event, kept in the shape the future stub
+// generator will output. See Composer/EventDispatcher/Event.php.
+
+namespace Composer\Script;
+
+use Composer\EventDispatcher\Event as BaseEvent;
+
+class Event extends BaseEvent
+{
+ public function getComposer(): \Composer\Composer
+ {
+ return \ShirabeRpcRuntime::callRust($this->__rhandle, 'getComposer', []);
+ }
+
+ public function getIO(): \Composer\IO\IOInterface
+ {
+ return \ShirabeRpcRuntime::callRust($this->__rhandle, 'getIO', []);
+ }
+
+ public function isDevMode(): bool
+ {
+ return \ShirabeRpcRuntime::callRust($this->__rhandle, 'isDevMode', []);
+ }
+
+ public function getOriginatingEvent(): ?BaseEvent
+ {
+ return \ShirabeRpcRuntime::callRust($this->__rhandle, 'getOriginatingEvent', []);
+ }
+
+ public function setOriginatingEvent(BaseEvent $event): self
+ {
+ \ShirabeRpcRuntime::callRust($this->__rhandle, 'setOriginatingEvent', [$event]);
+ return $this;
+ }
+}