diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-12 02:14:18 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-12 02:15:32 +0900 |
| commit | 981cae63d9777b877aa9f96907c7995ec020fbf9 (patch) | |
| tree | d1e9129ece95f1fa3750bb9a7302135d397e0abf /crates/shirabe-external-packages/src/symfony/console/terminal.rs | |
| parent | 1e44f5723e4c0e0903d00a61f254901e612fe5e1 (diff) | |
| download | php-shirabe-981cae63d9777b877aa9f96907c7995ec020fbf9.tar.gz php-shirabe-981cae63d9777b877aa9f96907c7995ec020fbf9.tar.zst php-shirabe-981cae63d9777b877aa9f96907c7995ec020fbf9.zip | |
feat(php-shim): implement runtime functions to run --version
Replace todo!() stubs reached on the `composer --version` path so the
command runs without panicking and exits cleanly:
- introspection (function_exists, class_exists, extension_loaded,
defined) via white-lists modeling a standard Linux PHP CLI
- type casts: php_to_string/strval, php_truthy/boolval, substr,
byte_at, explode, strtr_array
- config/env: error_reporting, ini_get, date_default_timezone_*,
server_get/server_contains_key, php_uname("s")
- IO: turn PhpResource into an enum (Stdin/Stdout/Stderr/File) and
implement fwrite/fflush/stream_isatty/php_fopen resource helpers
- shutdown/exit: register_shutdown_function + run_shutdown_functions,
exit, error_get_last
- preg_match_all_offset_capture via the regex crate; the formatter
pattern drops PCRE possessive quantifiers (original kept in a
comment with a TODO)
proc_open reports unavailable for now (TODO(phase-c)); terminal-size
and tty detection fall back to defaults. sprintf calls on this path
are rewritten with format!(). OutputFormatterStyleInterface gains
clone_box to return shared styles.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-external-packages/src/symfony/console/terminal.rs')
| -rw-r--r-- | crates/shirabe-external-packages/src/symfony/console/terminal.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/terminal.rs b/crates/shirabe-external-packages/src/symfony/console/terminal.rs index 8163b28..5ff744a 100644 --- a/crates/shirabe-external-packages/src/symfony/console/terminal.rs +++ b/crates/shirabe-external-packages/src/symfony/console/terminal.rs @@ -127,11 +127,8 @@ impl Terminal { /// Returns whether STDOUT has vt100 support (some Windows 10+ configurations). fn has_vt100_support() -> bool { shirabe_php_shim::function_exists("sapi_windows_vt100_support") && { - // PHP passes the `fopen('php://stdout', 'w')` resource. The shim's `fopen` - // returns `PhpMixed` but `sapi_windows_vt100_support` expects - // `&PhpResource`; bridge with a placeholder resource. - let _ = shirabe_php_shim::fopen("php://stdout", "w"); - shirabe_php_shim::sapi_windows_vt100_support(&shirabe_php_shim::PhpResource) + let stream = shirabe_php_shim::php_fopen_resource("php://stdout", "w"); + shirabe_php_shim::sapi_windows_vt100_support(&stream) } } |
