aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/shirabe-class-map-generator/src/php_file_parser.rs13
-rw-r--r--crates/shirabe-php-shim/src/runtime.rs4
-rw-r--r--crates/shirabe/src/autoload/class_loader.rs12
-rw-r--r--crates/shirabe/src/console/application.rs8
-rw-r--r--crates/shirabe/src/dependency_resolver/problem.rs11
-rw-r--r--crates/shirabe/src/platform/hhvm_detector.rs8
-rw-r--r--crates/shirabe/src/util/stream_context_factory.rs17
7 files changed, 25 insertions, 48 deletions
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 ac0c8f1c..f71b993a 100644
--- a/crates/shirabe-class-map-generator/src/php_file_parser.rs
+++ b/crates/shirabe-class-map-generator/src/php_file_parser.rs
@@ -4,9 +4,8 @@ use crate::php_file_cleaner::PhpFileCleaner;
use indexmap::IndexMap;
use shirabe_pcre::{CaptureKey, Preg};
use shirabe_php_shim::{
- CmpOp, HHVM_VERSION, 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, version_compare,
+ 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,
};
use std::sync::OnceLock;
@@ -177,10 +176,10 @@ impl PhpFileParser {
EXTRA_TYPES.get_or_init(|| {
let mut extra_types = String::new();
let mut extra_types_array: Vec<String> = vec![];
- if PHP_VERSION_ID >= 80100
- || (HHVM_VERSION.is_some()
- && version_compare(HHVM_VERSION.unwrap(), "3.3", CmpOp::Ge))
- {
+ // 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 {
extra_types += "|enum";
extra_types_array = vec!["enum".to_string()];
}
diff --git a/crates/shirabe-php-shim/src/runtime.rs b/crates/shirabe-php-shim/src/runtime.rs
index 74ea8350..254a2fe9 100644
--- a/crates/shirabe-php-shim/src/runtime.rs
+++ b/crates/shirabe-php-shim/src/runtime.rs
@@ -13,8 +13,6 @@ pub const PHP_WINDOWS_VERSION_MAJOR: i64 = 0;
pub const PHP_WINDOWS_VERSION_MINOR: i64 = 0;
pub const PHP_WINDOWS_VERSION_BUILD: i64 = 0;
-pub const HHVM_VERSION: Option<&str> = None;
-
pub const E_ALL: i64 = 32767;
pub const E_WARNING: i64 = 2;
pub const E_NOTICE: i64 = 8;
@@ -40,7 +38,7 @@ pub const PHP_OS: &str = match std::env::consts::OS.as_bytes() {
// Models the constants defined in a standard modern PHP CLI environment on a
// non-Windows platform with the common extensions loaded (curl, openssl, json).
-// Windows-only, HHVM and Composer-bootstrap constants are reported undefined.
+// Windows-only and Composer-bootstrap constants are reported undefined.
pub fn defined(name: &str) -> bool {
matches!(
name,
diff --git a/crates/shirabe/src/autoload/class_loader.rs b/crates/shirabe/src/autoload/class_loader.rs
index 2d888ecf..de03201a 100644
--- a/crates/shirabe/src/autoload/class_loader.rs
+++ b/crates/shirabe/src/autoload/class_loader.rs
@@ -3,7 +3,7 @@
use indexmap::IndexMap;
use shirabe_php_rpc::stream_resolve_include_path;
use shirabe_php_shim::{
- InvalidArgumentException, PhpMixed, defined, file_exists, include_file, spl_autoload_register,
+ InvalidArgumentException, PhpMixed, file_exists, include_file, spl_autoload_register,
spl_autoload_unregister, strlen, strpos, strrpos, strtr, substr,
};
use std::sync::{LazyLock, Mutex};
@@ -340,12 +340,10 @@ impl ClassLoader {
// No-op; APCu is not available in Rust.
}
- let mut file = self.find_file_with_extension(class, ".php");
-
- // Search for Hack files if we are running on HHVM
- if file.is_none() && defined("HHVM_VERSION") {
- file = self.find_file_with_extension(class, ".hh");
- }
+ // TODO(php-runtime): PHP also looks for a Hack file (`.hh`) when it runs on HHVM. Only the
+ // worker, which is the runtime that includes the file, can answer whether it is HHVM, and
+ // asking boots it, while this lookup is what decides whether it is needed at all.
+ let file = self.find_file_with_extension(class, ".php");
if let Some(apcu_prefix) = &self.apcu_prefix {
// No-op; APCu is not available in Rust.
diff --git a/crates/shirabe/src/console/application.rs b/crates/shirabe/src/console/application.rs
index b18eaa02..fa9f7edd 100644
--- a/crates/shirabe/src/console/application.rs
+++ b/crates/shirabe/src/console/application.rs
@@ -2259,14 +2259,10 @@ impl ApplicationHandle {
if !is_proxy_command {
io.write_error3(
&format!(
- "Running {} ({}) with {} on {}",
+ "Running {} ({}) with PHP {} on {}",
composer::get_version(),
composer::RELEASE_DATE,
- (if defined("HHVM_VERSION") {
- format!("HHVM {}", shirabe_php_shim::HHVM_VERSION.unwrap_or(""))
- } else {
- format!("PHP {}", PHP_VERSION)
- }),
+ PHP_VERSION,
(if function_exists("php_uname") {
format!("{} / {}", php_uname("s"), php_uname("r"))
} else {
diff --git a/crates/shirabe/src/dependency_resolver/problem.rs b/crates/shirabe/src/dependency_resolver/problem.rs
index 4510b125..1da6028c 100644
--- a/crates/shirabe/src/dependency_resolver/problem.rs
+++ b/crates/shirabe/src/dependency_resolver/problem.rs
@@ -12,9 +12,9 @@ use crate::repository::RepositorySet;
use indexmap::IndexMap;
use shirabe_pcre::{CaptureKey, Preg};
use shirabe_php_shim::{
- CmpOp, LogicException, PhpMixed, defined, extension_loaded, implode, loosely_compare,
- php_regex, spl_object_hash, sprintf, str_replace, stripos, strpos, strtolower, substr,
- substr_count, version_compare,
+ CmpOp, LogicException, PhpMixed, extension_loaded, implode, loosely_compare, php_regex,
+ spl_object_hash, sprintf, str_replace, stripos, strpos, strtolower, substr, substr_count,
+ version_compare,
};
use shirabe_semver::constraint::AnyConstraint;
use shirabe_semver::constraint::MultiConstraint;
@@ -398,10 +398,7 @@ impl Problem {
Self::constraint_to_text(constraint)
);
- if defined("HHVM_VERSION")
- || (package_name == "hhvm"
- && !pool.what_provides(package_name, None).is_empty())
- {
+ if package_name == "hhvm" && !pool.what_provides(package_name, None).is_empty() {
return Ok((
msg,
"your HHVM version does not satisfy that requirement.".to_string(),
diff --git a/crates/shirabe/src/platform/hhvm_detector.rs b/crates/shirabe/src/platform/hhvm_detector.rs
index 26fb5e12..a80b9028 100644
--- a/crates/shirabe/src/platform/hhvm_detector.rs
+++ b/crates/shirabe/src/platform/hhvm_detector.rs
@@ -2,7 +2,6 @@
use crate::util::Platform;
use crate::util::ProcessExecutor;
-use shirabe_php_shim::{HHVM_VERSION, defined};
use shirabe_symfony_process::ExecutableFinder;
use std::sync::Mutex;
@@ -47,13 +46,8 @@ impl HhvmDetectorInterface for HhvmDetector {
}
let mut cache = HHVM_VERSION_CACHE.lock().unwrap();
- *cache = Some(if defined("HHVM_VERSION") {
- HHVM_VERSION.map(|s| s.to_string())
- } else {
- None
- });
- if cache.as_ref().unwrap().is_none() && !Platform::is_windows() {
+ if !Platform::is_windows() {
*cache = Some(None);
let finder = self
.executable_finder
diff --git a/crates/shirabe/src/util/stream_context_factory.rs b/crates/shirabe/src/util/stream_context_factory.rs
index 6a63537d..7706a5cd 100644
--- a/crates/shirabe/src/util/stream_context_factory.rs
+++ b/crates/shirabe/src/util/stream_context_factory.rs
@@ -9,9 +9,8 @@ use crate::util::http::ProxyManager;
use indexmap::IndexMap;
use shirabe_ca_bundle::CaBundle;
use shirabe_php_shim::{
- HHVM_VERSION, PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION, PhpMixed,
- array_replace_recursive, extension_loaded, function_exists, php_uname, stream_context_create,
- stripos, uasort,
+ PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION, PhpMixed, array_replace_recursive,
+ extension_loaded, function_exists, php_uname, stream_context_create, stripos, uasort,
};
pub struct StreamContextFactory;
@@ -148,14 +147,10 @@ impl StreamContextFactory {
}
}
- let php_version = if HHVM_VERSION.is_some() {
- format!("HHVM {}", HHVM_VERSION.unwrap())
- } else {
- format!(
- "PHP {}.{}.{}",
- PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION
- )
- };
+ let php_version = format!(
+ "PHP {}.{}.{}",
+ PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION
+ );
let http_version = if for_curl {
// PHP reports `cURL <version>` here. Shirabe's "curl" transport is backed by reqwest,