diff options
Diffstat (limited to 'crates/shirabe')
| -rw-r--r-- | crates/shirabe/src/autoload/class_loader.rs | 12 | ||||
| -rw-r--r-- | crates/shirabe/src/console/application.rs | 8 | ||||
| -rw-r--r-- | crates/shirabe/src/dependency_resolver/problem.rs | 11 | ||||
| -rw-r--r-- | crates/shirabe/src/platform/hhvm_detector.rs | 8 | ||||
| -rw-r--r-- | crates/shirabe/src/util/stream_context_factory.rs | 17 |
5 files changed, 18 insertions, 38 deletions
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, |
