aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-class-map-generator
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-12 06:29:43 +0900
committernsfisis <nsfisis@gmail.com>2026-08-15 09:19:39 +0900
commitbb4684f7d1c51bc1be9c1bda1b00cb52c839cd25 (patch)
tree18fcdf1f9c9c64fc68e08bd5fab132808ca1cfcf /crates/shirabe-class-map-generator
parent9e5bb3e4253dda96345f4d1a3421077a72295048 (diff)
downloadphp-shirabe-bb4684f7d1c51bc1be9c1bda1b00cb52c839cd25.tar.gz
php-shirabe-bb4684f7d1c51bc1be9c1bda1b00cb52c839cd25.tar.zst
php-shirabe-bb4684f7d1c51bc1be9c1bda1b00cb52c839cd25.zip
feat(php-shim): drop the modelled PHP version constants
The shim reported a fixed PHP 8.1.0 through PHP_VERSION, PHP_VERSION_ID, the major/minor/release triple and the PHP_WINDOWS_VERSION_* trio. Their uses split in two. Some guarded branches PHP only needs on runtimes this port cannot be: proc_get_status reports the exit status on every call, so Symfony's pre-8.3 exit-code cache has nothing to work around; hash_raw and hash_file always offer xxh3, so the sha1 fallback is unreachable; and http_get_last_response_headers is always available, so the pre-8.4 $http_response_header branch is gone. safeJunctions reads the host Windows version rather than PHP state, and joins the Windows work on hold. The rest ask about the PHP the user actually runs, and now reach the worker through a new php-rpc PhpVersion payload: the startup banner and the 7.2.5 warning, self-update's min-php filter, the ext-* recommendation in VersionSelector, the stream User-Agent, and whether PhpFileParser scans for enums. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-class-map-generator')
-rw-r--r--crates/shirabe-class-map-generator/Cargo.toml1
-rw-r--r--crates/shirabe-class-map-generator/src/php_file_parser.rs11
2 files changed, 6 insertions, 6 deletions
diff --git a/crates/shirabe-class-map-generator/Cargo.toml b/crates/shirabe-class-map-generator/Cargo.toml
index b34a1406..4d66ac00 100644
--- a/crates/shirabe-class-map-generator/Cargo.toml
+++ b/crates/shirabe-class-map-generator/Cargo.toml
@@ -9,6 +9,7 @@ license.workspace = true
[dependencies]
shirabe-pcre.workspace = true
+shirabe-php-rpc.workspace = true
shirabe-php-shim.workspace = true
shirabe-symfony-finder.workspace = true
anyhow.workspace = true
diff --git a/crates/shirabe-class-map-generator/src/php_file_parser.rs b/crates/shirabe-class-map-generator/src/php_file_parser.rs
index f71b993a..0c82a558 100644
--- a/crates/shirabe-class-map-generator/src/php_file_parser.rs
+++ b/crates/shirabe-class-map-generator/src/php_file_parser.rs
@@ -4,8 +4,8 @@ use crate::php_file_cleaner::PhpFileCleaner;
use indexmap::IndexMap;
use shirabe_pcre::{CaptureKey, Preg};
use shirabe_php_shim::{
- PHP_EOL, PHP_VERSION_ID, RuntimeException, file_exists, file_get_contents, function_exists,
- is_file, is_readable, ltrim, php_strip_whitespace, str_replace_array, strrpos, substr, trim,
+ PHP_EOL, RuntimeException, file_exists, file_get_contents, function_exists, is_file,
+ is_readable, ltrim, php_strip_whitespace, str_replace_array, strrpos, substr, trim,
};
use std::sync::OnceLock;
@@ -176,10 +176,9 @@ impl PhpFileParser {
EXTRA_TYPES.get_or_init(|| {
let mut extra_types = String::new();
let mut extra_types_array: Vec<String> = vec![];
- // TODO(php-runtime): whether `enum` is scanned for belongs to the runtime that loads
- // the generated class map, i.e. the worker, while PHP_VERSION_ID is the version this
- // build models. PHP also scans for enums on HHVM 3.3 and above.
- if PHP_VERSION_ID >= 80100 {
+ // TODO(port): PHP also scans for enums on HHVM 3.3 and above
+ // (`defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')`).
+ if shirabe_php_rpc::get_php_version().version_id >= 80100 {
extra_types += "|enum";
extra_types_array = vec!["enum".to_string()];
}