From 6643eb8b7d305818f80c910144b3b29b1af34ba7 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 9 Aug 2026 09:14:11 +0900 Subject: refactor(installed-versions): drop the Rust port, which has no readers InstalledVersions is a runtime API for plugins and project code; Composer itself never reads it. Its consumers run in the PHP worker against the copy FilesystemRepository dumps to vendor/composer/InstalledVersions.php, whose static state is already kept in sync by __shirabe_installed_versions_reload. Nothing in Rust read the mirrored statics, so reload() and the reflection setters were no-ops. The tests covered only the Rust port, not the PHP class the worker loads, so they assert nothing about compatibility; they are left as todo!() skeletons. This also removes the shim functions method_exists, php_dir and require_php_file, whose only caller was the deleted module. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe-php-shim/src/runtime.rs | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) (limited to 'crates/shirabe-php-shim') diff --git a/crates/shirabe-php-shim/src/runtime.rs b/crates/shirabe-php-shim/src/runtime.rs index e24d6d69..2f8b79f1 100644 --- a/crates/shirabe-php-shim/src/runtime.rs +++ b/crates/shirabe-php-shim/src/runtime.rs @@ -66,18 +66,6 @@ pub fn defined(name: &str) -> bool { ) } -// Models methods available on Composer's own runtime classes when given a class name string. -// Shirabe is a native binary that does not run under a Composer-dumped autoloader, so the dumped -// `Composer\Autoload\ClassLoader` (and its `getRegisteredLoaders`) is absent from the running -// process; the class-name form therefore reports no such method. The object form needs runtime -// reflection that PhpMixed::Object does not carry. -pub fn method_exists(object_or_class: &PhpMixed, _method_name: &str) -> bool { - match object_or_class { - PhpMixed::String(_) => false, - _ => todo!(), - } -} - // Models the classes available in a standard PHP CLI environment running Composer: // the common bundled extensions (zip, Phar) plus Composer's own runtime classes. pub fn class_exists(name: &str) -> bool { @@ -351,23 +339,12 @@ pub fn usleep(_microseconds: u64) { } /// Equivalent to PHP's __DIR__ magic constant -pub fn php_dir() -> String { +pub fn dir() -> String { // TODO(php-runtime): __DIR__ is the directory of the source file at compile time; it must be supplied // per call site (e.g. via a macro), not from a runtime shim function. todo!() } -pub fn dir() -> String { - // TODO(php-runtime): see php_dir; __DIR__ is a per-source-file compile-time value. - todo!() -} - -/// Equivalent to PHP's `require ` returning the file's return value -pub fn require_php_file(_filename: &str) -> PhpMixed { - // TODO(php-runtime): `require` evaluates a PHP source file at runtime; there is no PHP interpreter. - todo!() -} - pub fn memory_get_usage() -> i64 { // TODO(phase-c): return PHP's actual emalloc-tracked memory usage instead of a stub 0. 0 -- cgit v1.3.1-4-g156e