diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-13 11:38:20 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-13 17:49:15 +0900 |
| commit | 69c372ba0eca61b05260d6d208445d9e69d14e34 (patch) | |
| tree | ab837346f5729a5a4a67ccd83462033511b41c89 /crates/shirabe/src/util/platform.rs | |
| parent | efe5bdb1987411a473d4af15451a376d20928245 (diff) | |
| download | php-shirabe-69c372ba0eca61b05260d6d208445d9e69d14e34.tar.gz php-shirabe-69c372ba0eca61b05260d6d208445d9e69d14e34.tar.zst php-shirabe-69c372ba0eca61b05260d6d208445d9e69d14e34.zip | |
fix(console): flatten Application inheritance to restore overrides
Composer\Console\Application embedded Symfony's Application as an
`inner` field and delegated to it, so polymorphic calls inside the
Symfony base (e.g. doRun -> $this->getLongVersion()) resolved to
Symfony's own methods and never reached Composer's overrides. As a
result `--version` bypassed Composer's getLongVersion()/doRun()
entirely.
Flatten the PHP inheritance chain into the single shirabe Application
struct: take in the Symfony base methods (parent-calling overrides kept
under a `base_` prefix) and drop the `inner` delegation. Replace the
Symfony Application struct in shirabe-external-packages with an
`Application` trait that the merged struct implements, so commands and
descriptors can reference it without a reverse crate dependency.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util/platform.rs')
| -rw-r--r-- | crates/shirabe/src/util/platform.rs | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/crates/shirabe/src/util/platform.rs b/crates/shirabe/src/util/platform.rs index ecf2338..5155e8f 100644 --- a/crates/shirabe/src/util/platform.rs +++ b/crates/shirabe/src/util/platform.rs @@ -5,8 +5,8 @@ use std::sync::Mutex; use anyhow::Result; use shirabe_external_packages::composer::pcre::Preg; use shirabe_php_shim::{ - PhpMixed, RuntimeException, defined, env_contains_key, env_get, env_set, env_unset, - file_exists, file_get_contents, fopen, fstat, function_exists, getcwd, getenv, in_array, + PhpMixed, PhpResource, RuntimeException, defined, env_contains_key, env_get, env_set, + env_unset, file_exists, file_get_contents, fstat, function_exists, getcwd, getenv, in_array, ini_get, is_array, is_readable, mb_strlen, php_os_family, posix_geteuid, posix_getpwuid, posix_getuid, posix_isatty, putenv, realpath, server_contains_key, server_get, server_set, server_unset, stream_isatty, stripos, strlen, strtoupper, substr, usleep, @@ -288,21 +288,12 @@ impl Platform { } /// @param ?resource $fd Open file descriptor or null to default to STDOUT - pub fn is_tty(fd: Option<PhpMixed>) -> bool { + pub fn is_tty(fd: Option<PhpResource>) -> bool { let fd = match fd { Some(f) => f, None => { - if defined("STDOUT") { - // TODO(phase-c): map the STDOUT constant to a runtime stdout resource; depends - // on the unmodeled PHP stream/resource layer. - todo!("STDOUT constant") - } else { - let fd = fopen("php://stdout", "w"); - if matches!(fd, PhpMixed::Bool(false)) { - return false; - } - fd - } + // TODO(phase-c): STDOUT is not yet modeled as a `PhpResource` constant. + todo!("STDOUT resource constant") } }; |
