aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-17 09:59:32 +0900
committernsfisis <nsfisis@gmail.com>2026-05-17 09:59:40 +0900
commite85c1c6c86a42b9aee5687b943743520fc677844 (patch)
tree3cffb2b29c77e9558190b8ed8d063f6f582e5280
parent8fb6de392bbac104c07a5cdbac12a4fd25ab1127 (diff)
downloadphp-shirabe-e85c1c6c86a42b9aee5687b943743520fc677844.tar.gz
php-shirabe-e85c1c6c86a42b9aee5687b943743520fc677844.tar.zst
php-shirabe-e85c1c6c86a42b9aee5687b943743520fc677844.zip
fix(php-shim): add missing stub functions, constants, and types
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
-rw-r--r--crates/shirabe-php-shim/src/lib.rs253
-rw-r--r--crates/shirabe/src/config/json_config_source.rs5
-rw-r--r--crates/shirabe/src/downloader/file_downloader.rs8
-rw-r--r--crates/shirabe/src/json/json_file.rs9
-rw-r--r--crates/shirabe/src/repository/filesystem_repository.rs9
-rw-r--r--crates/shirabe/src/repository/package_repository.rs2
-rw-r--r--crates/shirabe/src/util/http_downloader.rs3
7 files changed, 273 insertions, 16 deletions
diff --git a/crates/shirabe-php-shim/src/lib.rs b/crates/shirabe-php-shim/src/lib.rs
index 4b4d719..001e6f6 100644
--- a/crates/shirabe-php-shim/src/lib.rs
+++ b/crates/shirabe-php-shim/src/lib.rs
@@ -1780,3 +1780,256 @@ pub fn is_readable(path: &str) -> bool {
pub fn stream_get_wrappers() -> Vec<String> {
todo!()
}
+
+pub fn php_require(file: &str) -> PhpMixed {
+ todo!()
+}
+
+pub fn intval(value: &PhpMixed) -> i64 {
+ todo!()
+}
+
+#[derive(Debug)]
+pub struct RecursiveDirectoryIterator;
+
+impl RecursiveDirectoryIterator {
+ pub const SKIP_DOTS: i64 = 4096;
+ pub const FOLLOW_SYMLINKS: i64 = 512;
+}
+
+#[derive(Debug)]
+pub struct RecursiveIteratorIterator;
+
+impl RecursiveIteratorIterator {
+ pub const SELF_FIRST: i64 = 0;
+ pub const CHILD_FIRST: i64 = 16;
+}
+
+pub fn recursive_directory_iterator(path: &str, flags: i64) -> RecursiveDirectoryIterator {
+ todo!()
+}
+
+pub fn recursive_iterator_iterator(
+ iter: RecursiveDirectoryIterator,
+ mode: i64,
+) -> RecursiveIteratorIterator {
+ todo!()
+}
+
+pub fn globals_get(name: &str) -> PhpMixed {
+ todo!()
+}
+
+pub fn globals_set(name: &str, value: PhpMixed) {
+ todo!()
+}
+
+pub fn clone<T: Clone>(value: T) -> T {
+ todo!()
+}
+
+pub fn date_default_timezone_get() -> String {
+ todo!()
+}
+
+pub fn date_default_timezone_set(tz: &str) -> bool {
+ todo!()
+}
+
+pub fn getmypid() -> i64 {
+ todo!()
+}
+
+pub fn ini_set(varname: &str, value: &str) -> Option<String> {
+ todo!()
+}
+
+pub fn is_subclass_of(object_or_class: &PhpMixed, class_name: &str, allow_string: bool) -> bool {
+ todo!()
+}
+
+pub fn memory_get_peak_usage(real_usage: bool) -> i64 {
+ todo!()
+}
+
+pub fn register_shutdown_function(callback: Box<dyn Fn()>) {
+ todo!()
+}
+
+pub fn round(value: f64, precision: i64) -> f64 {
+ todo!()
+}
+
+pub fn stdin_handle() -> PhpMixed {
+ todo!()
+}
+
+pub fn composer_dev_warning_time() -> i64 {
+ todo!()
+}
+
+pub fn instantiate_class(class: &str, args: Vec<PhpMixed>) -> PhpMixed {
+ todo!()
+}
+
+pub fn array_filter_use_key(
+ array: &IndexMap<String, PhpMixed>,
+ callback: Box<dyn Fn(&str) -> bool>,
+) -> IndexMap<String, PhpMixed> {
+ todo!()
+}
+
+pub fn escapeshellcmd(command: &str) -> String {
+ todo!()
+}
+
+pub fn system(command: &str, result_code: Option<&mut i64>) -> Option<String> {
+ todo!()
+}
+
+pub fn array_chunk<T: Clone>(array: &[T], size: i64, preserve_keys: bool) -> Vec<Vec<T>> {
+ todo!()
+}
+
+pub fn number_format(
+ number: f64,
+ decimals: i64,
+ decimal_separator: &str,
+ thousands_separator: &str,
+) -> String {
+ todo!()
+}
+
+pub fn is_executable(path: &str) -> bool {
+ todo!()
+}
+
+pub fn gc_collect_cycles() -> i64 {
+ todo!()
+}
+
+pub fn gc_disable() {
+ todo!()
+}
+
+pub fn gc_enable() {
+ todo!()
+}
+
+pub fn addcslashes(string: &str, charlist: &str) -> String {
+ todo!()
+}
+
+pub fn strnatcmp(s1: &str, s2: &str) -> i64 {
+ todo!()
+}
+
+pub fn uksort<V, F>(array: &mut IndexMap<String, V>, callback: F)
+where
+ F: FnMut(&str, &str) -> i64,
+{
+ todo!()
+}
+
+pub fn end<V: Clone>(array: &[V]) -> Option<V> {
+ todo!()
+}
+
+pub fn fileatime(filename: &str) -> Option<i64> {
+ todo!()
+}
+
+pub fn fread(handle: PhpMixed, length: i64) -> Option<String> {
+ todo!()
+}
+
+pub fn lstat(filename: &str) -> Option<IndexMap<String, Box<PhpMixed>>> {
+ todo!()
+}
+
+pub fn react_promise_resolve(value: PhpMixed) -> PhpMixed {
+ todo!()
+}
+
+pub fn symlink(target: &str, link: &str) -> bool {
+ todo!()
+}
+
+pub fn array_diff_key(
+ array1: IndexMap<String, PhpMixed>,
+ array2: &IndexMap<String, PhpMixed>,
+) -> IndexMap<String, PhpMixed> {
+ todo!()
+}
+
+pub fn min(a: i64, b: i64) -> i64 {
+ todo!()
+}
+
+pub fn escapeshellarg(arg: &str) -> String {
+ todo!()
+}
+
+pub fn strcspn(string: &str, characters: &str) -> usize {
+ todo!()
+}
+
+pub fn strstr(haystack: &str, needle: &str) -> Option<String> {
+ todo!()
+}
+
+pub fn ioncube_loader_iversion() -> i64 {
+ todo!()
+}
+
+pub fn ioncube_loader_version() -> String {
+ todo!()
+}
+
+pub fn phpinfo(what: i64) {
+ todo!()
+}
+
+pub fn opendir(path: &str) -> Option<PhpMixed> {
+ todo!()
+}
+
+pub fn stream_copy_to_stream(source: PhpMixed, dest: PhpMixed) -> Option<i64> {
+ todo!()
+}
+
+pub const SKIP_DOTS: i64 = 4096;
+pub const CHILD_FIRST: i64 = 16;
+pub const SELF_FIRST: i64 = 0;
+pub const CURL_VERSION_ZSTD: i64 = 8388608;
+pub const INFO_GENERAL: i64 = 1;
+pub const OPENSSL_VERSION_NUMBER: i64 = 0;
+pub const OPENSSL_VERSION_TEXT: &str = "";
+pub const PHP_BINARY: &str = "";
+pub const PHP_WINDOWS_VERSION_BUILD: i64 = 0;
+pub const DATE_RFC3339: &str = "Y-m-d\\TH:i:sP";
+pub const PREG_BACKTRACK_LIMIT_ERROR: i64 = 2;
+
+#[derive(Debug)]
+pub struct ArrayObject {
+ data: IndexMap<String, Box<PhpMixed>>,
+}
+
+impl ArrayObject {
+ pub fn new(array: Option<PhpMixed>) -> Self {
+ todo!()
+ }
+}
+
+#[derive(Debug)]
+pub struct JsonObject {
+ data: IndexMap<String, Box<PhpMixed>>,
+}
+
+#[derive(Debug)]
+pub struct StdClass {
+ pub data: IndexMap<String, Box<PhpMixed>>,
+}
+
+#[derive(Debug)]
+pub struct PhpResource;
diff --git a/crates/shirabe/src/config/json_config_source.rs b/crates/shirabe/src/config/json_config_source.rs
index 5dc5e8d..4575123 100644
--- a/crates/shirabe/src/config/json_config_source.rs
+++ b/crates/shirabe/src/config/json_config_source.rs
@@ -3,9 +3,10 @@
use anyhow::Result;
use indexmap::IndexMap;
use shirabe_php_shim::{
- PHP_EOL, PhpMixed, RuntimeException, Silencer, array_unshift, call_user_func_array, chmod,
- explode, file_get_contents, file_put_contents, implode, is_writable, sprintf,
+ PHP_EOL, PhpMixed, RuntimeException, array_unshift, call_user_func_array, chmod, explode,
+ file_get_contents, file_put_contents, implode, is_writable, sprintf,
};
+use crate::util::silencer::Silencer;
use crate::config::config_source_interface::ConfigSourceInterface;
use crate::json::json_file::JsonFile;
diff --git a/crates/shirabe/src/downloader/file_downloader.rs b/crates/shirabe/src/downloader/file_downloader.rs
index 5b002ff..47c216a 100644
--- a/crates/shirabe/src/downloader/file_downloader.rs
+++ b/crates/shirabe/src/downloader/file_downloader.rs
@@ -8,11 +8,11 @@ use shirabe_external_packages::react::promise::promise_interface::PromiseInterfa
use shirabe_external_packages::react::promise::resolve as react_promise_resolve;
use shirabe_php_shim::{
DIRECTORY_SEPARATOR, InvalidArgumentException, PATHINFO_BASENAME, PATHINFO_EXTENSION,
- PHP_URL_PATH, PhpMixed, RuntimeException, Silencer, UnexpectedValueException, array_search,
- array_shift, file_exists, filesize, get_class, hash, hash_file, in_array, is_dir,
- is_executable, parse_url, pathinfo, realpath, rtrim, spl_object_hash, strlen, strpos, strtr,
- trim, umask, usleep,
+ PHP_URL_PATH, PhpMixed, RuntimeException, UnexpectedValueException, array_search, array_shift,
+ file_exists, filesize, get_class, hash, hash_file, in_array, is_dir, is_executable, parse_url,
+ pathinfo, realpath, rtrim, spl_object_hash, strlen, strpos, strtr, trim, umask, usleep,
};
+use crate::util::silencer::Silencer;
use crate::cache::Cache;
use crate::config::Config;
diff --git a/crates/shirabe/src/json/json_file.rs b/crates/shirabe/src/json/json_file.rs
index cdb9ba7..92c3428 100644
--- a/crates/shirabe/src/json/json_file.rs
+++ b/crates/shirabe/src/json/json_file.rs
@@ -8,11 +8,12 @@ use shirabe_external_packages::seld::json_lint::parsing_exception::ParsingExcept
use shirabe_php_shim::{
InvalidArgumentException, JSON_ERROR_CTRL_CHAR, JSON_ERROR_DEPTH, JSON_ERROR_NONE,
JSON_ERROR_STATE_MISMATCH, JSON_ERROR_UTF8, JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES,
- JSON_UNESCAPED_UNICODE, PhpMixed, RuntimeException, Silencer, UnexpectedValueException,
- defined, dirname, file_exists, file_get_contents, file_put_contents, is_dir, is_file,
- json_decode, json_encode_ex, json_last_error, mkdir, php_dir, realpath, str_contains,
- str_ends_with, str_repeat, strlen, strpos, usleep,
+ JSON_UNESCAPED_UNICODE, PhpMixed, RuntimeException, UnexpectedValueException, defined, dirname,
+ file_exists, file_get_contents, file_put_contents, is_dir, is_file, json_decode, json_encode_ex,
+ json_last_error, mkdir, php_dir, realpath, str_contains, str_ends_with, str_repeat, strlen,
+ strpos, usleep,
};
+use crate::util::silencer::Silencer;
use crate::downloader::transport_exception::TransportException;
use crate::io::io_interface::IOInterface;
diff --git a/crates/shirabe/src/repository/filesystem_repository.rs b/crates/shirabe/src/repository/filesystem_repository.rs
index 4ca5ab1..374c8e9 100644
--- a/crates/shirabe/src/repository/filesystem_repository.rs
+++ b/crates/shirabe/src/repository/filesystem_repository.rs
@@ -6,11 +6,12 @@ use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::preg::Preg;
use shirabe_php_shim::{
- InvalidArgumentException, LogicException, PhpMixed, SORT_NATURAL, Silencer,
- UnexpectedValueException, array_flip, dirname, r#eval, file_get_contents, get_class,
- get_debug_type, in_array, is_array, is_int, is_null, is_string, ksort, php_dir, realpath, sort,
- sort_with_flags, str_repeat, strtr, trim, usort, var_export,
+ InvalidArgumentException, LogicException, PhpMixed, SORT_NATURAL, UnexpectedValueException,
+ array_flip, dirname, r#eval, file_get_contents, get_class, get_debug_type, in_array, is_array,
+ is_int, is_null, is_string, ksort, php_dir, realpath, sort, sort_with_flags, str_repeat, strtr,
+ trim, usort, var_export,
};
+use crate::util::silencer::Silencer;
use crate::installed_versions::InstalledVersions;
use crate::installer::installation_manager::InstallationManager;
diff --git a/crates/shirabe/src/repository/package_repository.rs b/crates/shirabe/src/repository/package_repository.rs
index 7bdf95f..f11af06 100644
--- a/crates/shirabe/src/repository/package_repository.rs
+++ b/crates/shirabe/src/repository/package_repository.rs
@@ -12,7 +12,7 @@ use crate::repository::array_repository::ArrayRepository;
use crate::repository::invalid_repository_exception::InvalidRepositoryException;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::preg::Preg;
-use shirabe_php_shim::{Exception, PhpMixed};
+use shirabe_php_shim::{Exception, PhpMixed, RuntimeException, var_export};
use shirabe_semver::constraint::constraint_interface::ConstraintInterface;
#[derive(Debug)]
diff --git a/crates/shirabe/src/util/http_downloader.rs b/crates/shirabe/src/util/http_downloader.rs
index eb28ca0..5786da3 100644
--- a/crates/shirabe/src/util/http_downloader.rs
+++ b/crates/shirabe/src/util/http_downloader.rs
@@ -7,10 +7,11 @@ use shirabe_external_packages::composer::pcre::preg::Preg;
use shirabe_external_packages::react::promise::promise::Promise;
use shirabe_external_packages::react::promise::promise_interface::PromiseInterface;
use shirabe_php_shim::{
- InvalidArgumentException, LogicException, PhpMixed, Silencer, array_replace_recursive, chr,
+ InvalidArgumentException, LogicException, PhpMixed, array_replace_recursive, chr,
extension_loaded, file_get_contents, function_exists, implode, is_numeric, max, min,
rawurldecode, stream_context_create, stripos, strpos, substr, ucfirst,
};
+use crate::util::silencer::Silencer;
use shirabe_semver::constraint::constraint::Constraint;
use crate::composer::Composer;