diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-04 04:07:41 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-04 05:43:24 +0900 |
| commit | 695365a0ad68e4534425c64b7a6a4b6598b68ef7 (patch) | |
| tree | a906972618f08e31012f721c717321bd08164cde /crates/shirabe/src/plugin/plugin_interface.rs | |
| parent | 261516d5ce6f8b0d69cf9e3da7dd2f0ef1cdc36a (diff) | |
| download | php-shirabe-695365a0ad68e4534425c64b7a6a4b6598b68ef7.tar.gz php-shirabe-695365a0ad68e4534425c64b7a6a4b6598b68ef7.tar.zst php-shirabe-695365a0ad68e4534425c64b7a6a4b6598b68ef7.zip | |
feat(plugin): dispatch plugin event subscribers through the RPC worker
Wires the addPlugin subscriber branch end to end: EventSubscriberInterface
and Capable become fallible and dyn-compatible (their sole implementor is
the PHP plugin proxy, which answers getSubscribedEvents over RPC), listeners
register as Callable::PhpMethod and are invoked with a per-call event handle,
and the R table now drops entries when a child-side stub destructs. The R
table keeps its IndexMap with monotonically increasing handles, so released
handles are never reused and no generation counter is needed.
Upstream has no subscriber-plugin test, so the path is covered by a
Shirabe-owned fixture exercising all three getSubscribedEvents shapes.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/plugin/plugin_interface.rs')
| -rw-r--r-- | crates/shirabe/src/plugin/plugin_interface.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/shirabe/src/plugin/plugin_interface.rs b/crates/shirabe/src/plugin/plugin_interface.rs index 989329ea..586fb43b 100644 --- a/crates/shirabe/src/plugin/plugin_interface.rs +++ b/crates/shirabe/src/plugin/plugin_interface.rs @@ -1,6 +1,7 @@ //! ref: composer/src/Composer/Plugin/PluginInterface.php use crate::composer::ComposerHandle; +use crate::event_dispatcher::EventSubscriberInterface; use crate::io::IOInterface; use crate::plugin::Capable; @@ -31,11 +32,10 @@ pub trait PluginInterface: std::fmt::Debug { /// the name PHP would report. fn get_class_name(&self) -> String; - // TODO(plugin): PHP-side `instanceof` checks for EventSubscriberInterface / Capable. - // EventSubscriberInterface is not dyn-compatible (its only method is associated, not - // a `&self` method), so we expose a boolean predicate instead. - fn is_event_subscriber_interface(&self) -> bool { - false + // PHP-side `instanceof EventSubscriberInterface` / `instanceof Capable` checks map to + // these downcast accessors. + fn as_event_subscriber(&self) -> Option<&dyn EventSubscriberInterface> { + None } fn as_capable(&self) -> Option<&dyn Capable> { |
