aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-php-shim/src
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-02 16:27:36 +0900
committernsfisis <nsfisis@gmail.com>2026-08-02 16:29:08 +0900
commit9efc866ae2553a9c51abae7214f62dde4f5f053c (patch)
treed3749ced8b4e32713d4f5e3e88a34b501c4b4918 /crates/shirabe-php-shim/src
parent6047bcc3e63ab84dfc67bce94f402f1bfa3f58d5 (diff)
downloadphp-shirabe-9efc866ae2553a9c51abae7214f62dde4f5f053c.tar.gz
php-shirabe-9efc866ae2553a9c51abae7214f62dde4f5f053c.tar.zst
php-shirabe-9efc866ae2553a9c51abae7214f62dde4f5f053c.zip
chore(todo): consolidate TODO comments into the five fixed marker tags
Retag every Shirabe-authored TODO comment to one of the fixed tags: phase-c, phase-d, plugin, php-runtime, phase-e. Upstream-authored TODO comments from Composer/Symfony are left untouched to preserve the ported code shape. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-php-shim/src')
-rw-r--r--crates/shirabe-php-shim/src/array.rs4
-rw-r--r--crates/shirabe-php-shim/src/env.rs4
-rw-r--r--crates/shirabe-php-shim/src/fs.rs10
-rw-r--r--crates/shirabe-php-shim/src/lib.rs4
-rw-r--r--crates/shirabe-php-shim/src/preg.rs2
-rw-r--r--crates/shirabe-php-shim/src/process.rs2
-rw-r--r--crates/shirabe-php-shim/src/runtime.rs64
-rw-r--r--crates/shirabe-php-shim/src/stream.rs2
-rw-r--r--crates/shirabe-php-shim/src/string.rs8
-rw-r--r--crates/shirabe-php-shim/src/var.rs30
-rw-r--r--crates/shirabe-php-shim/src/zip.rs2
11 files changed, 66 insertions, 66 deletions
diff --git a/crates/shirabe-php-shim/src/array.rs b/crates/shirabe-php-shim/src/array.rs
index 6c2004cf..29338aae 100644
--- a/crates/shirabe-php-shim/src/array.rs
+++ b/crates/shirabe-php-shim/src/array.rs
@@ -686,7 +686,7 @@ pub fn sort<T: Ord>(_array: &mut Vec<T>) {
pub fn sort_with_flags<T: Ord>(array: &mut [T], flags: i64) {
if flags != SORT_REGULAR {
- // TODO(phase-d): flag-specific comparison (SORT_NUMERIC/SORT_STRING/
+ // TODO(phase-c): flag-specific comparison (SORT_NUMERIC/SORT_STRING/
// SORT_NATURAL/SORT_FLAG_CASE) cannot be expressed for a generic
// `T: Ord` element. No caller passes a non-regular flag yet.
todo!("sort() with flags other than SORT_REGULAR");
@@ -714,7 +714,7 @@ pub fn ksort<V>(array: &mut IndexMap<String, V>) {
// PHP's default SORT_REGULAR comparison for array keys: two integer-like keys
// compare numerically, otherwise byte-wise as strings.
-// TODO(phase-d): full SORT_REGULAR semantics for mixed integer/non-numeric-string
+// TODO(phase-c): full SORT_REGULAR semantics for mixed integer/non-numeric-string
// keys are not reproduced; every current caller uses homogeneous string keys.
fn php_sort_regular_key(a: &str, b: &str) -> std::cmp::Ordering {
if let (Ok(na), Ok(nb)) = (a.parse::<i64>(), b.parse::<i64>())
diff --git a/crates/shirabe-php-shim/src/env.rs b/crates/shirabe-php-shim/src/env.rs
index 9043167b..d84a8ad9 100644
--- a/crates/shirabe-php-shim/src/env.rs
+++ b/crates/shirabe-php-shim/src/env.rs
@@ -14,7 +14,7 @@ pub fn getenv<K: AsRef<std::ffi::OsStr>>(key: K) -> Option<std::ffi::OsString> {
/// thread is concurrently reading or writing the process environment for the
/// duration of this call.
pub unsafe fn putenv<K: AsRef<std::ffi::OsStr>, V: AsRef<std::ffi::OsStr>>(key: K, value: V) {
- // TODO: validate key and value format to avoid panic?
+ // TODO(phase-c): validate key and value format to avoid panic?
unsafe { std::env::set_var(key, value) }
}
@@ -24,7 +24,7 @@ pub unsafe fn putenv<K: AsRef<std::ffi::OsStr>, V: AsRef<std::ffi::OsStr>>(key:
/// thread is concurrently reading or writing the process environment for the
/// duration of this call.
pub unsafe fn putenv_clear<K: AsRef<std::ffi::OsStr>>(key: K) {
- // TODO: validate key and value format to avoid panic?
+ // TODO(phase-c): validate key and value format to avoid panic?
unsafe { std::env::remove_var(key) }
}
diff --git a/crates/shirabe-php-shim/src/fs.rs b/crates/shirabe-php-shim/src/fs.rs
index efc9d2be..3cc2df36 100644
--- a/crates/shirabe-php-shim/src/fs.rs
+++ b/crates/shirabe-php-shim/src/fs.rs
@@ -765,7 +765,7 @@ pub fn chmod(_path: &str, _mode: u32) -> bool {
pub fn fileperms(_path: &str) -> i64 {
use std::os::unix::fs::MetadataExt;
// PHP returns the full st_mode (file type bits included).
- // TODO(phase-d): PHP returns false on error; this i64 signature reports 0 instead.
+ // TODO(phase-c): PHP returns false on error; this i64 signature reports 0 instead.
std::fs::metadata(_path)
.map(|m| m.mode() as i64)
.unwrap_or(0)
@@ -852,7 +852,7 @@ pub fn file_put_contents(_path: &str, _data: &[u8]) -> Option<i64> {
}
pub fn file_put_contents3(_filename: &str, _data: &str, _flags: i64) -> Option<i64> {
- // TODO(phase-d): the LOCK_EX and FILE_USE_INCLUDE_PATH flags are ignored; only FILE_APPEND is
+ // TODO(phase-c): the LOCK_EX and FILE_USE_INCLUDE_PATH flags are ignored; only FILE_APPEND is
// honored.
let append = _flags & FILE_APPEND != 0;
let mut opts = std::fs::OpenOptions::new();
@@ -886,7 +886,7 @@ pub fn file_get_contents5(
_offset: i64,
_length: Option<i64>,
) -> Option<String> {
- // TODO(phase-d): the stream $context and FILE_USE_INCLUDE_PATH are ignored; only $offset and
+ // TODO(phase-c): the stream $context and FILE_USE_INCLUDE_PATH are ignored; only $offset and
// $length are applied (to the file read from the local filesystem).
// PHP supports the file:// stream wrapper; strip it to read the local file.
let path = _path.strip_prefix("file://").unwrap_or(_path);
@@ -1025,7 +1025,7 @@ pub fn sys_get_temp_dir() -> String {
pub fn tempnam(_dir: &str, _prefix: &str) -> Option<String> {
use std::os::unix::fs::PermissionsExt;
- // TODO(phase-d): PHP falls back to the system temp dir when $dir is not writable; that fallback
+ // TODO(phase-c): PHP falls back to the system temp dir when $dir is not writable; that fallback
// is not implemented here.
for _ in 0..1000 {
let name = format!("{}{:08x}", _prefix, fastrand::u32(..));
@@ -1048,7 +1048,7 @@ pub fn tempnam(_dir: &str, _prefix: &str) -> Option<String> {
// A directory-handle resource. This is a distinct resource kind from the byte streams modeled by
// PhpResource; readdir/closedir have no callers yet, so it only records the opened path.
-// TODO(phase-d): give it real readdir/closedir behavior (cursor over the entries) when needed.
+// TODO(phase-c): give it real readdir/closedir behavior (cursor over the entries) when needed.
#[derive(Debug)]
pub struct PhpDirHandle {
pub path: std::path::PathBuf,
diff --git a/crates/shirabe-php-shim/src/lib.rs b/crates/shirabe-php-shim/src/lib.rs
index ab904a46..3012f578 100644
--- a/crates/shirabe-php-shim/src/lib.rs
+++ b/crates/shirabe-php-shim/src/lib.rs
@@ -69,7 +69,7 @@ pub enum PhpMixed {
String(String),
List(Vec<PhpMixed>),
Array(IndexMap<String, PhpMixed>),
- // TODO: consolidate Object to Array.
+ // TODO(phase-e): consolidate Object to Array.
Object(IndexMap<String, PhpMixed>),
// Resources, arbitrary objects and callables are intentionally excluded. Do not add these
// things to this type.
@@ -425,7 +425,7 @@ pub enum StreamBacking {
/// A real file on disk (also `/dev/null`); the OS tracks the position.
File(std::fs::File),
/// `php://memory` and `php://temp` — an in-memory growable buffer.
- /// TODO(phase-d): `php://temp/maxmemory:N` spills to a temp file past N bytes;
+ /// TODO(phase-c): `php://temp/maxmemory:N` spills to a temp file past N bytes;
/// the threshold is ignored here and everything stays in memory.
Memory(std::io::Cursor<Vec<u8>>),
/// A child process pipe created by `proc_open`. Half-duplex and not seekable.
diff --git a/crates/shirabe-php-shim/src/preg.rs b/crates/shirabe-php-shim/src/preg.rs
index 06ea7284..c2ec563b 100644
--- a/crates/shirabe-php-shim/src/preg.rs
+++ b/crates/shirabe-php-shim/src/preg.rs
@@ -597,7 +597,7 @@ pub fn php_regex_anchored(pattern: &str) -> bool {
/// compiles to a per-call-site cached `&'static regex::Regex`, instead of going through the
/// runtime `PATTERN_CACHE` lookup by string key. Expands to a `(&'static regex::Regex, bool)`
/// tuple, ready to pass straight into any `preg_*` function.
-// TODO: `$php_pattern` is still translated from PHP delimiter/modifier syntax at runtime (on
+// TODO(phase-e): `$php_pattern` is still translated from PHP delimiter/modifier syntax at runtime (on
// first use at each call site). Once call sites pass native `regex`-crate syntax directly, drop
// this wrapper and call `regex_macro::regex!` directly.
#[macro_export]
diff --git a/crates/shirabe-php-shim/src/process.rs b/crates/shirabe-php-shim/src/process.rs
index 770cea0c..1485adf7 100644
--- a/crates/shirabe-php-shim/src/process.rs
+++ b/crates/shirabe-php-shim/src/process.rs
@@ -63,7 +63,7 @@ pub fn system(command: &str, result_code: Option<&mut i64>) -> Option<String> {
*code = result.status.code().unwrap_or(-1) as i64;
}
// PHP system() passes the command output straight through to the script's output.
- // TODO(phase-d): PHP flushes line by line as the command runs; here the whole output is captured
+ // TODO(phase-c): PHP flushes line by line as the command runs; here the whole output is captured
// and emitted once the command finishes, which changes interleaving/streaming timing.
let _ = std::io::stdout().write_all(&result.stdout);
let _ = std::io::stdout().flush();
diff --git a/crates/shirabe-php-shim/src/runtime.rs b/crates/shirabe-php-shim/src/runtime.rs
index 71bb4530..c529c263 100644
--- a/crates/shirabe-php-shim/src/runtime.rs
+++ b/crates/shirabe-php-shim/src/runtime.rs
@@ -44,7 +44,7 @@ pub const PHP_OS: &str = match std::env::consts::OS.as_bytes() {
};
pub fn constant(_name: &str) -> PhpMixed {
- // TODO(phase-d): resolving a constant by name needs a runtime constant registry, which the shim
+ // TODO(php-runtime): resolving a constant by name needs a runtime constant registry, which the shim
// does not provide (constants are ported as Rust `const`s, not looked up by string).
todo!()
}
@@ -186,7 +186,7 @@ pub fn ini_get(option: &str) -> Option<String> {
pub fn get_loaded_extensions() -> Vec<String> {
// Mirrors the set recognized by extension_loaded().
- // TODO(phase-d): this models only the Composer-relevant subset, not PHP's full extension list
+ // TODO(php-runtime): this models only the Composer-relevant subset, not PHP's full extension list
// (Core, standard, date, pcre, ...).
[
"Phar", "curl", "filter", "hash", "iconv", "intl", "mbstring", "openssl", "zip", "zlib",
@@ -200,7 +200,7 @@ pub fn phpversion(_extension: &str) -> Option<String> {
if _extension.is_empty() {
Some(PHP_VERSION.to_string())
} else {
- // TODO(phase-d): per-extension version strings are not modeled; PHP returns the extension's
+ // TODO(php-runtime): per-extension version strings are not modeled; PHP returns the extension's
// own version, or false when the extension is not loaded.
todo!()
}
@@ -210,7 +210,7 @@ pub fn phpversion(_extension: &str) -> Option<String> {
pub fn set_error_handler(_callback: fn(i64, &str, &str, i64) -> bool) {}
pub fn debug_backtrace() -> Vec<IndexMap<String, PhpMixed>> {
- // TODO(phase-d): capturing a PHP-style call stack requires runtime introspection of the
+ // TODO(php-runtime): capturing a PHP-style call stack requires runtime introspection of the
// interpreter frames, which has no equivalent in the compiled shim.
todo!()
}
@@ -218,7 +218,7 @@ pub fn debug_backtrace() -> Vec<IndexMap<String, PhpMixed>> {
/// Equivalent to PHP `include $file;`
pub fn include_file(file: &str) -> PhpMixed {
let _ = file;
- // TODO(phase-d): `include` evaluates a PHP source file at runtime; there is no PHP interpreter.
+ // TODO(php-runtime): `include` evaluates a PHP source file at runtime; there is no PHP interpreter.
todo!()
}
@@ -228,7 +228,7 @@ pub fn spl_autoload_register(
prepend: bool,
) -> bool {
let _ = (callback, throw, prepend);
- // TODO(phase-d): class autoloading has no analogue in compiled Rust (classes are not loaded by
+ // TODO(php-runtime): class autoloading has no analogue in compiled Rust (classes are not loaded by
// name at runtime), so the callback is dropped. Returns success so callers that register an
// autoloader during startup can proceed; this is not a faithful implementation.
true
@@ -236,7 +236,7 @@ pub fn spl_autoload_register(
pub fn spl_autoload_unregister(callback: Box<dyn Fn(&str) -> PhpMixed + Send + Sync>) -> bool {
let _ = callback;
- // TODO(phase-d): see spl_autoload_register; nothing is registered, so this is a no-op stub.
+ // TODO(php-runtime): see spl_autoload_register; nothing is registered, so this is a no-op stub.
true
}
@@ -268,7 +268,7 @@ pub fn version_compare(_v1: &str, _v2: &str, _op: &str) -> bool {
">=" | "ge" => c >= 0,
"==" | "=" | "eq" => c == 0,
"!=" | "<>" | "ne" => c != 0,
- // TODO(phase-d): PHP returns null for an unknown operator; this bool signature reports false.
+ // TODO(phase-c): PHP returns null for an unknown operator; this bool signature reports false.
_ => false,
}
}
@@ -284,7 +284,7 @@ pub fn restore_error_handler() {}
pub fn spl_object_hash<T: ?Sized>(_object: &T) -> String {
// PHP returns a unique 32-char hex id per object instance; the object's address serves as the
// identity here.
- // TODO(phase-d): as in PHP, an address can be reused after an object is freed, so uniqueness is
+ // TODO(phase-c): as in PHP, an address can be reused after an object is freed, so uniqueness is
// not guaranteed across an object's whole lifetime without an object store.
format!("{:032x}", _object as *const T as *const u8 as usize)
}
@@ -320,13 +320,13 @@ pub fn php_uname(mode: &str) -> String {
}
pub fn trigger_error(_message: &str, _error_level: i64) {
- // TODO(phase-d): emitting a PHP error obeys error_reporting and the installed error handler
+ // TODO(php-runtime): emitting a PHP error obeys error_reporting and the installed error handler
// (both runtime state not modeled here); writing unconditionally to stderr would diverge.
todo!()
}
pub fn trigger_deprecation(_package: &str, _version: &str, _message: &str, _arg: &str) {
- // TODO(phase-d): symfony/deprecation-contracts triggers an E_USER_DEPRECATED via the error
+ // TODO(php-runtime): symfony/deprecation-contracts triggers an E_USER_DEPRECATED via the error
// subsystem, which is not modeled (see trigger_error).
todo!()
}
@@ -337,34 +337,34 @@ pub fn usleep(_microseconds: u64) {
/// Equivalent to PHP's __DIR__ magic constant
pub fn php_dir() -> String {
- // TODO(phase-d): __DIR__ is the directory of the source file at compile time; it must be supplied
+ // 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(phase-d): see php_dir; __DIR__ is a per-source-file compile-time value.
+ // TODO(php-runtime): see php_dir; __DIR__ is a per-source-file compile-time value.
todo!()
}
/// Equivalent to PHP's `require <file>` returning the file's return value
pub fn require_php_file(_filename: &str) -> PhpMixed {
- // TODO(phase-d): `require` evaluates a PHP source file at runtime; there is no PHP interpreter.
+ // TODO(php-runtime): `require` evaluates a PHP source file at runtime; there is no PHP interpreter.
todo!()
}
pub fn php_require(_file: &str) -> PhpMixed {
- // TODO(phase-d): see require_php_file.
+ // TODO(php-runtime): see require_php_file.
todo!()
}
pub fn memory_get_usage() -> i64 {
- // TODO(phase-d): return PHP's actual emalloc-tracked memory usage instead of a stub 0.
+ // TODO(phase-c): return PHP's actual emalloc-tracked memory usage instead of a stub 0.
0
}
pub fn memory_get_peak_usage(_real_usage: bool) -> i64 {
- // TODO(phase-d): return PHP's actual emalloc-tracked peak memory usage instead of a stub 0.
+ // TODO(phase-c): return PHP's actual emalloc-tracked peak memory usage instead of a stub 0.
0
}
@@ -372,18 +372,18 @@ pub fn call_user_func<T>(_callback: &str, _args: &[PhpMixed]) -> T
where
T: From<PhpMixed>,
{
- // TODO(phase-d): invoking a function by name needs a runtime function registry; the shim has no
+ // TODO(php-runtime): invoking a function by name needs a runtime function registry; the shim has no
// way to resolve a callable from a string.
todo!()
}
pub fn call_user_func_array(_callback: &str, _args: &PhpMixed) -> PhpMixed {
- // TODO(phase-d): see call_user_func.
+ // TODO(php-runtime): see call_user_func.
todo!()
}
pub fn call_php_callable(_callback: &PhpMixed, _args: &[PhpMixed]) -> PhpMixed {
- // TODO(phase-d): PhpMixed carries no callable variant; a runtime callable cannot be invoked.
+ // TODO(php-runtime): PhpMixed carries no callable variant; a runtime callable cannot be invoked.
todo!()
}
@@ -393,12 +393,12 @@ pub fn error_get_last() -> Option<IndexMap<String, PhpMixed>> {
}
pub fn globals_get(_name: &str) -> PhpMixed {
- // TODO(phase-d): the PHP $GLOBALS superglobal is not modeled in the shim.
+ // TODO(php-runtime): the PHP $GLOBALS superglobal is not modeled in the shim.
todo!()
}
pub fn globals_set(_name: &str, _value: PhpMixed) {
- // TODO(phase-d): the PHP $GLOBALS superglobal is not modeled in the shim.
+ // TODO(php-runtime): the PHP $GLOBALS superglobal is not modeled in the shim.
todo!()
}
@@ -408,13 +408,13 @@ pub fn clone<T: Clone>(_value: T) -> T {
}
pub fn ini_set(_varname: &str, _value: &str) -> Option<String> {
- // TODO(phase-d): ini_set must return the previous value and have its override observed by a
+ // TODO(php-runtime): ini_set must return the previous value and have its override observed by a
// subsequent ini_get; ini_get is currently a static lookup, so overrides cannot be wired up yet.
todo!()
}
pub fn composer_dev_warning_time() -> i64 {
- // TODO(phase-d): COMPOSER_DEV_WARNING_TIME is a build-time constant baked into Composer's release
+ // TODO(phase-c): COMPOSER_DEV_WARNING_TIME is a build-time constant baked into Composer's release
// artifact; it has no fixed value in source and must be provided by the build process.
todo!()
}
@@ -433,45 +433,45 @@ pub fn gc_enable() {
}
pub fn react_promise_resolve(_value: PhpMixed) -> PhpMixed {
- // TODO(phase-d): depends on the react/promise port (shirabe_external_packages), which is not yet
+ // TODO(phase-c): depends on the react/promise port (shirabe_external_packages), which is not yet
// available.
todo!()
}
pub fn ioncube_loader_iversion() -> i64 {
- // TODO(phase-d): the ionCube loader is not present (extension_loaded reports it absent), so this
+ // TODO(phase-c): the ionCube loader is not present (extension_loaded reports it absent), so this
// function is never defined at runtime; left unimplemented.
todo!()
}
pub fn ioncube_loader_version() -> String {
- // TODO(phase-d): see ioncube_loader_iversion.
+ // TODO(phase-c): see ioncube_loader_iversion.
todo!()
}
pub fn phpinfo(_what: i64) {
- // TODO(phase-d): phpinfo() dumps the full PHP runtime configuration, which the shim does not
+ // TODO(php-runtime): phpinfo() dumps the full PHP runtime configuration, which the shim does not
// model.
todo!()
}
pub fn sapi_windows_vt100_support(_resource: &crate::PhpResource) -> bool {
- // TODO(phase-d): Windows-only SAPI function; not defined on the non-Windows target this build
+ // TODO(phase-c): Windows-only SAPI function; not defined on the non-Windows target this build
// models (function_exists reports it absent).
todo!()
}
pub fn sapi_windows_cp_get(_kind: Option<&str>) -> i64 {
- // TODO(phase-d): Windows-only SAPI function; see sapi_windows_vt100_support.
+ // TODO(phase-c): Windows-only SAPI function; see sapi_windows_vt100_support.
todo!()
}
pub fn sapi_windows_cp_set(_codepage: i64) -> bool {
- // TODO(phase-d): Windows-only SAPI function; see sapi_windows_vt100_support.
+ // TODO(phase-c): Windows-only SAPI function; see sapi_windows_vt100_support.
todo!()
}
pub fn sapi_windows_cp_conv(_in_codepage: i64, _out_codepage: i64, _subject: &str) -> String {
- // TODO(phase-d): Windows-only SAPI function; see sapi_windows_vt100_support.
+ // TODO(phase-c): Windows-only SAPI function; see sapi_windows_vt100_support.
todo!()
}
diff --git a/crates/shirabe-php-shim/src/stream.rs b/crates/shirabe-php-shim/src/stream.rs
index b977ce4b..e34849ed 100644
--- a/crates/shirabe-php-shim/src/stream.rs
+++ b/crates/shirabe-php-shim/src/stream.rs
@@ -14,7 +14,7 @@ pub fn stream_get_contents(stream: &PhpResource) -> Option<String> {
}
pub fn stream_resolve_include_path(filename: &str) -> Option<String> {
- // TODO(phase-d): resolution searches the `include_path` ini setting, which the shim does not
+ // TODO(phase-c): resolution searches the `include_path` ini setting, which the shim does not
// model; checking only the current directory would silently miss configured include paths.
let _ = filename;
todo!()
diff --git a/crates/shirabe-php-shim/src/string.rs b/crates/shirabe-php-shim/src/string.rs
index e0c84836..d793082d 100644
--- a/crates/shirabe-php-shim/src/string.rs
+++ b/crates/shirabe-php-shim/src/string.rs
@@ -35,7 +35,7 @@ pub fn substr_count(haystack: &str, needle: &str) -> i64 {
}
// Byte-based, matching PHP's substr_replace.
-// TODO(phase-d): PHP accepts negative $start/$length (counting from the end); this signature takes
+// TODO(phase-c): PHP accepts negative $start/$length (counting from the end); this signature takes
// usize and therefore cannot express those cases.
pub fn substr_replace(string: &str, replace: &str, start: usize, length: usize) -> String {
let bytes = string.as_bytes();
@@ -833,7 +833,7 @@ fn php_to_float(v: &PhpMixed) -> f64 {
}
pub fn html_entity_decode(_s: &str) -> String {
- // TODO(phase-d): only numeric entities and the most common named entities (the HTML 4.01 markup
+ // TODO(phase-c): only numeric entities and the most common named entities (the HTML 4.01 markup
// set PHP enables by default) are decoded; the full named-entity table is not ported.
let chars: Vec<char> = _s.chars().collect();
let mut out = String::with_capacity(_s.len());
@@ -1031,7 +1031,7 @@ pub fn php_strip_whitespace(path: &str) -> String {
pub fn hexdec(_s: &str) -> i64 {
// PHP hexdec() ignores characters outside [0-9A-Fa-f].
- // TODO(phase-d): PHP promotes the result to float on overflow; this i64 return wraps instead.
+ // TODO(phase-c): PHP promotes the result to float on overflow; this i64 return wraps instead.
let mut acc: u64 = 0;
for &b in _s.as_bytes() {
let d = match b {
@@ -1134,7 +1134,7 @@ pub fn uniqid(_prefix: &str, _more_entropy: bool) -> String {
now.subsec_micros()
);
if _more_entropy {
- // TODO(phase-d): PHP uses its combined LCG; this uses `fastrand`, so the random suffix is
+ // TODO(phase-c): PHP uses its combined LCG; this uses `fastrand`, so the random suffix is
// not reproducible against PHP (it is non-deterministic in PHP too).
format!("{}.{:.8}", base, fastrand::f64() * 10.0)
} else {
diff --git a/crates/shirabe-php-shim/src/var.rs b/crates/shirabe-php-shim/src/var.rs
index dd0592f8..f611462a 100644
--- a/crates/shirabe-php-shim/src/var.rs
+++ b/crates/shirabe-php-shim/src/var.rs
@@ -52,14 +52,14 @@ fn serialize_into(out: &mut String, value: &PhpMixed) {
}
out.push('}');
}
- // TODO(phase-d): object serialization needs the PHP class name and the property
+ // TODO(php-runtime): object serialization needs the PHP class name and the property
// visibility name-mangling ("O:len:\"Class\":n:{...}"), which PhpMixed::Object does not
// carry.
PhpMixed::Object(_) => todo!(),
}
}
-// TODO(phase-d): PHP's serialize uses serialize_precision (-1 => shortest round-trip), which Rust's
+// TODO(phase-c): PHP's serialize uses serialize_precision (-1 => shortest round-trip), which Rust's
// default float formatting also produces, but the two differ on scientific-notation spelling (PHP
// "1.0E+20" vs Rust "1e20") for very large/small magnitudes.
fn serialize_float(f: f64) -> String {
@@ -124,7 +124,7 @@ pub fn is_callable(value: &PhpMixed) -> bool {
match value {
// Scalars and null are never callable in PHP.
PhpMixed::Null | PhpMixed::Bool(_) | PhpMixed::Int(_) | PhpMixed::Float(_) => false,
- // TODO(phase-d): PHP is_callable() checks whether a string names an existing function, or an
+ // TODO(php-runtime): PHP is_callable() checks whether a string names an existing function, or an
// array/object resolves to a method/__invoke. PhpMixed has no callable variant and the shim
// has no function/method registry, so callability of these cannot be determined.
_ => todo!(),
@@ -136,7 +136,7 @@ pub fn is_object(_value: &PhpMixed) -> bool {
}
pub fn is_a(_object_or_class: &PhpMixed, _class: &str, _allow_string: bool) -> bool {
- // TODO(phase-d): requires runtime class information (the object's class and its ancestry), which
+ // TODO(php-runtime): requires runtime class information (the object's class and its ancestry), which
// PhpMixed::Object does not carry.
todo!()
}
@@ -151,7 +151,7 @@ pub fn is_null(_value: &PhpMixed) -> bool {
pub fn is_iterable(value: &PhpMixed) -> bool {
// PHP is_iterable() is true for arrays and Traversable objects.
- // TODO(phase-d): PhpMixed::Object cannot report whether it implements Traversable, so an
+ // TODO(php-runtime): PhpMixed::Object cannot report whether it implements Traversable, so an
// iterable object is conservatively treated as non-iterable here.
matches!(value, PhpMixed::List(_) | PhpMixed::Array(_))
}
@@ -188,7 +188,7 @@ pub fn is_numeric_to_int(value: &PhpMixed) -> i64 {
/// Approximates PHP's `<=>` for two strings: if both are numeric strings, compare numerically
/// (as PHP does), otherwise fall back to a byte-wise comparison.
///
-/// TODO: this only covers the string/string case of PHP's loose comparison. PHP's `<=>` has many
+/// TODO(phase-c): this only covers the string/string case of PHP's loose comparison. PHP's `<=>` has many
/// more special-cased rules across other operand type combinations (bool, array, null, object,
/// numeric-string-vs-non-numeric-string, ...). Extend this if a new caller needs those.
pub fn loosely_compare(a: &str, b: &str) -> std::cmp::Ordering {
@@ -207,24 +207,24 @@ pub fn loosely_compare(a: &str, b: &str) -> std::cmp::Ordering {
}
pub fn instance_of<T>(_value: &PhpMixed) -> bool {
- // TODO(phase-d): PHP `instanceof` needs the runtime class of the value, which PhpMixed::Object
+ // TODO(php-runtime): PHP `instanceof` needs the runtime class of the value, which PhpMixed::Object
// does not carry.
todo!()
}
pub fn is_subclass_of(_object_or_class: &PhpMixed, _class_name: &str, _allow_string: bool) -> bool {
- // TODO(phase-d): requires runtime class ancestry, which PhpMixed::Object does not carry.
+ // TODO(php-runtime): requires runtime class ancestry, which PhpMixed::Object does not carry.
todo!()
}
pub fn get_class(_object: &PhpMixed) -> String {
- // TODO(phase-d): PhpMixed::Object carries no class name; there is no runtime class to report.
+ // TODO(php-runtime): PhpMixed::Object carries no class name; there is no runtime class to report.
todo!()
}
// Overload accepting an `anyhow::Error` (PHP's `get_class($e)` is commonly used on exceptions).
pub fn get_class_err(_e: &anyhow::Error) -> String {
- // TODO(phase-d): PHP returns the exception's class name. anyhow::Error carries the concrete
+ // TODO(phase-c): PHP returns the exception's class name. anyhow::Error carries the concrete
// exception type, but mapping each ported exception struct to its PHP class name is not yet
// wired up (cf. php_exception_get_code which downcasts case by case).
todo!()
@@ -234,7 +234,7 @@ pub fn get_class_err(_e: &anyhow::Error) -> String {
/// class name; in Rust we don't have a runtime class name, so this stub is left
/// as `todo!()`.
pub fn get_class_obj<T: ?Sized>(_object: &T) -> String {
- // TODO(phase-d): PHP returns the object's class name; Rust has no runtime class name for an
+ // TODO(php-runtime): PHP returns the object's class name; Rust has no runtime class name for an
// arbitrary `T` (the static type path is not the PHP class name).
todo!()
}
@@ -247,7 +247,7 @@ pub fn get_debug_type(value: &PhpMixed) -> String {
PhpMixed::Float(_) => "float".to_string(),
PhpMixed::String(_) => "string".to_string(),
PhpMixed::List(_) | PhpMixed::Array(_) => "array".to_string(),
- // TODO(phase-d): PHP returns the object's class name; PhpMixed::Object carries none.
+ // TODO(php-runtime): PHP returns the object's class name; PhpMixed::Object carries none.
PhpMixed::Object(_) => todo!(),
}
}
@@ -259,7 +259,7 @@ pub fn get_debug_type_obj<T>(_value: &T) -> String {
}
pub fn instantiate_class(_class: &str, _args: Vec<PhpMixed>) -> PhpMixed {
- // TODO(phase-d): instantiating a class by name needs a runtime class registry (reflection),
+ // TODO(php-runtime): instantiating a class by name needs a runtime class registry (reflection),
// which the shim does not provide.
todo!()
}
@@ -274,7 +274,7 @@ pub fn php_to_string(value: &PhpMixed) -> String {
PhpMixed::String(s) => s.clone(),
// PHP renders any array as the literal string "Array".
PhpMixed::List(_) | PhpMixed::Array(_) => "Array".to_string(),
- // TODO(phase-d): PHP casts an object to string via its __toString() method; PhpMixed::Object
+ // TODO(php-runtime): PHP casts an object to string via its __toString() method; PhpMixed::Object
// carries no class/method information to dispatch to.
PhpMixed::Object(_) => todo!(),
}
@@ -447,7 +447,7 @@ fn var_export_into(out: &mut String, value: &PhpMixed, level: usize) {
var_export_indent(out, level);
out.push(')');
}
- // TODO(phase-d): PHP renders objects as "\Class::__set_state(array(...))"; PhpMixed::Object
+ // TODO(php-runtime): PHP renders objects as "\Class::__set_state(array(...))"; PhpMixed::Object
// carries no class name.
PhpMixed::Object(_) => todo!(),
}
diff --git a/crates/shirabe-php-shim/src/zip.rs b/crates/shirabe-php-shim/src/zip.rs
index 93b65fd5..83dd70ce 100644
--- a/crates/shirabe-php-shim/src/zip.rs
+++ b/crates/shirabe-php-shim/src/zip.rs
@@ -248,7 +248,7 @@ impl ZipArchive {
}
pub fn set_external_attributes_name(&self, _name: &str, _opsys: i64, _attr: i64) -> bool {
- // TODO(phase-d): PHP's setExternalAttributesName mutates an already-added
+ // TODO(phase-c): PHP's setExternalAttributesName mutates an already-added
// entry's external attributes (e.g. Unix permissions) after addFile. The
// `zip` crate fixes external attributes at start_file time via FileOptions
// and exposes no API to amend a written entry, so this cannot be faithfully