From 3a388b98a9aa6a14b1c7f7dc909c109cf9837800 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 16 Aug 2026 00:59:54 +0900 Subject: refactor: narrow pub(crate) items to private Porting mapped every PHP `protected` member onto `pub(crate)`, which is wider than nearly all of them need. Each item demoted here is reached only from the module that defines it, so the crate-wide visibility conveyed nothing. Every `pub(crate)` that survives has at least one reader in another module of the same crate. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/src/autoload/autoload_generator.rs | 32 +++----- crates/shirabe/src/cache.rs | 2 +- crates/shirabe/src/command/base_command.rs | 10 +-- crates/shirabe/src/command/config_command.rs | 13 ++-- .../shirabe/src/command/create_project_command.rs | 2 +- crates/shirabe/src/command/diagnose_command.rs | 8 +- crates/shirabe/src/command/init_command.rs | 13 ++-- crates/shirabe/src/command/show_command.rs | 34 ++++----- crates/shirabe/src/console/application.rs | 12 ++- crates/shirabe/src/console/github_action_error.rs | 2 +- crates/shirabe/src/console/input.rs | 4 +- .../shirabe/src/dependency_resolver/decisions.rs | 6 +- .../src/dependency_resolver/default_policy.rs | 12 +-- .../src/dependency_resolver/generic_rule.rs | 2 +- .../src/dependency_resolver/lock_transaction.rs | 6 +- .../src/dependency_resolver/multi_conflict_rule.rs | 2 +- .../operation/install_operation.rs | 2 +- .../operation/mark_alias_installed_operation.rs | 2 +- .../operation/mark_alias_uninstalled_operation.rs | 2 +- .../operation/uninstall_operation.rs | 2 +- .../operation/update_operation.rs | 4 +- crates/shirabe/src/dependency_resolver/pool.rs | 14 ++-- crates/shirabe/src/dependency_resolver/problem.rs | 10 +-- crates/shirabe/src/dependency_resolver/request.rs | 14 ++-- crates/shirabe/src/dependency_resolver/rule.rs | 6 +- crates/shirabe/src/dependency_resolver/rule_set.rs | 6 +- .../src/dependency_resolver/rule_set_generator.rs | 18 ++--- .../src/dependency_resolver/rule_set_iterator.rs | 10 +-- .../src/dependency_resolver/rule_watch_graph.rs | 4 +- .../src/dependency_resolver/rule_watch_node.rs | 2 +- crates/shirabe/src/dependency_resolver/solver.rs | 24 +++--- .../solver_problems_exception.rs | 4 +- .../shirabe/src/dependency_resolver/transaction.rs | 14 ++-- crates/shirabe/src/downloader/download_manager.rs | 7 +- crates/shirabe/src/downloader/file_downloader.rs | 6 +- crates/shirabe/src/downloader/git_downloader.rs | 16 ++-- crates/shirabe/src/downloader/path_downloader.rs | 4 +- .../shirabe/src/downloader/perforce_downloader.rs | 2 +- crates/shirabe/src/downloader/svn_downloader.rs | 6 +- .../shirabe/src/downloader/transport_exception.rs | 8 +- crates/shirabe/src/event_dispatcher/event.rs | 6 +- .../src/event_dispatcher/event_dispatcher.rs | 12 +-- crates/shirabe/src/installer.rs | 88 +++++++++++----------- crates/shirabe/src/installer/binary_installer.rs | 20 ++--- crates/shirabe/src/installer/library_installer.rs | 23 +++--- crates/shirabe/src/io/console_io.rs | 4 +- crates/shirabe/src/json.rs | 2 +- crates/shirabe/src/json/json_file.rs | 2 +- crates/shirabe/src/json/json_manipulator.rs | 2 +- .../shirabe/src/json/json_validation_exception.rs | 2 +- crates/shirabe/src/package/alias_package.rs | 12 +-- .../package/archiver/archivable_files_finder.rs | 2 +- .../src/package/archiver/archive_manager.rs | 8 +- crates/shirabe/src/package/complete_package.rs | 24 +++--- crates/shirabe/src/package/link.rs | 10 +-- crates/shirabe/src/package/loader/array_loader.rs | 2 +- crates/shirabe/src/package/package.rs | 66 ++++++++-------- crates/shirabe/src/package/root_package.rs | 12 +-- crates/shirabe/src/plugin/php_plugin_proxy.rs | 14 ++-- crates/shirabe/src/plugin/plugin_manager.rs | 18 ++--- crates/shirabe/src/repository/array_repository.rs | 4 +- .../shirabe/src/repository/artifact_repository.rs | 6 +- .../shirabe/src/repository/composer_repository.rs | 28 +++---- .../src/repository/filesystem_repository.rs | 2 +- crates/shirabe/src/repository/path_repository.rs | 2 +- .../shirabe/src/repository/platform_repository.rs | 14 ++-- crates/shirabe/src/repository/repository_set.rs | 14 ++-- .../shirabe/src/repository/vcs/forgejo_driver.rs | 14 ++-- crates/shirabe/src/repository/vcs/fossil_driver.rs | 16 ++-- .../src/repository/vcs/git_bitbucket_driver.rs | 8 +- crates/shirabe/src/repository/vcs/github_driver.rs | 34 ++++----- crates/shirabe/src/repository/vcs/gitlab_driver.rs | 25 +++--- crates/shirabe/src/repository/vcs/hg_driver.rs | 10 +-- .../shirabe/src/repository/vcs/perforce_driver.rs | 6 +- crates/shirabe/src/repository/vcs/svn_driver.rs | 28 +++---- crates/shirabe/src/repository/vcs_repository.rs | 28 +++---- crates/shirabe/src/util/auth_helper.rs | 4 +- crates/shirabe/src/util/filesystem.rs | 8 +- crates/shirabe/src/util/git.rs | 10 +-- crates/shirabe/src/util/gitlab.rs | 8 +- crates/shirabe/src/util/no_proxy_pattern.rs | 17 ++--- crates/shirabe/src/util/perforce.rs | 44 +++++------ crates/shirabe/src/util/process_executor.rs | 6 +- crates/shirabe/src/util/svn.rs | 35 ++++----- 84 files changed, 502 insertions(+), 545 deletions(-) (limited to 'crates/shirabe/src') diff --git a/crates/shirabe/src/autoload/autoload_generator.rs b/crates/shirabe/src/autoload/autoload_generator.rs index 10f76536..0f7fe22a 100644 --- a/crates/shirabe/src/autoload/autoload_generator.rs +++ b/crates/shirabe/src/autoload/autoload_generator.rs @@ -801,7 +801,7 @@ return array( } /// Throws InvalidArgumentException if the package has illegal settings. - pub(crate) fn validate_package(&self, package: PackageInterfaceHandle) -> anyhow::Result<()> { + fn validate_package(&self, package: PackageInterfaceHandle) -> anyhow::Result<()> { let autoload = package.get_autoload(); if autoload .get("psr-4") @@ -968,7 +968,7 @@ return array( loader } - pub(crate) fn get_include_paths_file( + fn get_include_paths_file( &self, package_map: &Vec<(PackageInterfaceHandle, Option)>, filesystem: &Filesystem, @@ -1033,7 +1033,7 @@ return array( )) } - pub(crate) fn get_include_files_file( + fn get_include_files_file( &self, files: &IndexMap, filesystem: &Filesystem, @@ -1103,7 +1103,7 @@ return array( )) } - pub(crate) fn get_path_code( + fn get_path_code( &self, filesystem: &Filesystem, base_path: &str, @@ -1137,7 +1137,7 @@ return array( format!("{}{}", base_dir, var_export(&PhpMixed::String(path), true)) } - pub(crate) fn get_platform_check( + fn get_platform_check( &self, package_map: &Vec<(PackageInterfaceHandle, Option)>, check_platform: PhpMixed, @@ -1382,11 +1382,7 @@ if ($issues) {{ )) } - pub(crate) fn get_autoload_file( - &self, - vendor_path_to_target_dir_code: &str, - suffix: &str, - ) -> String { + fn get_autoload_file(&self, vendor_path_to_target_dir_code: &str, suffix: &str) -> String { let last_char = vendor_path_to_target_dir_code .chars() .nth(vendor_path_to_target_dir_code.len() - 1) @@ -1431,7 +1427,7 @@ return ComposerAutoloaderInit{}::getLoader(); /// Note: vendor_path_code and app_base_dir_code are unused in this method #[allow(clippy::too_many_arguments, reason = "to keep PHP signature")] - pub(crate) fn get_autoload_real_file( + fn get_autoload_real_file( &self, _use_class_map: bool, use_include_path: bool, @@ -1580,7 +1576,7 @@ class ComposerAutoloaderInit{} format!("{}}}\n", file) } - pub(crate) fn get_static_file( + fn get_static_file( &self, suffix: &str, target_dir: &str, @@ -1819,7 +1815,7 @@ class ComposerStaticInit{} ) } - pub(crate) fn parse_autoloads_type( + fn parse_autoloads_type( &self, package_map: &Vec<(PackageInterfaceHandle, Option)>, r#type: &str, @@ -2029,17 +2025,13 @@ class ComposerStaticInit{} autoloads } - pub(crate) fn get_file_identifier( - &self, - package: PackageInterfaceHandle, - path: &str, - ) -> String { + fn get_file_identifier(&self, package: PackageInterfaceHandle, path: &str) -> String { // TODO composer v3 change this to sha1 or xxh3? Possibly not worth the potential breakage though hash("md5", &format!("{}:{}", package.get_name(), path)) } /// Filters out dev-dependencies - pub(crate) fn filter_package_map( + fn filter_package_map( &self, package_map: Vec<(PackageInterfaceHandle, Option)>, root_package: RootPackageInterfaceHandle, @@ -2096,7 +2088,7 @@ class ComposerStaticInit{} /// Sorts packages by dependency weight /// /// Packages of equal weight are sorted alphabetically - pub(crate) fn sort_package_map( + fn sort_package_map( &self, package_map: Vec<(PackageInterfaceHandle, Option)>, ) -> Vec<(PackageInterfaceHandle, Option)> { diff --git a/crates/shirabe/src/cache.rs b/crates/shirabe/src/cache.rs index 435e45c6..b41350f5 100644 --- a/crates/shirabe/src/cache.rs +++ b/crates/shirabe/src/cache.rs @@ -485,7 +485,7 @@ impl Cache { None } - pub(crate) fn get_finder(&self) -> Finder { + fn get_finder(&self) -> Finder { let mut finder = Finder::create(); finder.r#in(&self.root).files(); finder diff --git a/crates/shirabe/src/command/base_command.rs b/crates/shirabe/src/command/base_command.rs index 9eb28dd8..d7f935c1 100644 --- a/crates/shirabe/src/command/base_command.rs +++ b/crates/shirabe/src/command/base_command.rs @@ -38,16 +38,16 @@ pub const INVALID: i64 = 2; #[derive(Debug)] pub struct BaseCommandData { inner: CommandData, - pub(crate) composer: std::cell::RefCell>, - pub(crate) io: std::cell::RefCell>>>, + composer: std::cell::RefCell>, + io: std::cell::RefCell>>>, /// The definition entries that were registered through the Composer-typed /// InputArgument/InputOption (which carry the suggested-values backport). PHP checks /// `$definition->getArgument($name) instanceof Composer\Console\Input\InputArgument`; in /// this port `set_definition` converts the entries to the Symfony types for storage, so /// the Composer-typedness is tracked by name in these side maps instead. - pub(crate) composer_arguments: + composer_arguments: std::cell::RefCell>>, - pub(crate) composer_options: + composer_options: std::cell::RefCell>>, } @@ -65,7 +65,7 @@ impl BaseCommandData { /// Access to the embedded Symfony command state, used by the Composer-typed definition /// builders to forward to `CommandData`'s Symfony-typed entry points. `CommandData` is /// interior-mutable, so a shared reference is enough. - pub(crate) fn command_data(&self) -> &CommandData { + fn command_data(&self) -> &CommandData { &self.inner } } diff --git a/crates/shirabe/src/command/config_command.rs b/crates/shirabe/src/command/config_command.rs index 3d92de4b..504a0f11 100644 --- a/crates/shirabe/src/command/config_command.rs +++ b/crates/shirabe/src/command/config_command.rs @@ -38,16 +38,15 @@ pub struct ConfigCommand { config_file: std::cell::RefCell>>>, config_source: std::cell::RefCell>, - pub(crate) auth_config_file: - std::cell::RefCell>>>, - pub(crate) auth_config_source: std::cell::RefCell>, + auth_config_file: std::cell::RefCell>>>, + auth_config_source: std::cell::RefCell>, } impl_php_class!(ConfigCommand, r"Composer\Command\ConfigCommand"); impl ConfigCommand { /// List of additional configurable package-properties - pub(crate) const CONFIGURABLE_PACKAGE_PROPERTIES: &'static [&'static str] = &[ + const CONFIGURABLE_PACKAGE_PROPERTIES: &'static [&'static str] = &[ "name", "type", "description", @@ -77,7 +76,7 @@ impl ConfigCommand { command } - pub(crate) fn handle_single_value( + fn handle_single_value( &self, key: &str, callbacks: &(ValidatorFn, NormalizerFn), @@ -143,7 +142,7 @@ impl ConfigCommand { Ok(()) } - pub(crate) fn handle_multi_value( + fn handle_multi_value( &self, key: &str, callbacks: &(ValidatorFn, NormalizerFn), @@ -181,7 +180,7 @@ impl ConfigCommand { } /// Display the contents of the file in a pretty formatted way - pub(crate) fn list_configuration( + fn list_configuration( &self, contents: PhpMixed, raw_contents: PhpMixed, diff --git a/crates/shirabe/src/command/create_project_command.rs b/crates/shirabe/src/command/create_project_command.rs index c7768f11..124f809b 100644 --- a/crates/shirabe/src/command/create_project_command.rs +++ b/crates/shirabe/src/command/create_project_command.rs @@ -56,7 +56,7 @@ pub struct CreateProjectCommand { base_command_data: BaseCommandData, /// @var SuggestedPackagesReporter - pub(crate) suggested_packages_reporter: + suggested_packages_reporter: std::cell::RefCell>>>, } diff --git a/crates/shirabe/src/command/diagnose_command.rs b/crates/shirabe/src/command/diagnose_command.rs index 451b051c..4b148c09 100644 --- a/crates/shirabe/src/command/diagnose_command.rs +++ b/crates/shirabe/src/command/diagnose_command.rs @@ -50,11 +50,9 @@ use shirabe_symfony_process::ExecutableFinder; pub struct DiagnoseCommand { base_command_data: BaseCommandData, - pub(crate) http_downloader: - std::cell::RefCell>>>, - pub(crate) process: - std::cell::RefCell>>>, - pub(crate) exit_code: std::cell::Cell, + http_downloader: std::cell::RefCell>>>, + process: std::cell::RefCell>>>, + exit_code: std::cell::Cell, } impl_php_class!(DiagnoseCommand, r"Composer\Command\DiagnoseCommand"); diff --git a/crates/shirabe/src/command/init_command.rs b/crates/shirabe/src/command/init_command.rs index 7e6021a9..c348fa6f 100644 --- a/crates/shirabe/src/command/init_command.rs +++ b/crates/shirabe/src/command/init_command.rs @@ -125,10 +125,7 @@ impl InitCommand { .into()) } - pub(crate) fn format_authors( - &self, - author: &str, - ) -> anyhow::Result>> { + fn format_authors(&self, author: &str) -> anyhow::Result>> { let parsed = self.parse_author_string(author)?; let mut author_map: IndexMap = IndexMap::new(); let name = parsed.get("name").cloned().unwrap_or(None); @@ -163,7 +160,7 @@ impl InitCommand { Some(implode("\\", &namespace)) } - pub(crate) fn get_git_config(&self) -> IndexMap { + fn get_git_config(&self) -> IndexMap { if self.git_config.borrow().is_some() { return self.git_config.borrow().clone().unwrap_or_default(); } @@ -208,7 +205,7 @@ impl InitCommand { /// "/$vendor/" /// "/$vendor/*" /// "$vendor/*" - pub(crate) fn has_vendor_ignore(&self, ignore_file: &str, vendor: &str) -> bool { + fn has_vendor_ignore(&self, ignore_file: &str, vendor: &str) -> bool { if !file_exists(ignore_file) { return false; } @@ -225,7 +222,7 @@ impl InitCommand { false } - pub(crate) fn add_vendor_ignore(&self, ignore_file: &str, vendor: &str) { + fn add_vendor_ignore(&self, ignore_file: &str, vendor: &str) { let mut contents = String::new(); if file_exists(ignore_file) { contents = file_get_contents(ignore_file).unwrap_or_default(); @@ -269,7 +266,7 @@ impl InitCommand { self.add_vendor_ignore(ignore_file, vendor) } - pub(crate) fn is_valid_email(&self, email: &str) -> bool { + fn is_valid_email(&self, email: &str) -> bool { shirabe_php_shim::filter_var_email(email) } diff --git a/crates/shirabe/src/command/show_command.rs b/crates/shirabe/src/command/show_command.rs index f2246cbe..ead034da 100644 --- a/crates/shirabe/src/command/show_command.rs +++ b/crates/shirabe/src/command/show_command.rs @@ -55,8 +55,8 @@ use shirabe_symfony_console::output::OutputInterface; pub struct ShowCommand { base_command_data: BaseCommandData, - pub(crate) version_parser: std::cell::RefCell, - pub(crate) colors: std::cell::RefCell>, + version_parser: std::cell::RefCell, + colors: std::cell::RefCell>, repository_set: std::cell::RefCell>>>, } @@ -83,7 +83,7 @@ impl ShowCommand { } /// PHP: protected function suggestPackageBasedOnMode(): \Closure - pub(crate) fn suggest_package_based_on_mode(&self) -> crate::console::input::SuggestedValues { + fn suggest_package_based_on_mode(&self) -> crate::console::input::SuggestedValues { crate::console::input::SuggestedValues::Closure(Box::new(|this, input, suggestions| { if input.get_option("available")?.to_bool() || input.get_option("all")?.to_bool() { return this.suggest_available_package_incl_platform().call( @@ -259,7 +259,7 @@ impl ShowCommand { } } - pub(crate) fn get_root_requires(&self) -> Vec { + fn get_root_requires(&self) -> Vec { let composer_rc = self.try_composer(None, None); let composer_rc = match composer_rc { None => return vec![], @@ -279,7 +279,7 @@ impl ShowCommand { combined.keys().map(|k| strtolower(k)).collect() } - pub(crate) fn get_version_style( + fn get_version_style( &self, latest_package: PackageInterfaceHandle, package: PackageInterfaceHandle, @@ -294,7 +294,7 @@ impl ShowCommand { } /// finds a package by name and version if provided - pub(crate) fn get_package( + fn get_package( &self, installed_repo: &RepositoryInterfaceHandle, repos: &RepositoryInterfaceHandle, @@ -371,7 +371,7 @@ impl ShowCommand { } /// Prints package info. - pub(crate) fn print_package_info( + fn print_package_info( &self, package: CompletePackageInterfaceHandle, versions: &IndexMap, @@ -401,7 +401,7 @@ impl ShowCommand { } /// Prints package metadata. - pub(crate) fn print_meta( + fn print_meta( &self, package: CompletePackageInterfaceHandle, versions: &IndexMap, @@ -564,7 +564,7 @@ impl ShowCommand { } /// Prints all available versions of this package and highlights the installed one if any. - pub(crate) fn print_versions( + fn print_versions( &self, package: CompletePackageInterfaceHandle, versions: &IndexMap, @@ -599,7 +599,7 @@ impl ShowCommand { } /// print link objects - pub(crate) fn print_links( + fn print_links( &self, package: CompletePackageInterfaceHandle, link_type: &str, @@ -622,7 +622,7 @@ impl ShowCommand { } /// Prints the licenses of a package with metadata - pub(crate) fn print_licenses(&self, package: CompletePackageInterfaceHandle) { + fn print_licenses(&self, package: CompletePackageInterfaceHandle) { let spdx_licenses = SpdxLicenses::new(); let licenses = package.get_license(); @@ -650,7 +650,7 @@ impl ShowCommand { } /// Prints package info in JSON format. - pub(crate) fn print_package_info_as_json( + fn print_package_info_as_json( &self, package: CompletePackageInterfaceHandle, versions: &IndexMap, @@ -971,7 +971,7 @@ impl ShowCommand { } /// Init styles for tree - pub(crate) fn init_styles(&self, output: std::rc::Rc>) { + fn init_styles(&self, output: std::rc::Rc>) { *self.colors.borrow_mut() = vec![ "green".to_string(), "yellow".to_string(), @@ -991,7 +991,7 @@ impl ShowCommand { } /// Display the tree - pub(crate) fn display_package_tree(&self, array_tree: Vec>) { + fn display_package_tree(&self, array_tree: Vec>) { for package in array_tree.iter() { let name = package .get("name") @@ -1070,7 +1070,7 @@ impl ShowCommand { } /// Generate the package tree - pub(crate) fn generate_package_tree( + fn generate_package_tree( &self, package: PackageInterfaceHandle, installed_repo: &RepositoryInterfaceHandle, @@ -1147,7 +1147,7 @@ impl ShowCommand { } /// Display a package tree - pub(crate) fn display_tree( + fn display_tree( &self, package: &PhpMixed, packages_in_tree: &[PhpMixed], @@ -1216,7 +1216,7 @@ impl ShowCommand { } /// Display a package tree - pub(crate) fn add_tree( + fn add_tree( &self, name: &str, link: &Link, diff --git a/crates/shirabe/src/console/application.rs b/crates/shirabe/src/console/application.rs index 9a17868c..fb89f8b0 100644 --- a/crates/shirabe/src/console/application.rs +++ b/crates/shirabe/src/console/application.rs @@ -119,8 +119,8 @@ pub struct Application { default_command: String, single_command: bool, // $initialized is omitted. See ApplicationHandle::init(). - pub(crate) composer: Option, - pub(crate) io: std::rc::Rc>, + composer: Option, + io: std::rc::Rc>, has_plugin_commands: bool, /// Whether this application published the worker-side console application handoff. The /// handoff is process-wide, so a second application in the same process must replace it @@ -443,9 +443,7 @@ impl Application { } /// Initializes all the composer commands. - pub(crate) fn get_default_commands( - &self, - ) -> Vec>> { + fn get_default_commands(&self) -> Vec>> { let mut commands = self.base_get_default_commands(); let composer_commands: Vec>> = vec![ std::rc::Rc::new(std::cell::RefCell::new(AboutCommand::new())), @@ -525,7 +523,7 @@ impl Application { ) } - pub(crate) fn get_default_input_definition(&self) -> anyhow::Result { + fn get_default_input_definition(&self) -> anyhow::Result { let mut definition = self.base_get_default_input_definition(); definition.add_option(InputOption::new( "--profile", @@ -3089,7 +3087,7 @@ thread_local! { } /// Registers the application the worker's reverse command stubs call back into. -pub(crate) fn register_worker_reverse_application( +fn register_worker_reverse_application( application: std::rc::Weak>, ) { WORKER_REVERSE_APPLICATION.with(|slot| *slot.borrow_mut() = Some(application)); diff --git a/crates/shirabe/src/console/github_action_error.rs b/crates/shirabe/src/console/github_action_error.rs index 7475505c..db9800b5 100644 --- a/crates/shirabe/src/console/github_action_error.rs +++ b/crates/shirabe/src/console/github_action_error.rs @@ -6,7 +6,7 @@ use crate::util::Platform; #[derive(Debug)] pub struct GithubActionError { - pub(crate) io: std::rc::Rc>, + io: std::rc::Rc>, } impl GithubActionError { diff --git a/crates/shirabe/src/console/input.rs b/crates/shirabe/src/console/input.rs index 6e515e7d..84e46382 100644 --- a/crates/shirabe/src/console/input.rs +++ b/crates/shirabe/src/console/input.rs @@ -42,12 +42,12 @@ impl std::fmt::Debug for SuggestedValues { impl SuggestedValues { /// Whether PHP's `[] !== $suggestedValues` is false, i.e. no suggestions were declared. - pub(crate) fn is_empty(&self) -> bool { + fn is_empty(&self) -> bool { matches!(self, SuggestedValues::List(values) if values.is_empty()) } /// The shared body of the `InputArgument::complete` / `InputOption::complete` backport. - pub(crate) fn complete( + fn complete( &self, this: &dyn crate::command::BaseCommand, input: &CompletionInput, diff --git a/crates/shirabe/src/dependency_resolver/decisions.rs b/crates/shirabe/src/dependency_resolver/decisions.rs index ac596054..3cf26ffb 100644 --- a/crates/shirabe/src/dependency_resolver/decisions.rs +++ b/crates/shirabe/src/dependency_resolver/decisions.rs @@ -8,8 +8,8 @@ use shirabe_php_shim::LogicException; use std::fmt; pub struct Decisions { - pub(crate) pool: std::rc::Rc>, - pub(crate) decision_map: IndexMap, + pool: std::rc::Rc>, + decision_map: IndexMap, pub(crate) decision_queue: Vec<(i64, std::rc::Rc>)>, } @@ -153,7 +153,7 @@ impl Decisions { self.decision_queue.is_empty() } - pub(crate) fn add_decision(&mut self, literal: i64, level: i64) { + fn add_decision(&mut self, literal: i64, level: i64) { let package_id = literal.abs(); let previous_decision = self.decision_map.get(&package_id).copied().unwrap_or(0); diff --git a/crates/shirabe/src/dependency_resolver/default_policy.rs b/crates/shirabe/src/dependency_resolver/default_policy.rs index 8c1a7697..f753dc48 100644 --- a/crates/shirabe/src/dependency_resolver/default_policy.rs +++ b/crates/shirabe/src/dependency_resolver/default_policy.rs @@ -85,11 +85,7 @@ impl DefaultPolicy { if a.id() < b.id() { -1 } else { 1 } } - pub(crate) fn group_literals_by_name( - &self, - pool: &Pool, - literals: &[i64], - ) -> IndexMap> { + fn group_literals_by_name(&self, pool: &Pool, literals: &[i64]) -> IndexMap> { let mut packages: IndexMap> = IndexMap::new(); for &literal in literals { let package_name = pool.literal_to_package(literal).get_name().to_string(); @@ -98,7 +94,7 @@ impl DefaultPolicy { packages } - pub(crate) fn prune_to_best_version(&self, pool: &Pool, literals: Vec) -> Vec { + fn prune_to_best_version(&self, pool: &Pool, literals: Vec) -> Vec { if let Some(ref preferred_versions) = self.preferred_versions { let name = pool.literal_to_package(literals[0]).get_name(); if let Some(preferred_version) = preferred_versions.get(&name) { @@ -133,7 +129,7 @@ impl DefaultPolicy { best_literals } - pub(crate) fn prune_remote_aliases(&self, pool: &Pool, literals: Vec) -> Vec { + fn prune_remote_aliases(&self, pool: &Pool, literals: Vec) -> Vec { let mut has_local_alias = false; for &literal in &literals { @@ -162,7 +158,7 @@ impl DefaultPolicy { selected } - pub(crate) fn replaces(&self, source: BasePackageHandle, target: BasePackageHandle) -> bool { + fn replaces(&self, source: BasePackageHandle, target: BasePackageHandle) -> bool { for link in source.get_replaces().values() { if link.get_target() == target.get_name().as_str() { return true; diff --git a/crates/shirabe/src/dependency_resolver/generic_rule.rs b/crates/shirabe/src/dependency_resolver/generic_rule.rs index 8c702d32..b13333ed 100644 --- a/crates/shirabe/src/dependency_resolver/generic_rule.rs +++ b/crates/shirabe/src/dependency_resolver/generic_rule.rs @@ -7,7 +7,7 @@ use shirabe_php_shim::{RuntimeException, hash_raw}; #[derive(Debug)] pub struct GenericRule { inner: RuleBase, - pub(crate) literals: Vec, + literals: Vec, } impl GenericRule { diff --git a/crates/shirabe/src/dependency_resolver/lock_transaction.rs b/crates/shirabe/src/dependency_resolver/lock_transaction.rs index e230801f..51917dd6 100644 --- a/crates/shirabe/src/dependency_resolver/lock_transaction.rs +++ b/crates/shirabe/src/dependency_resolver/lock_transaction.rs @@ -13,11 +13,11 @@ pub struct LockTransaction { inner: Transaction, /// packages in current lock file, platform repo or otherwise present /// Indexed by spl_object_hash - pub(crate) present_map: IndexMap, + present_map: IndexMap, /// Packages which cannot be mapped, platform repo, root package, other fixed repos /// Indexed by package id - pub(crate) unlockable_map: IndexMap, - pub(crate) result_packages: IndexMap>, + unlockable_map: IndexMap, + result_packages: IndexMap>, } impl LockTransaction { diff --git a/crates/shirabe/src/dependency_resolver/multi_conflict_rule.rs b/crates/shirabe/src/dependency_resolver/multi_conflict_rule.rs index b7f21074..dc99f5b4 100644 --- a/crates/shirabe/src/dependency_resolver/multi_conflict_rule.rs +++ b/crates/shirabe/src/dependency_resolver/multi_conflict_rule.rs @@ -6,7 +6,7 @@ use shirabe_php_shim::{RuntimeException, hash_raw}; #[derive(Debug)] pub struct MultiConflictRule { inner: RuleBase, - pub(crate) literals: Vec, + literals: Vec, } impl MultiConflictRule { diff --git a/crates/shirabe/src/dependency_resolver/operation/install_operation.rs b/crates/shirabe/src/dependency_resolver/operation/install_operation.rs index 05349c2d..d2d665ac 100644 --- a/crates/shirabe/src/dependency_resolver/operation/install_operation.rs +++ b/crates/shirabe/src/dependency_resolver/operation/install_operation.rs @@ -5,7 +5,7 @@ use crate::package::PackageInterfaceHandle; #[derive(Debug, Clone)] pub struct InstallOperation { - pub(crate) package: PackageInterfaceHandle, + package: PackageInterfaceHandle, } impl InstallOperation { diff --git a/crates/shirabe/src/dependency_resolver/operation/mark_alias_installed_operation.rs b/crates/shirabe/src/dependency_resolver/operation/mark_alias_installed_operation.rs index 72066204..82870816 100644 --- a/crates/shirabe/src/dependency_resolver/operation/mark_alias_installed_operation.rs +++ b/crates/shirabe/src/dependency_resolver/operation/mark_alias_installed_operation.rs @@ -5,7 +5,7 @@ use crate::package::AliasPackageHandle; #[derive(Debug, Clone)] pub struct MarkAliasInstalledOperation { - pub(crate) package: AliasPackageHandle, + package: AliasPackageHandle, } impl MarkAliasInstalledOperation { diff --git a/crates/shirabe/src/dependency_resolver/operation/mark_alias_uninstalled_operation.rs b/crates/shirabe/src/dependency_resolver/operation/mark_alias_uninstalled_operation.rs index 4e4000df..902eb465 100644 --- a/crates/shirabe/src/dependency_resolver/operation/mark_alias_uninstalled_operation.rs +++ b/crates/shirabe/src/dependency_resolver/operation/mark_alias_uninstalled_operation.rs @@ -5,7 +5,7 @@ use crate::package::AliasPackageHandle; #[derive(Debug, Clone)] pub struct MarkAliasUninstalledOperation { - pub(crate) package: AliasPackageHandle, + package: AliasPackageHandle, } impl MarkAliasUninstalledOperation { diff --git a/crates/shirabe/src/dependency_resolver/operation/uninstall_operation.rs b/crates/shirabe/src/dependency_resolver/operation/uninstall_operation.rs index 2fd35af5..aeb2e86a 100644 --- a/crates/shirabe/src/dependency_resolver/operation/uninstall_operation.rs +++ b/crates/shirabe/src/dependency_resolver/operation/uninstall_operation.rs @@ -5,7 +5,7 @@ use crate::package::PackageInterfaceHandle; #[derive(Debug, Clone)] pub struct UninstallOperation { - pub(crate) package: PackageInterfaceHandle, + package: PackageInterfaceHandle, } impl UninstallOperation { diff --git a/crates/shirabe/src/dependency_resolver/operation/update_operation.rs b/crates/shirabe/src/dependency_resolver/operation/update_operation.rs index a06a9cdc..67ed73c1 100644 --- a/crates/shirabe/src/dependency_resolver/operation/update_operation.rs +++ b/crates/shirabe/src/dependency_resolver/operation/update_operation.rs @@ -6,8 +6,8 @@ use crate::package::version::VersionParser; #[derive(Debug, Clone)] pub struct UpdateOperation { - pub(crate) initial_package: PackageInterfaceHandle, - pub(crate) target_package: PackageInterfaceHandle, + initial_package: PackageInterfaceHandle, + target_package: PackageInterfaceHandle, } impl UpdateOperation { diff --git a/crates/shirabe/src/dependency_resolver/pool.rs b/crates/shirabe/src/dependency_resolver/pool.rs index a0dfd362..c12f819d 100644 --- a/crates/shirabe/src/dependency_resolver/pool.rs +++ b/crates/shirabe/src/dependency_resolver/pool.rs @@ -14,19 +14,19 @@ use std::fmt; #[derive(Debug)] pub struct Pool { /// @var BasePackage[] - pub(crate) packages: Vec, + packages: Vec, /// @var array - pub(crate) package_by_name: IndexMap>, + package_by_name: IndexMap>, /// @var VersionParser - pub(crate) version_parser: VersionParser, + version_parser: VersionParser, /// @var array> - pub(crate) provider_cache: IndexMap>>, + provider_cache: IndexMap>>, /// @var BasePackage[] - pub(crate) unacceptable_fixed_or_locked_packages: Vec, + unacceptable_fixed_or_locked_packages: Vec, /// @var array> Map of package name => normalized version => pretty version - pub(crate) removed_versions: IndexMap>, + removed_versions: IndexMap>, /// @var array> Map of package object hash => removed normalized versions => removed pretty version - pub(crate) removed_versions_by_package: IndexMap>, + removed_versions_by_package: IndexMap>, /// @var array>> Map of package name => normalized version => security advisories security_removed_versions: IndexMap>>>, diff --git a/crates/shirabe/src/dependency_resolver/problem.rs b/crates/shirabe/src/dependency_resolver/problem.rs index 1da6028c..cdb833bf 100644 --- a/crates/shirabe/src/dependency_resolver/problem.rs +++ b/crates/shirabe/src/dependency_resolver/problem.rs @@ -25,12 +25,12 @@ use shirabe_symfony_console::formatter::OutputFormatter; #[derive(Debug)] pub struct Problem { /// A map containing the id of each rule part of this problem as a key - pub(crate) reason_seen: IndexMap, + reason_seen: IndexMap, /// A set of reasons for the problem, each is a rule or a root require and a rule - pub(crate) reasons: IndexMap>>>, + reasons: IndexMap>>>, - pub(crate) section: i64, + section: i64, } impl Default for Problem { @@ -360,7 +360,7 @@ impl Problem { } /// Store a reason descriptor but ignore duplicates - pub(crate) fn add_reason(&mut self, id: String, reason: std::rc::Rc>) { + fn add_reason(&mut self, id: String, reason: std::rc::Rc>) { // TODO: if a rule is part of a problem description in two sections, isn't this going to remove a message // that is important to understand the issue? @@ -1377,7 +1377,7 @@ impl Problem { } /// Turns a constraint into text usable in a sentence describing a request - pub(crate) fn constraint_to_text(constraint: Option<&AnyConstraint>) -> String { + fn constraint_to_text(constraint: Option<&AnyConstraint>) -> String { if let Some(c) = constraint && c.is_constraint() && c.get_operator() == Some(CmpOp::Eq) diff --git a/crates/shirabe/src/dependency_resolver/request.rs b/crates/shirabe/src/dependency_resolver/request.rs index 410831dd..1b6925ed 100644 --- a/crates/shirabe/src/dependency_resolver/request.rs +++ b/crates/shirabe/src/dependency_resolver/request.rs @@ -231,12 +231,12 @@ pub enum UpdateAllowTransitiveDeps { #[derive(Debug)] pub struct Request { - pub(crate) locked_repository: Option, - pub(crate) requires: IndexMap, - pub(crate) fixed_packages: IndexMap, - pub(crate) locked_packages: IndexMap, - pub(crate) fixed_locked_packages: IndexMap, - pub(crate) update_allow_list: Vec, - pub(crate) update_allow_transitive_dependencies: UpdateAllowTransitiveDeps, + locked_repository: Option, + requires: IndexMap, + fixed_packages: IndexMap, + locked_packages: IndexMap, + fixed_locked_packages: IndexMap, + update_allow_list: Vec, + update_allow_transitive_dependencies: UpdateAllowTransitiveDeps, restrict_packages: Option>, } diff --git a/crates/shirabe/src/dependency_resolver/rule.rs b/crates/shirabe/src/dependency_resolver/rule.rs index 5e009260..6b1c2274 100644 --- a/crates/shirabe/src/dependency_resolver/rule.rs +++ b/crates/shirabe/src/dependency_resolver/rule.rs @@ -721,9 +721,9 @@ impl std::fmt::Display for Rule { #[derive(Debug)] pub struct RuleBase { - pub(crate) bitfield: i64, - pub(crate) request: Option, - pub(crate) reason_data: ReasonData, + bitfield: i64, + request: Option, + reason_data: ReasonData, } impl RuleBase { diff --git a/crates/shirabe/src/dependency_resolver/rule_set.rs b/crates/shirabe/src/dependency_resolver/rule_set.rs index 50f7cb45..195e0953 100644 --- a/crates/shirabe/src/dependency_resolver/rule_set.rs +++ b/crates/shirabe/src/dependency_resolver/rule_set.rs @@ -11,9 +11,9 @@ use shirabe_php_shim::OutOfBoundsException; #[derive(Debug)] pub struct RuleSet { pub rule_by_id: IndexMap>>, - pub(crate) rules: IndexMap>>>, - pub(crate) next_rule_id: i64, - pub(crate) rules_by_hash: IndexMap>>>, + rules: IndexMap>>>, + next_rule_id: i64, + rules_by_hash: IndexMap>>>, } impl Default for RuleSet { diff --git a/crates/shirabe/src/dependency_resolver/rule_set_generator.rs b/crates/shirabe/src/dependency_resolver/rule_set_generator.rs index 6f2213dc..aa9412c4 100644 --- a/crates/shirabe/src/dependency_resolver/rule_set_generator.rs +++ b/crates/shirabe/src/dependency_resolver/rule_set_generator.rs @@ -17,11 +17,11 @@ use std::collections::VecDeque; #[derive(Debug)] pub struct RuleSetGenerator { - pub(crate) policy: std::rc::Rc, - pub(crate) pool: std::rc::Rc>, - pub(crate) rules: RuleSet, - pub(crate) added_map: IndexMap, - pub(crate) added_packages_by_names: IndexMap>, + policy: std::rc::Rc, + pool: std::rc::Rc>, + rules: RuleSet, + added_map: IndexMap, + added_packages_by_names: IndexMap>, } impl RuleSetGenerator { @@ -132,7 +132,7 @@ impl RuleSetGenerator { } } - pub(crate) fn add_rules_for_package( + fn add_rules_for_package( &mut self, package: PackageInterfaceHandle, platform_requirement_filter: &dyn PlatformRequirementFilterInterface, @@ -221,7 +221,7 @@ impl RuleSetGenerator { } } - pub(crate) fn add_conflict_rules( + fn add_conflict_rules( &mut self, platform_requirement_filter: &dyn PlatformRequirementFilterInterface, ) { @@ -292,7 +292,7 @@ impl RuleSetGenerator { } } - pub(crate) fn add_rules_for_request( + fn add_rules_for_request( &mut self, request: &Request, platform_requirement_filter: &dyn PlatformRequirementFilterInterface, @@ -369,7 +369,7 @@ impl RuleSetGenerator { Ok(()) } - pub(crate) fn add_rules_for_root_aliases( + fn add_rules_for_root_aliases( &mut self, platform_requirement_filter: &dyn PlatformRequirementFilterInterface, ) { diff --git a/crates/shirabe/src/dependency_resolver/rule_set_iterator.rs b/crates/shirabe/src/dependency_resolver/rule_set_iterator.rs index b469a193..3dcd3a85 100644 --- a/crates/shirabe/src/dependency_resolver/rule_set_iterator.rs +++ b/crates/shirabe/src/dependency_resolver/rule_set_iterator.rs @@ -6,11 +6,11 @@ use indexmap::IndexMap; /// Implements PHP \Iterator over a grouped rule set. #[derive(Debug)] pub struct RuleSetIterator { - pub(crate) rules: IndexMap>>>, - pub(crate) types: Vec, - pub(crate) current_offset: i64, - pub(crate) current_type: i64, - pub(crate) current_type_offset: i64, + rules: IndexMap>>>, + types: Vec, + current_offset: i64, + current_type: i64, + current_type_offset: i64, } impl RuleSetIterator { diff --git a/crates/shirabe/src/dependency_resolver/rule_watch_graph.rs b/crates/shirabe/src/dependency_resolver/rule_watch_graph.rs index 6646490b..19be7a9e 100644 --- a/crates/shirabe/src/dependency_resolver/rule_watch_graph.rs +++ b/crates/shirabe/src/dependency_resolver/rule_watch_graph.rs @@ -8,7 +8,7 @@ use indexmap::IndexMap; #[derive(Debug)] pub struct RuleWatchGraph { - pub(crate) watch_chains: IndexMap, + watch_chains: IndexMap, } impl Default for RuleWatchGraph { @@ -121,7 +121,7 @@ impl RuleWatchGraph { None } - pub(crate) fn move_watch( + fn move_watch( &mut self, from_literal: i64, to_literal: i64, diff --git a/crates/shirabe/src/dependency_resolver/rule_watch_node.rs b/crates/shirabe/src/dependency_resolver/rule_watch_node.rs index b11c1771..fae7fa91 100644 --- a/crates/shirabe/src/dependency_resolver/rule_watch_node.rs +++ b/crates/shirabe/src/dependency_resolver/rule_watch_node.rs @@ -6,7 +6,7 @@ use crate::dependency_resolver::Rule; pub struct RuleWatchNode { pub watch1: i64, pub watch2: i64, - pub(crate) rule: std::rc::Rc>, + rule: std::rc::Rc>, } impl std::fmt::Debug for RuleWatchNode { diff --git a/crates/shirabe/src/dependency_resolver/solver.rs b/crates/shirabe/src/dependency_resolver/solver.rs index a9453a3e..cb398a0c 100644 --- a/crates/shirabe/src/dependency_resolver/solver.rs +++ b/crates/shirabe/src/dependency_resolver/solver.rs @@ -26,25 +26,25 @@ use shirabe_semver::constraint::AnyConstraint; #[derive(Debug)] pub struct Solver { - pub(crate) policy: std::rc::Rc, - pub(crate) pool: std::rc::Rc>, + policy: std::rc::Rc, + pool: std::rc::Rc>, - pub(crate) rules: RuleSet, + rules: RuleSet, - pub(crate) watch_graph: RuleWatchGraph, - pub(crate) decisions: Decisions, - pub(crate) fixed_map: IndexMap, + watch_graph: RuleWatchGraph, + decisions: Decisions, + fixed_map: IndexMap, - pub(crate) propagate_index: i64, + propagate_index: i64, /// Pairs of `(literals, level)` — PHP indexes into these with the BRANCH_* constants. - pub(crate) branches: Vec<(Vec, i64)>, - pub(crate) problems: Vec, - pub(crate) learned_pool: Vec>>>, - pub(crate) learned_why: IndexMap, + branches: Vec<(Vec, i64)>, + problems: Vec, + learned_pool: Vec>>>, + learned_why: IndexMap, pub test_flag_learned_positive_literal: bool, - pub(crate) io: std::rc::Rc>, + io: std::rc::Rc>, } impl Solver { diff --git a/crates/shirabe/src/dependency_resolver/solver_problems_exception.rs b/crates/shirabe/src/dependency_resolver/solver_problems_exception.rs index 4c948608..fe78dae5 100644 --- a/crates/shirabe/src/dependency_resolver/solver_problems_exception.rs +++ b/crates/shirabe/src/dependency_resolver/solver_problems_exception.rs @@ -11,8 +11,8 @@ use shirabe_php_shim::RuntimeException; #[derive(Debug)] pub struct SolverProblemsException { inner: RuntimeException, - pub(crate) problems: Vec, - pub(crate) learned_pool: Vec>>>, + problems: Vec, + learned_pool: Vec>>>, } impl SolverProblemsException { diff --git a/crates/shirabe/src/dependency_resolver/transaction.rs b/crates/shirabe/src/dependency_resolver/transaction.rs index 78037338..84879a41 100644 --- a/crates/shirabe/src/dependency_resolver/transaction.rs +++ b/crates/shirabe/src/dependency_resolver/transaction.rs @@ -21,18 +21,18 @@ use shirabe_php_shim::{ #[derive(Debug, Clone)] pub struct Transaction { /// @var OperationInterface[] - pub(crate) operations: Vec, + operations: Vec, /// Packages present at the beginning of the transaction /// @var PackageInterface[] - pub(crate) present_packages: Vec, + present_packages: Vec, /// Package set resulting from this transaction /// @var array - pub(crate) result_package_map: IndexMap, + result_package_map: IndexMap, /// @var array - pub(crate) result_packages_by_name: IndexMap>, + result_packages_by_name: IndexMap>, } impl Default for Transaction { @@ -104,7 +104,7 @@ impl Transaction { } } - pub(crate) fn calculate_operations(&mut self) -> Vec { + fn calculate_operations(&mut self) -> Vec { let mut operations: Vec = vec![]; let mut present_package_map: IndexMap = IndexMap::new(); @@ -218,7 +218,7 @@ impl Transaction { /// /// These serve as a starting point to enumerate packages in a topological order despite potential cycles. /// If there are packages with a cycle on the top level the package with the lowest name gets picked - pub(crate) fn get_root_packages(&self) -> IndexMap { + fn get_root_packages(&self) -> IndexMap { let mut roots: IndexMap = self .result_package_map .iter() @@ -245,7 +245,7 @@ impl Transaction { roots } - pub(crate) fn get_providers_in_result(&self, link: &Link) -> Vec { + fn get_providers_in_result(&self, link: &Link) -> Vec { let Some(packages) = self.result_packages_by_name.get(link.get_target()) else { return vec![]; }; diff --git a/crates/shirabe/src/downloader/download_manager.rs b/crates/shirabe/src/downloader/download_manager.rs index c8fb86a7..15b009e6 100644 --- a/crates/shirabe/src/downloader/download_manager.rs +++ b/crates/shirabe/src/downloader/download_manager.rs @@ -20,7 +20,7 @@ use shirabe_php_shim::{ #[derive(Debug)] pub struct DownloadManager { /// @var IOInterface - pub(crate) io: std::rc::Rc>, + io: std::rc::Rc>, /// @var bool prefer_dist: bool, /// @var bool @@ -425,10 +425,7 @@ impl DownloadManager { /// Determines the install preference of a package /// /// @param PackageInterface $package package instance - pub(crate) fn resolve_package_install_preference( - &self, - package: PackageInterfaceHandle, - ) -> String { + fn resolve_package_install_preference(&self, package: PackageInterfaceHandle) -> String { for (pattern, preference) in &self.package_preferences { let pattern_regex = format!( "{{^{}$}}i", diff --git a/crates/shirabe/src/downloader/file_downloader.rs b/crates/shirabe/src/downloader/file_downloader.rs index ab9c3672..64b348e1 100644 --- a/crates/shirabe/src/downloader/file_downloader.rs +++ b/crates/shirabe/src/downloader/file_downloader.rs @@ -59,13 +59,13 @@ pub struct FileDownloader { /// @var Config pub(crate) config: std::rc::Rc>, /// @var HttpDownloader - pub(crate) http_downloader: std::rc::Rc>, + http_downloader: std::rc::Rc>, /// @var Filesystem pub(crate) filesystem: std::rc::Rc>, /// @var ?Cache - pub(crate) cache: Option>>, + cache: Option>>, /// @var ?EventDispatcher - pub(crate) event_dispatcher: Option>>, + event_dispatcher: Option>>, /// @var ProcessExecutor pub(crate) process: std::rc::Rc>, /// @var array Map of package name to cache key diff --git a/crates/shirabe/src/downloader/git_downloader.rs b/crates/shirabe/src/downloader/git_downloader.rs index 9e468a44..4394cc95 100644 --- a/crates/shirabe/src/downloader/git_downloader.rs +++ b/crates/shirabe/src/downloader/git_downloader.rs @@ -249,7 +249,7 @@ impl GitDownloader { /// /// @throws \RuntimeException /// @return null|string if a string is returned, it is the commit reference that was checked out if the original could not be found - pub(crate) fn update_to_commit( + fn update_to_commit( &self, package: PackageInterfaceHandle, path: &str, @@ -486,7 +486,7 @@ impl GitDownloader { .into()) } - pub(crate) fn update_origin_url(&self, path: &str, url: &str) { + fn update_origin_url(&self, path: &str, url: &str) { let mut output = String::new(); self.inner.process.borrow_mut().execute_args( &[ @@ -503,7 +503,7 @@ impl GitDownloader { self.set_push_url(path, url); } - pub(crate) fn set_push_url(&self, path: &str, url: &str) { + fn set_push_url(&self, path: &str, url: &str) { // set push url for github projects let mut match_: IndexMap = IndexMap::new(); if Preg::is_match3( @@ -549,7 +549,7 @@ impl GitDownloader { } /// @throws \RuntimeException - pub(crate) async fn discard_changes(&self, path: &str) -> anyhow::Result> { + async fn discard_changes(&self, path: &str) -> anyhow::Result> { let path = self.normalize_path(path); let mut output = String::new(); if self.inner.process.borrow_mut().execute_args( @@ -580,7 +580,7 @@ impl GitDownloader { } /// @throws \RuntimeException - pub(crate) async fn stash_changes(&self, path: &str) -> anyhow::Result> { + async fn stash_changes(&self, path: &str) -> anyhow::Result> { let path = self.normalize_path(path); let mut output = String::new(); if self.inner.process.borrow_mut().execute_args( @@ -604,7 +604,7 @@ impl GitDownloader { } /// @throws \RuntimeException - pub(crate) fn view_diff(&self, path: &str) -> anyhow::Result<()> { + fn view_diff(&self, path: &str) -> anyhow::Result<()> { let path = self.normalize_path(path); let mut output = String::new(); if self.inner.process.borrow_mut().execute_args( @@ -625,7 +625,7 @@ impl GitDownloader { Ok(()) } - pub(crate) fn normalize_path(&self, path: &str) -> String { + fn normalize_path(&self, path: &str) -> String { let mut path = path.to_string(); if Platform::is_windows() && strlen(&path) > 0 { let mut base_path = path.clone(); @@ -655,7 +655,7 @@ impl GitDownloader { path } - pub(crate) fn get_short_hash(&self, reference: &str) -> String { + fn get_short_hash(&self, reference: &str) -> String { if !self.inner.io.is_verbose() && Preg::is_match(php_regex!(r"{^[0-9a-f]{40}$}"), reference) { return substr(reference, 0, Some(10)); diff --git a/crates/shirabe/src/downloader/path_downloader.rs b/crates/shirabe/src/downloader/path_downloader.rs index 44940fef..6b3531f4 100644 --- a/crates/shirabe/src/downloader/path_downloader.rs +++ b/crates/shirabe/src/downloader/path_downloader.rs @@ -28,7 +28,7 @@ use shirabe_symfony_filesystem::Filesystem as SymfonyFilesystem; #[derive(Debug)] pub struct PathDownloader { - pub(crate) inner: FileDownloader, + inner: FileDownloader, } impl_php_class!(PathDownloader, r"Composer\Downloader\PathDownloader"); @@ -79,7 +79,7 @@ impl PathDownloader { None } - pub(crate) fn get_install_operation_appendix( + fn get_install_operation_appendix( &self, package: PackageInterfaceHandle, path: &str, diff --git a/crates/shirabe/src/downloader/perforce_downloader.rs b/crates/shirabe/src/downloader/perforce_downloader.rs index 9d4ff2a3..f61660be 100644 --- a/crates/shirabe/src/downloader/perforce_downloader.rs +++ b/crates/shirabe/src/downloader/perforce_downloader.rs @@ -20,7 +20,7 @@ use shirabe_php_shim::{PhpMixed, impl_php_class}; #[derive(Debug)] pub struct PerforceDownloader { inner: VcsDownloaderBase, - pub(crate) perforce: std::cell::RefCell>>, + perforce: std::cell::RefCell>>, } impl_php_class!( diff --git a/crates/shirabe/src/downloader/svn_downloader.rs b/crates/shirabe/src/downloader/svn_downloader.rs index 59916aa2..1487a710 100644 --- a/crates/shirabe/src/downloader/svn_downloader.rs +++ b/crates/shirabe/src/downloader/svn_downloader.rs @@ -23,7 +23,7 @@ use shirabe_php_shim::{ #[derive(Debug)] pub struct SvnDownloader { inner: VcsDownloaderBase, - pub(crate) cache_credentials: std::cell::Cell, + cache_credentials: std::cell::Cell, } impl_php_class!(SvnDownloader, r"Composer\Downloader\SvnDownloader"); @@ -41,7 +41,7 @@ impl SvnDownloader { } } - pub(crate) fn execute( + fn execute( &self, package: PackageInterfaceHandle, base_url: &str, @@ -67,7 +67,7 @@ impl SvnDownloader { }) } - pub(crate) async fn discard_changes(&self, path: &str) -> anyhow::Result> { + async fn discard_changes(&self, path: &str) -> anyhow::Result> { let mut output = String::new(); if self.inner.process.borrow_mut().execute_args( ["svn", "revert", "-R", "."].map(|s| s.to_string()).as_ref(), diff --git a/crates/shirabe/src/downloader/transport_exception.rs b/crates/shirabe/src/downloader/transport_exception.rs index da8b4c50..c9e1a092 100644 --- a/crates/shirabe/src/downloader/transport_exception.rs +++ b/crates/shirabe/src/downloader/transport_exception.rs @@ -5,10 +5,10 @@ use shirabe_php_shim::{PhpMixed, RuntimeException}; #[derive(Debug, Clone)] pub struct TransportException { inner: RuntimeException, - pub(crate) headers: Option>, - pub(crate) response: Option, - pub(crate) status_code: Option, - pub(crate) response_info: Vec, + headers: Option>, + response: Option, + status_code: Option, + response_info: Vec, } impl TransportException { diff --git a/crates/shirabe/src/event_dispatcher/event.rs b/crates/shirabe/src/event_dispatcher/event.rs index 7075ada0..3adb7405 100644 --- a/crates/shirabe/src/event_dispatcher/event.rs +++ b/crates/shirabe/src/event_dispatcher/event.rs @@ -5,9 +5,9 @@ use shirabe_php_shim::PhpMixed; #[derive(Debug)] pub struct Event { - pub(crate) name: String, - pub(crate) args: Vec, - pub(crate) flags: IndexMap, + name: String, + args: Vec, + flags: IndexMap, propagation_stopped: bool, } diff --git a/crates/shirabe/src/event_dispatcher/event_dispatcher.rs b/crates/shirabe/src/event_dispatcher/event_dispatcher.rs index 55d867b6..8aa75491 100644 --- a/crates/shirabe/src/event_dispatcher/event_dispatcher.rs +++ b/crates/shirabe/src/event_dispatcher/event_dispatcher.rs @@ -87,12 +87,12 @@ impl std::fmt::Debug for Callable { /// `$dispatcher->dispatch(ScriptEvents::POST_INSTALL_CMD);` #[derive(Debug)] pub struct EventDispatcher { - pub(crate) composer: PartialComposerWeakHandle, - pub(crate) io: std::rc::Rc>, - pub(crate) loader: Option, - pub(crate) process: std::rc::Rc>, - pub(crate) listeners: IndexMap>>, - pub(crate) run_scripts: bool, + composer: PartialComposerWeakHandle, + io: std::rc::Rc>, + loader: Option, + process: std::rc::Rc>, + listeners: IndexMap>>, + run_scripts: bool, event_stack: Vec, skip_scripts: Vec, previous_hash: Option, diff --git a/crates/shirabe/src/installer.rs b/crates/shirabe/src/installer.rs index 4ff6af3d..9b4a84e8 100644 --- a/crates/shirabe/src/installer.rs +++ b/crates/shirabe/src/installer.rs @@ -94,51 +94,49 @@ use shirabe_semver::constraint::SimpleConstraint; #[derive(Debug)] pub struct Installer { - pub(crate) io: std::rc::Rc>, - pub(crate) config: std::rc::Rc>, - pub(crate) package: RootPackageInterfaceHandle, + io: std::rc::Rc>, + config: std::rc::Rc>, + package: RootPackageInterfaceHandle, // TODO can we get rid of the below and just use the package itself? - pub(crate) fixed_root_package: RootPackageInterfaceHandle, - pub(crate) download_manager: std::rc::Rc>, - pub(crate) repository_manager: std::rc::Rc>, - pub(crate) locker: std::rc::Rc>, - pub(crate) installation_manager: - std::rc::Rc>, - pub(crate) event_dispatcher: std::rc::Rc>, - pub(crate) autoload_generator: std::rc::Rc>, - pub(crate) prefer_source: bool, - pub(crate) prefer_dist: bool, - pub(crate) optimize_autoloader: bool, - pub(crate) class_map_authoritative: bool, - pub(crate) apcu_autoloader: bool, - pub(crate) apcu_autoloader_prefix: Option, - pub(crate) dev_mode: bool, - pub(crate) dry_run: bool, - pub(crate) download_only: bool, - pub(crate) verbose: bool, - pub(crate) update: bool, - pub(crate) install: bool, - pub(crate) dump_autoloader: bool, - pub(crate) run_scripts: bool, - pub(crate) prefer_stable: bool, - pub(crate) prefer_lowest: bool, - pub(crate) minimal_update: bool, - pub(crate) write_lock: bool, - pub(crate) execute_operations: bool, - pub(crate) audit: bool, - pub(crate) error_on_audit: bool, - pub(crate) audit_format: String, + fixed_root_package: RootPackageInterfaceHandle, + download_manager: std::rc::Rc>, + repository_manager: std::rc::Rc>, + locker: std::rc::Rc>, + installation_manager: std::rc::Rc>, + event_dispatcher: std::rc::Rc>, + autoload_generator: std::rc::Rc>, + prefer_source: bool, + prefer_dist: bool, + optimize_autoloader: bool, + class_map_authoritative: bool, + apcu_autoloader: bool, + apcu_autoloader_prefix: Option, + dev_mode: bool, + dry_run: bool, + download_only: bool, + verbose: bool, + update: bool, + install: bool, + dump_autoloader: bool, + run_scripts: bool, + prefer_stable: bool, + prefer_lowest: bool, + minimal_update: bool, + write_lock: bool, + execute_operations: bool, + audit: bool, + error_on_audit: bool, + audit_format: String, audit_config: Option, ignored_types: Vec, allowed_types: Option>, - pub(crate) update_mirrors: bool, - pub(crate) update_allow_list: Option>, - pub(crate) update_allow_transitive_dependencies: UpdateAllowTransitiveDeps, - pub(crate) suggested_packages_reporter: - std::rc::Rc>, - pub(crate) platform_requirement_filter: std::rc::Rc, - pub(crate) additional_fixed_repository: Option, - pub(crate) temporary_constraints: IndexMap, + update_mirrors: bool, + update_allow_list: Option>, + update_allow_transitive_dependencies: UpdateAllowTransitiveDeps, + suggested_packages_reporter: std::rc::Rc>, + platform_requirement_filter: std::rc::Rc, + additional_fixed_repository: Option, + temporary_constraints: IndexMap, } impl Installer { @@ -552,7 +550,7 @@ impl Installer { } #[tracing::instrument(skip_all)] - pub(crate) fn do_update( + fn do_update( &mut self, local_repo: crate::repository::RepositoryInterfaceHandle, do_install: bool, @@ -915,7 +913,7 @@ impl Installer { /// Run the solver a second time on top of the existing update result with only the current result set in the pool /// and see what packages would get removed if we only had the non-dev packages in the solver request - pub(crate) fn extract_dev_packages( + fn extract_dev_packages( &mut self, lock_transaction: &mut LockTransaction, platform_repo: &PlatformRepositoryHandle, @@ -999,7 +997,7 @@ impl Installer { } /// Whether the function is called as part of an update command or independently - pub(crate) fn do_install( + fn do_install( &mut self, local_repo: crate::repository::RepositoryInterfaceHandle, already_solved: bool, @@ -1285,7 +1283,7 @@ impl Installer { Ok(0) } - pub(crate) fn create_platform_repo( + fn create_platform_repo( &mut self, for_update: bool, ) -> anyhow::Result { diff --git a/crates/shirabe/src/installer/binary_installer.rs b/crates/shirabe/src/installer/binary_installer.rs index 8cd4fe5a..32e4c071 100644 --- a/crates/shirabe/src/installer/binary_installer.rs +++ b/crates/shirabe/src/installer/binary_installer.rs @@ -47,10 +47,10 @@ impl BinaryInstallerInterface for BinaryInstaller { /// Utility to handle installation of package "bin"/binaries #[derive(Debug)] pub struct BinaryInstaller { - pub(crate) bin_dir: String, - pub(crate) bin_compat: String, - pub(crate) io: std::rc::Rc>, - pub(crate) filesystem: std::rc::Rc>, + bin_dir: String, + bin_compat: String, + io: std::rc::Rc>, + filesystem: std::rc::Rc>, vendor_dir: Option, } @@ -219,11 +219,11 @@ impl BinaryInstaller { "php".to_string() } - pub(crate) fn get_binaries(&self, package: PackageInterfaceHandle) -> Vec { + fn get_binaries(&self, package: PackageInterfaceHandle) -> Vec { package.get_binaries() } - pub(crate) fn install_full_binaries( + fn install_full_binaries( &mut self, bin_path: &str, link: &str, @@ -258,7 +258,7 @@ impl BinaryInstaller { } } - pub(crate) fn install_unixy_proxy_binaries(&self, bin_path: &str, link: &str) { + fn install_unixy_proxy_binaries(&self, bin_path: &str, link: &str) { let code = self.generate_unixy_proxy_code(bin_path, link); file_put_contents(link, code.as_bytes()); let link_owned = link.to_string(); @@ -268,14 +268,14 @@ impl BinaryInstaller { }); } - pub(crate) fn initialize_bin_dir(&mut self) { + fn initialize_bin_dir(&mut self) { self.filesystem .borrow_mut() .ensure_directory_exists(&self.bin_dir); self.bin_dir = realpath(&self.bin_dir).unwrap_or_default(); } - pub(crate) fn generate_windows_proxy_code(&self, bin: &str, link: &str) -> String { + fn generate_windows_proxy_code(&self, bin: &str, link: &str) -> String { let bin_path = self .filesystem .borrow_mut() @@ -311,7 +311,7 @@ impl BinaryInstaller { ) } - pub(crate) fn generate_unixy_proxy_code(&self, bin: &str, link: &str) -> String { + fn generate_unixy_proxy_code(&self, bin: &str, link: &str) -> String { let bin_path = self .filesystem .borrow_mut() diff --git a/crates/shirabe/src/installer/library_installer.rs b/crates/shirabe/src/installer/library_installer.rs index cab1e206..5f3b2054 100644 --- a/crates/shirabe/src/installer/library_installer.rs +++ b/crates/shirabe/src/installer/library_installer.rs @@ -24,13 +24,12 @@ pub struct LibraryInstaller { pub(crate) composer: PartialComposerWeakHandle, /// Behind a RefCell so initialize_vendor_dir can canonicalize it through `&self` (the /// installer instance is shared between concurrent package operations). - pub(crate) vendor_dir: std::cell::RefCell, - pub(crate) download_manager: - Option>>, + vendor_dir: std::cell::RefCell, + download_manager: Option>>, pub(crate) io: std::rc::Rc>, - pub(crate) r#type: Option, - pub(crate) filesystem: std::rc::Rc>, - pub(crate) binary_installer: std::rc::Rc>, + r#type: Option, + filesystem: std::rc::Rc>, + binary_installer: std::rc::Rc>, } impl LibraryInstaller { @@ -121,7 +120,7 @@ impl LibraryInstaller { /// /// It is used for BC as getInstallPath tends to be overridden by /// installer plugins but not getPackageBasePath - pub(crate) fn get_package_base_path(&self, package: PackageInterfaceHandle) -> String { + fn get_package_base_path(&self, package: PackageInterfaceHandle) -> String { let install_path = self.get_install_path(package.clone()).unwrap(); let target_dir = package.get_target_dir(); @@ -142,7 +141,7 @@ impl LibraryInstaller { install_path } - pub(crate) async fn install_code( + async fn install_code( &self, package: PackageInterfaceHandle, ) -> anyhow::Result> { @@ -154,7 +153,7 @@ impl LibraryInstaller { .await } - pub(crate) async fn update_code( + async fn update_code( &self, initial: PackageInterfaceHandle, target: PackageInterfaceHandle, @@ -183,7 +182,7 @@ impl LibraryInstaller { .await } - pub(crate) async fn remove_code( + async fn remove_code( &self, package: PackageInterfaceHandle, ) -> anyhow::Result> { @@ -195,7 +194,7 @@ impl LibraryInstaller { .await } - pub(crate) fn initialize_vendor_dir(&self) { + fn initialize_vendor_dir(&self) { self.filesystem .borrow_mut() .ensure_directory_exists(&self.vendor_dir.borrow()); @@ -203,7 +202,7 @@ impl LibraryInstaller { *self.vendor_dir.borrow_mut() = realpath; } - pub(crate) fn get_download_manager( + fn get_download_manager( &self, ) -> &std::rc::Rc> { // PHP: assert($this->downloadManager instanceof DownloadManager, new \LogicException(...)) diff --git a/crates/shirabe/src/io/console_io.rs b/crates/shirabe/src/io/console_io.rs index 6e78a105..00286aba 100644 --- a/crates/shirabe/src/io/console_io.rs +++ b/crates/shirabe/src/io/console_io.rs @@ -40,8 +40,8 @@ pub struct ConsoleIO { /// directly instead of a `HelperSet`. question_helper: std::cell::RefCell, - pub(crate) last_message: std::cell::RefCell, - pub(crate) last_message_err: std::cell::RefCell, + last_message: std::cell::RefCell, + last_message_err: std::cell::RefCell, start_time: Option, verbosity_map: IndexMap, diff --git a/crates/shirabe/src/json.rs b/crates/shirabe/src/json.rs index e5c34063..2f6068d3 100644 --- a/crates/shirabe/src/json.rs +++ b/crates/shirabe/src/json.rs @@ -1,5 +1,5 @@ pub mod json_file; -pub(crate) mod json_grammar; +mod json_grammar; pub mod json_manipulator; pub mod json_validation_exception; diff --git a/crates/shirabe/src/json/json_file.rs b/crates/shirabe/src/json/json_file.rs index 652f1d89..78ed76d7 100644 --- a/crates/shirabe/src/json/json_file.rs +++ b/crates/shirabe/src/json/json_file.rs @@ -516,7 +516,7 @@ impl JsonFile { /// @throws \UnexpectedValueException /// @throws ParsingException /// @return bool true on success - pub(crate) fn validate_syntax(json: &str, file: Option<&str>) -> anyhow::Result { + fn validate_syntax(json: &str, file: Option<&str>) -> anyhow::Result { // TODO(php-semantics): make json_decode() returns an error object with details. let error = match serde_json::from_str::(json) { Ok(_) => { diff --git a/crates/shirabe/src/json/json_manipulator.rs b/crates/shirabe/src/json/json_manipulator.rs index 2fa4fe8f..766137ca 100644 --- a/crates/shirabe/src/json/json_manipulator.rs +++ b/crates/shirabe/src/json/json_manipulator.rs @@ -1546,7 +1546,7 @@ impl JsonManipulator { JsonFile::encode(&data) } - pub(crate) fn detect_indenting(&mut self) { + fn detect_indenting(&mut self) { self.indent = JsonFile::detect_indenting(Some(&self.contents)); } } diff --git a/crates/shirabe/src/json/json_validation_exception.rs b/crates/shirabe/src/json/json_validation_exception.rs index cb7370d2..27661e38 100644 --- a/crates/shirabe/src/json/json_validation_exception.rs +++ b/crates/shirabe/src/json/json_validation_exception.rs @@ -5,7 +5,7 @@ use shirabe_php_shim::Exception; #[derive(Debug)] pub struct JsonValidationException { inner: Exception, - pub(crate) errors: Vec, + errors: Vec, } impl JsonValidationException { diff --git a/crates/shirabe/src/package/alias_package.rs b/crates/shirabe/src/package/alias_package.rs index 52b6efa4..9df804f1 100644 --- a/crates/shirabe/src/package/alias_package.rs +++ b/crates/shirabe/src/package/alias_package.rs @@ -23,18 +23,18 @@ pub struct AliasPackage { repository: Option, /// @var string - pub(crate) version: String, + version: String, /// @var string - pub(crate) pretty_version: String, + pretty_version: String, /// @var bool - pub(crate) dev: bool, + dev: bool, /// @var bool - pub(crate) root_package_alias: bool, + root_package_alias: bool, /// @var string /// @phpstan-var 'stable'|'RC'|'beta'|'alpha'|'dev' - pub(crate) stability: String, + stability: String, /// @var bool - pub(crate) has_self_version_requires: bool, + has_self_version_requires: bool, /// @var BasePackage pub(crate) alias_of: PackageHandle, diff --git a/crates/shirabe/src/package/archiver/archivable_files_finder.rs b/crates/shirabe/src/package/archiver/archivable_files_finder.rs index 72fe0646..8fba18cb 100644 --- a/crates/shirabe/src/package/archiver/archivable_files_finder.rs +++ b/crates/shirabe/src/package/archiver/archivable_files_finder.rs @@ -10,7 +10,7 @@ use shirabe_symfony_finder::Finder; use std::path::{Path, PathBuf}; pub struct ArchivableFilesFinder { - pub(crate) finder: Finder, + finder: Finder, inner_iter: Box>, } diff --git a/crates/shirabe/src/package/archiver/archive_manager.rs b/crates/shirabe/src/package/archiver/archive_manager.rs index 0d99d301..a0216d88 100644 --- a/crates/shirabe/src/package/archiver/archive_manager.rs +++ b/crates/shirabe/src/package/archiver/archive_manager.rs @@ -17,10 +17,10 @@ use shirabe_php_shim::{ }; pub struct ArchiveManager { - pub(crate) download_manager: std::rc::Rc>, - pub(crate) r#loop: std::rc::Rc>, - pub(crate) archivers: Vec>, - pub(crate) overwrite_files: bool, + download_manager: std::rc::Rc>, + r#loop: std::rc::Rc>, + archivers: Vec>, + overwrite_files: bool, } impl std::fmt::Debug for ArchiveManager { diff --git a/crates/shirabe/src/package/complete_package.rs b/crates/shirabe/src/package/complete_package.rs index b2c3978c..00b4a67c 100644 --- a/crates/shirabe/src/package/complete_package.rs +++ b/crates/shirabe/src/package/complete_package.rs @@ -11,18 +11,18 @@ use shirabe_php_shim::PhpMixed; #[derive(Debug, Clone)] pub struct CompletePackage { pub(crate) inner: Package, - pub(crate) repositories: IndexMap, - pub(crate) license: Vec, - pub(crate) keywords: Vec, - pub(crate) authors: Vec>, - pub(crate) description: Option, - pub(crate) homepage: Option, - pub(crate) scripts: IndexMap>, - pub(crate) support: IndexMap, - pub(crate) funding: Vec>, - pub(crate) abandoned: PhpMixed, - pub(crate) archive_name: Option, - pub(crate) archive_excludes: Vec, + repositories: IndexMap, + license: Vec, + keywords: Vec, + authors: Vec>, + description: Option, + homepage: Option, + scripts: IndexMap>, + support: IndexMap, + funding: Vec>, + abandoned: PhpMixed, + archive_name: Option, + archive_excludes: Vec, } impl CompletePackage { diff --git a/crates/shirabe/src/package/link.rs b/crates/shirabe/src/package/link.rs index 027fa009..fc0a8063 100644 --- a/crates/shirabe/src/package/link.rs +++ b/crates/shirabe/src/package/link.rs @@ -5,11 +5,11 @@ use shirabe_semver::constraint::AnyConstraint; #[derive(Clone, Debug)] pub struct Link { - pub(crate) source: String, - pub(crate) target: String, - pub(crate) constraint: AnyConstraint, - pub(crate) description: String, - pub(crate) pretty_constraint: String, + source: String, + target: String, + constraint: AnyConstraint, + description: String, + pretty_constraint: String, } impl Link { diff --git a/crates/shirabe/src/package/loader/array_loader.rs b/crates/shirabe/src/package/loader/array_loader.rs index df588cf9..21811f14 100644 --- a/crates/shirabe/src/package/loader/array_loader.rs +++ b/crates/shirabe/src/package/loader/array_loader.rs @@ -29,7 +29,7 @@ pub struct ArrayLoader { /// @var VersionParser pub(crate) version_parser: VersionParser, /// @var bool - pub(crate) load_options: bool, + load_options: bool, } impl ArrayLoader { diff --git a/crates/shirabe/src/package/package.rs b/crates/shirabe/src/package/package.rs index ee1a5e10..4e35ee55 100644 --- a/crates/shirabe/src/package/package.rs +++ b/crates/shirabe/src/package/package.rs @@ -31,41 +31,41 @@ pub struct Package { /// Back-reference to the owning repository. `Weak` breaks the repository -> packages cycle. repository: Option, - pub(crate) r#type: Option, - pub(crate) target_dir: Option, + r#type: Option, + target_dir: Option, /// `'source'` | `'dist'` | `null` - pub(crate) installation_source: Option, - pub(crate) source_type: Option, - pub(crate) source_url: Option, - pub(crate) source_reference: Option, - pub(crate) source_mirrors: Option>, - pub(crate) dist_type: Option, - pub(crate) dist_url: Option, - pub(crate) dist_reference: Option, - pub(crate) dist_sha1_checksum: Option, - pub(crate) dist_mirrors: Option>, - pub(crate) version: String, - pub(crate) pretty_version: String, - pub(crate) release_date: Option>, - pub(crate) extra: IndexMap, - pub(crate) binaries: Vec, - pub(crate) dev: bool, + installation_source: Option, + source_type: Option, + source_url: Option, + source_reference: Option, + source_mirrors: Option>, + dist_type: Option, + dist_url: Option, + dist_reference: Option, + dist_sha1_checksum: Option, + dist_mirrors: Option>, + version: String, + pretty_version: String, + release_date: Option>, + extra: IndexMap, + binaries: Vec, + dev: bool, /// `'stable'` | `'RC'` | `'beta'` | `'alpha'` | `'dev'` - pub(crate) stability: String, - pub(crate) notification_url: Option, - - pub(crate) requires: IndexMap, - pub(crate) conflicts: IndexMap, - pub(crate) provides: IndexMap, - pub(crate) replaces: IndexMap, - pub(crate) dev_requires: IndexMap, - pub(crate) suggests: IndexMap, - pub(crate) autoload: IndexMap, - pub(crate) dev_autoload: IndexMap, - pub(crate) include_paths: Vec, - pub(crate) is_default_branch: bool, - pub(crate) transport_options: IndexMap, - pub(crate) php_ext: Option>, + stability: String, + notification_url: Option, + + requires: IndexMap, + conflicts: IndexMap, + provides: IndexMap, + replaces: IndexMap, + dev_requires: IndexMap, + suggests: IndexMap, + autoload: IndexMap, + dev_autoload: IndexMap, + include_paths: Vec, + is_default_branch: bool, + transport_options: IndexMap, + php_ext: Option>, } impl Package { diff --git a/crates/shirabe/src/package/root_package.rs b/crates/shirabe/src/package/root_package.rs index 2c2b87ea..0807d15b 100644 --- a/crates/shirabe/src/package/root_package.rs +++ b/crates/shirabe/src/package/root_package.rs @@ -15,12 +15,12 @@ use shirabe_php_shim::PhpMixed; #[derive(Debug, Clone)] pub struct RootPackage { pub(crate) inner: CompletePackage, - pub(crate) minimum_stability: String, - pub(crate) prefer_stable: bool, - pub(crate) stability_flags: IndexMap, - pub(crate) config: IndexMap, - pub(crate) references: IndexMap, - pub(crate) aliases: Vec>, + minimum_stability: String, + prefer_stable: bool, + stability_flags: IndexMap, + config: IndexMap, + references: IndexMap, + aliases: Vec>, } impl RootPackage { diff --git a/crates/shirabe/src/plugin/php_plugin_proxy.rs b/crates/shirabe/src/plugin/php_plugin_proxy.rs index 9a93ef72..967faa1b 100644 --- a/crates/shirabe/src/plugin/php_plugin_proxy.rs +++ b/crates/shirabe/src/plugin/php_plugin_proxy.rs @@ -190,9 +190,7 @@ fn operation_stub_class(operation: &AnyOperation) -> &'static str { } /// Registers a package and returns its wire descriptor. -pub(crate) fn package_handle_value( - package: &std::rc::Rc>, -) -> PluginValue { +fn package_handle_value(package: &std::rc::Rc>) -> PluginValue { let class = package_stub_class(package); let rhandle = register_entity(RustEntity::Package(package.clone())); rust_handle_value(rhandle, class) @@ -2442,11 +2440,11 @@ pub(crate) fn repository_handle_value( /// `composer-installer` package names. Every call is forwarded as a `CallPhpMethod` RPC. #[derive(Debug)] pub struct PhpInstallerProxy { - pub(crate) handle: PhpObjHandle, + handle: PhpObjHandle, } impl PhpInstallerProxy { - pub(crate) fn new(handle: PhpObjHandle) -> Self { + fn new(handle: PhpObjHandle) -> Self { Self { handle } } @@ -2674,7 +2672,7 @@ fn forget_php_installer_proxy(phandle: u64) { /// `Composer\Plugin\Capability\Capability` marker). #[derive(Debug)] pub struct PhpCapabilityProxy { - pub(crate) handle: PhpObjHandle, + handle: PhpObjHandle, } impl PhpCapabilityProxy { @@ -2831,7 +2829,7 @@ impl RustCommandMetadata { /// `Application::register_worker_console_commands` as worker-hosted commands are registered, /// booted in the worker the first time one of them actually runs. #[derive(Debug)] -pub(crate) struct PhpConsoleApplicationContext { +struct PhpConsoleApplicationContext { composer: Option, io: std::rc::Rc>, initial_working_directory: Option, @@ -2995,7 +2993,7 @@ pub struct PhpCommandProxy { } impl PhpCommandProxy { - pub(crate) fn new(handle: PhpObjHandle) -> anyhow::Result { + fn new(handle: PhpObjHandle) -> anyhow::Result { let proxy_command = match Self::call_metadata_getter(&handle, "isProxyCommand")? { PluginValue::Bool(proxy_command) => proxy_command, other => return Err(Self::unsupported_shape(&handle, "isProxyCommand", &other)), diff --git a/crates/shirabe/src/plugin/plugin_manager.rs b/crates/shirabe/src/plugin/plugin_manager.rs index 9f569af7..b02a702d 100644 --- a/crates/shirabe/src/plugin/plugin_manager.rs +++ b/crates/shirabe/src/plugin/plugin_manager.rs @@ -36,15 +36,15 @@ use shirabe_semver::constraint::SimpleConstraint; #[derive(Debug)] pub struct PluginManager { - pub(crate) composer: ComposerWeakHandle, - pub(crate) io: std::rc::Rc>, - pub(crate) global_composer: Option, - pub(crate) version_parser: VersionParser, - pub(crate) disable_plugins: DisablePlugins, + composer: ComposerWeakHandle, + io: std::rc::Rc>, + global_composer: Option, + version_parser: VersionParser, + disable_plugins: DisablePlugins, // PHP stores the same plugin instance in both $plugins and $registeredPlugins (reference // semantics); shared handles preserve the identity comparisons that relies on. - pub(crate) plugins: Vec>>, - pub(crate) registered_plugins: IndexMap>, + plugins: Vec>>, + registered_plugins: IndexMap>, allow_plugin_rules: Option>, allow_global_plugin_rules: Option>, running_in_global_dir: bool, @@ -696,7 +696,7 @@ impl PluginManager { } /// Returns the version of the internal composer-plugin-api package. - pub(crate) fn get_plugin_api_version(&self) -> String { + fn get_plugin_api_version(&self) -> String { match &self.plugin_api_version_override { Some(version) => version.clone(), None => plugin_interface::PLUGIN_API_VERSION.to_string(), @@ -996,7 +996,7 @@ impl PluginManager { .get_install_path(package) } - pub(crate) fn get_capability_implementation_class_name( + fn get_capability_implementation_class_name( &self, plugin: &dyn PluginInterface, capability: &str, diff --git a/crates/shirabe/src/repository/array_repository.rs b/crates/shirabe/src/repository/array_repository.rs index e5ed607d..b28cccdc 100644 --- a/crates/shirabe/src/repository/array_repository.rs +++ b/crates/shirabe/src/repository/array_repository.rs @@ -79,7 +79,7 @@ impl ArrayRepository { Ok(None) } - pub(crate) fn find_packages_internal( + fn find_packages_internal( &self, name: &str, constraint: Option, @@ -157,7 +157,7 @@ impl ArrayRepository { Ok(()) } - pub(crate) fn create_alias_package( + fn create_alias_package( &self, package: BasePackageHandle, alias: String, diff --git a/crates/shirabe/src/repository/artifact_repository.rs b/crates/shirabe/src/repository/artifact_repository.rs index 75ad134b..c225e84d 100644 --- a/crates/shirabe/src/repository/artifact_repository.rs +++ b/crates/shirabe/src/repository/artifact_repository.rs @@ -26,9 +26,9 @@ use std::path::Path; pub struct ArtifactRepository { inner: ArrayRepository, - pub(crate) loader: Box, - pub(crate) lookup: String, - pub(crate) repo_config: IndexMap, + loader: Box, + lookup: String, + repo_config: IndexMap, io: std::rc::Rc>, } diff --git a/crates/shirabe/src/repository/composer_repository.rs b/crates/shirabe/src/repository/composer_repository.rs index 33944c8f..03439a7b 100644 --- a/crates/shirabe/src/repository/composer_repository.rs +++ b/crates/shirabe/src/repository/composer_repository.rs @@ -94,19 +94,19 @@ pub struct ComposerRepository { io: std::rc::Rc>, http_downloader: std::rc::Rc>, r#loop: std::rc::Rc>, - pub(crate) cache: std::cell::RefCell, - pub(crate) notify_url: Option, - pub(crate) search_url: Option, - pub(crate) providers_api_url: Option, - pub(crate) has_providers: bool, - pub(crate) providers_url: Option, - pub(crate) list_url: Option, - pub(crate) has_available_package_list: bool, - pub(crate) available_packages: Option>, - pub(crate) available_package_patterns: Option>, - pub(crate) lazy_providers_url: Option, - pub(crate) provider_listing: Option>, - pub(crate) loader: ArrayLoader, + cache: std::cell::RefCell, + notify_url: Option, + search_url: Option, + providers_api_url: Option, + has_providers: bool, + providers_url: Option, + list_url: Option, + has_available_package_list: bool, + available_packages: Option>, + available_package_patterns: Option>, + lazy_providers_url: Option, + provider_listing: Option>, + loader: ArrayLoader, allow_ssl_downgrade: bool, event_dispatcher: Option>>, source_mirrors: Option>>, @@ -3324,7 +3324,7 @@ impl ComposerRepository { /// Checks if the package name is present in this lazy providers repo /// /// @return true if the package name is present in availablePackages or matched by availablePackagePatterns - pub(crate) fn lazy_providers_repo_contains(&self, name: &str) -> anyhow::Result { + fn lazy_providers_repo_contains(&self, name: &str) -> anyhow::Result { if !self.has_available_package_list { return Err(LogicException::new("lazyProvidersRepoContains should not be called unless hasAvailablePackageList is true".to_string()).into()); } diff --git a/crates/shirabe/src/repository/filesystem_repository.rs b/crates/shirabe/src/repository/filesystem_repository.rs index b39fe829..54c2fa1f 100644 --- a/crates/shirabe/src/repository/filesystem_repository.rs +++ b/crates/shirabe/src/repository/filesystem_repository.rs @@ -95,7 +95,7 @@ impl FilesystemRepository { } /// Initializes repository (reads file, or remote address). - pub(crate) fn initialize(&self) -> anyhow::Result<()> { + fn initialize(&self) -> anyhow::Result<()> { self.inner.initialize(); if !self.file.exists() { diff --git a/crates/shirabe/src/repository/path_repository.rs b/crates/shirabe/src/repository/path_repository.rs index 828474e6..680911eb 100644 --- a/crates/shirabe/src/repository/path_repository.rs +++ b/crates/shirabe/src/repository/path_repository.rs @@ -153,7 +153,7 @@ impl PathRepository { Ok(()) } - pub(crate) fn initialize(&self) -> anyhow::Result<()> { + fn initialize(&self) -> anyhow::Result<()> { self.inner.initialize(); let url_matches = self.get_url_matches()?; diff --git a/crates/shirabe/src/repository/platform_repository.rs b/crates/shirabe/src/repository/platform_repository.rs index e43892a0..7c7030f0 100644 --- a/crates/shirabe/src/repository/platform_repository.rs +++ b/crates/shirabe/src/repository/platform_repository.rs @@ -40,12 +40,12 @@ pub struct PlatformOverride { #[derive(Debug)] pub struct PlatformRepository { - pub(crate) inner: ArrayRepository, - pub(crate) version_parser: Option, - pub(crate) overrides: IndexMap, - pub(crate) disabled_packages: IndexMap, - pub(crate) platform_info: Option, - pub(crate) hhvm_detector: Box, + inner: ArrayRepository, + version_parser: Option, + overrides: IndexMap, + disabled_packages: IndexMap, + platform_info: Option, + hhvm_detector: Box, } impl PlatformRepository { @@ -123,7 +123,7 @@ impl PlatformRepository { } #[tracing::instrument(skip_all)] - pub(crate) fn initialize(&mut self) -> anyhow::Result<()> { + fn initialize(&mut self) -> anyhow::Result<()> { self.inner.initialize(); let platform_info = self diff --git a/crates/shirabe/src/repository/repository_set.rs b/crates/shirabe/src/repository/repository_set.rs index bd57ec20..24b11d51 100644 --- a/crates/shirabe/src/repository/repository_set.rs +++ b/crates/shirabe/src/repository/repository_set.rs @@ -50,29 +50,29 @@ pub struct RepositorySet { /// @var array[] /// @phpstan-var array> - pub(crate) root_aliases: IndexMap>, + root_aliases: IndexMap>, /// @var string[] /// @phpstan-var array - pub(crate) root_references: IndexMap, + root_references: IndexMap, /// @var RepositoryInterface[] - pub(crate) repositories: Vec, + repositories: Vec, /// @var int[] array of stability => BasePackage::STABILITY_* value /// @phpstan-var array, BasePackage::STABILITY_*> - pub(crate) acceptable_stabilities: IndexMap, + acceptable_stabilities: IndexMap, /// @var int[] array of package name => BasePackage::STABILITY_* value /// @phpstan-var array - pub(crate) stability_flags: IndexMap, + stability_flags: IndexMap, /// @var ConstraintInterface[] /// @phpstan-var array - pub(crate) root_requires: IndexMap, + root_requires: IndexMap, /// @var array - pub(crate) temporary_constraints: IndexMap, + temporary_constraints: IndexMap, /// @var bool locked: bool, diff --git a/crates/shirabe/src/repository/vcs/forgejo_driver.rs b/crates/shirabe/src/repository/vcs/forgejo_driver.rs index 54f5dddd..7687db0d 100644 --- a/crates/shirabe/src/repository/vcs/forgejo_driver.rs +++ b/crates/shirabe/src/repository/vcs/forgejo_driver.rs @@ -23,12 +23,12 @@ use shirabe_php_shim::{ #[derive(Debug)] pub struct ForgejoDriver { - pub(crate) inner: VcsDriverBase, - pub(crate) forgejo_url: Option, - pub(crate) repository_data: Option, - pub(crate) git_driver: Option, - pub(crate) tags: Option>, - pub(crate) branches: Option>, + inner: VcsDriverBase, + forgejo_url: Option, + repository_data: Option, + git_driver: Option, + tags: Option>, + branches: Option>, } impl ForgejoDriver { @@ -595,7 +595,7 @@ impl ForgejoDriver { None } - pub(crate) fn get_contents( + fn get_contents( &mut self, url: &str, fetching_repo_data: bool, diff --git a/crates/shirabe/src/repository/vcs/fossil_driver.rs b/crates/shirabe/src/repository/vcs/fossil_driver.rs index 9a0c4b2e..8ce479fd 100644 --- a/crates/shirabe/src/repository/vcs/fossil_driver.rs +++ b/crates/shirabe/src/repository/vcs/fossil_driver.rs @@ -19,12 +19,12 @@ use shirabe_php_shim::{ #[derive(Debug)] pub struct FossilDriver { - pub(crate) inner: VcsDriverBase, - pub(crate) tags: Option>, - pub(crate) branches: Option>, - pub(crate) root_identifier: Option, - pub(crate) repo_file: Option, - pub(crate) checkout_dir: String, + inner: VcsDriverBase, + tags: Option>, + branches: Option>, + root_identifier: Option, + repo_file: Option, + checkout_dir: String, } impl FossilDriver { @@ -95,7 +95,7 @@ impl FossilDriver { Ok(()) } - pub(crate) fn check_fossil(&self) -> anyhow::Result<()> { + fn check_fossil(&self) -> anyhow::Result<()> { let mut ignored_output = String::new(); if self.inner.process.borrow_mut().execute_args( ["fossil", "version"].map(|s| s.to_string()).as_ref(), @@ -112,7 +112,7 @@ impl FossilDriver { Ok(()) } - pub(crate) fn update_local_repo(&mut self) -> anyhow::Result<()> { + fn update_local_repo(&mut self) -> anyhow::Result<()> { assert!(self.repo_file.is_some()); let mut fs = Filesystem::new(None); diff --git a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs index c3da08ff..9558e3b2 100644 --- a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs +++ b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs @@ -24,11 +24,11 @@ use shirabe_php_shim::{ #[derive(Debug)] pub struct GitBitbucketDriver { - pub(crate) inner: VcsDriverBase, + inner: VcsDriverBase, /// @var string - pub(crate) owner: String, + owner: String, /// @var string - pub(crate) repository: String, + repository: String, /// @var bool has_issues: bool, /// @var ?string @@ -50,7 +50,7 @@ pub struct GitBitbucketDriver { /// @var array repo_data: IndexMap, /// @var ?VcsDriver - pub(crate) fallback_driver: Option>, + fallback_driver: Option>, /// @var string|null if set either git or hg vcs_type: Option, } diff --git a/crates/shirabe/src/repository/vcs/github_driver.rs b/crates/shirabe/src/repository/vcs/github_driver.rs index 9dbb8513..56ff3853 100644 --- a/crates/shirabe/src/repository/vcs/github_driver.rs +++ b/crates/shirabe/src/repository/vcs/github_driver.rs @@ -24,24 +24,24 @@ use shirabe_php_shim::{ #[derive(Debug)] pub struct GitHubDriver { - pub(crate) inner: VcsDriverBase, - pub(crate) owner: String, - pub(crate) repository: String, + inner: VcsDriverBase, + owner: String, + repository: String, /// @var array Map of tag name to identifier - pub(crate) tags: Option>, + tags: Option>, /// @var array Map of branch name to identifier - pub(crate) branches: Option>, - pub(crate) root_identifier: String, + branches: Option>, + root_identifier: String, /// @var mixed[] - pub(crate) repo_data: Option>, - pub(crate) has_issues: bool, - pub(crate) is_private: bool, + repo_data: Option>, + has_issues: bool, + is_private: bool, is_archived: bool, /// @var array|false|null funding_info: Option, allow_git_fallback: bool, /// Git Driver - pub(crate) git_driver: Option, + git_driver: Option, } impl GitHubDriver { @@ -194,7 +194,7 @@ impl GitHubDriver { ) } - pub(crate) fn get_api_url(&self) -> String { + fn get_api_url(&self) -> String { let api_url = if self.inner.origin_url == "github.com" { "api.github.com".to_string() } else { @@ -995,7 +995,7 @@ impl GitHubDriver { } /// Generate an SSH URL - pub(crate) fn generate_ssh_url(&self) -> String { + fn generate_ssh_url(&self) -> String { if strpos(&self.inner.origin_url, ":").is_some() { return format!( "ssh://git@{}/{}/{}.git", @@ -1009,7 +1009,7 @@ impl GitHubDriver { ) } - pub(crate) fn get_contents( + fn get_contents( &mut self, url: &str, fetching_repo_data: bool, @@ -1154,7 +1154,7 @@ impl GitHubDriver { /// Fetch root identifier from GitHub /// /// @throws TransportException - pub(crate) fn fetch_root_identifier(&mut self) -> anyhow::Result<()> { + fn fetch_root_identifier(&mut self) -> anyhow::Result<()> { if self.repo_data.is_some() { return Ok(()); } @@ -1225,7 +1225,7 @@ impl GitHubDriver { /// @phpstan-impure /// /// @throws \RuntimeException - pub(crate) fn attempt_clone_fallback( + fn attempt_clone_fallback( &mut self, e: Option>, ) -> anyhow::Result { @@ -1263,7 +1263,7 @@ impl GitHubDriver { } } - pub(crate) fn setup_git_driver(&mut self, url: &str) -> anyhow::Result<()> { + fn setup_git_driver(&mut self, url: &str) -> anyhow::Result<()> { if !self.allow_git_fallback { return Err( RuntimeException::new("Fallback to git driver disabled".to_string()).into(), @@ -1283,7 +1283,7 @@ impl GitHubDriver { Ok(()) } - pub(crate) fn get_next_page(&self, response: &Response) -> Option { + fn get_next_page(&self, response: &Response) -> Option { let header = response.get_header("link")?; if header.is_empty() { return None; diff --git a/crates/shirabe/src/repository/vcs/gitlab_driver.rs b/crates/shirabe/src/repository/vcs/gitlab_driver.rs index 669f1376..df1ad686 100644 --- a/crates/shirabe/src/repository/vcs/gitlab_driver.rs +++ b/crates/shirabe/src/repository/vcs/gitlab_driver.rs @@ -26,7 +26,7 @@ use shirabe_php_shim::{ /// Driver for GitLab API, use the Git driver for local checkouts. #[derive(Debug)] pub struct GitLabDriver { - pub(crate) inner: VcsDriverBase, + inner: VcsDriverBase, /// @phpstan-var 'https'|'http' scheme: String, namespace: String, @@ -40,10 +40,10 @@ pub struct GitLabDriver { /// @var array Map of branch name to identifier branches: Option>, /// Git Driver - pub(crate) git_driver: Option, + git_driver: Option, /// Protocol to force use of for repository URLs. /// @var string One of ssh, http - pub(crate) protocol: String, + protocol: String, /// Defaults to true unless we can make sure it is public /// @var bool defines whether the repo is private or not is_private: bool, @@ -595,10 +595,7 @@ impl GitLabDriver { } /// @return string[] where keys are named references like tags or branches and the value a sha - pub(crate) fn get_references( - &mut self, - r#type: &str, - ) -> anyhow::Result> { + fn get_references(&mut self, r#type: &str) -> anyhow::Result> { let per_page = 100; let mut resource: Option = Some(format!( "{}/repository/{}?per_page={}", @@ -661,7 +658,7 @@ impl GitLabDriver { Ok(references) } - pub(crate) fn fetch_project(&mut self) -> anyhow::Result<()> { + fn fetch_project(&mut self) -> anyhow::Result<()> { if self.project.is_some() { return Ok(()); } @@ -694,7 +691,7 @@ impl GitLabDriver { /// @phpstan-impure /// /// @throws \RuntimeException - pub(crate) fn attempt_clone_fallback(&mut self) -> anyhow::Result { + fn attempt_clone_fallback(&mut self) -> anyhow::Result { let url = if !self.is_private { self.generate_public_url() } else { @@ -723,7 +720,7 @@ impl GitLabDriver { } /// Generate an SSH URL - pub(crate) fn generate_ssh_url(&self) -> String { + fn generate_ssh_url(&self) -> String { if self.has_nonstandard_origin { return format!( "ssh://git@{}/{}/{}.git", @@ -737,14 +734,14 @@ impl GitLabDriver { ) } - pub(crate) fn generate_public_url(&self) -> String { + fn generate_public_url(&self) -> String { format!( "{}://{}/{}/{}.git", self.scheme, self.inner.origin_url, self.namespace, self.repository ) } - pub(crate) fn setup_git_driver(&mut self, url: &str) -> anyhow::Result<()> { + fn setup_git_driver(&mut self, url: &str) -> anyhow::Result<()> { let mut repo_config: IndexMap = IndexMap::new(); repo_config.insert("url".to_string(), PhpMixed::String(url.to_string())); let mut git_driver = GitDriver::new( @@ -759,7 +756,7 @@ impl GitLabDriver { Ok(()) } - pub(crate) fn get_contents( + fn get_contents( &mut self, url: &str, fetching_repo_data: bool, @@ -1009,7 +1006,7 @@ impl GitLabDriver { Ok(self.project.clone()) } - pub(crate) fn get_next_page(&self, response: &Response) -> Option { + fn get_next_page(&self, response: &Response) -> Option { let header = response.get_header("link").unwrap_or_default(); let links = explode(",", &header); diff --git a/crates/shirabe/src/repository/vcs/hg_driver.rs b/crates/shirabe/src/repository/vcs/hg_driver.rs index 56efd514..f4e02685 100644 --- a/crates/shirabe/src/repository/vcs/hg_driver.rs +++ b/crates/shirabe/src/repository/vcs/hg_driver.rs @@ -17,11 +17,11 @@ use shirabe_php_shim::{PhpMixed, RuntimeException, dirname, is_dir, is_writable, #[derive(Debug)] pub struct HgDriver { - pub(crate) inner: VcsDriverBase, - pub(crate) tags: Option>, - pub(crate) branches: Option>, - pub(crate) root_identifier: Option, - pub(crate) repo_dir: String, + inner: VcsDriverBase, + tags: Option>, + branches: Option>, + root_identifier: Option, + repo_dir: String, } impl HgDriver { diff --git a/crates/shirabe/src/repository/vcs/perforce_driver.rs b/crates/shirabe/src/repository/vcs/perforce_driver.rs index 7425c7d4..ce9ffb49 100644 --- a/crates/shirabe/src/repository/vcs/perforce_driver.rs +++ b/crates/shirabe/src/repository/vcs/perforce_driver.rs @@ -15,9 +15,9 @@ use shirabe_php_shim::{BadMethodCallException, PhpMixed, RuntimeException, php_r #[derive(Debug)] pub struct PerforceDriver { inner: VcsDriverBase, - pub(crate) depot: String, - pub(crate) branch: String, - pub(crate) perforce: Option>, + depot: String, + branch: String, + perforce: Option>, } impl PerforceDriver { diff --git a/crates/shirabe/src/repository/vcs/svn_driver.rs b/crates/shirabe/src/repository/vcs/svn_driver.rs index 6d767af5..dd74400d 100644 --- a/crates/shirabe/src/repository/vcs/svn_driver.rs +++ b/crates/shirabe/src/repository/vcs/svn_driver.rs @@ -21,25 +21,25 @@ use shirabe_php_shim::{ #[derive(Debug)] pub struct SvnDriver { - pub(crate) inner: VcsDriverBase, + inner: VcsDriverBase, /// @var string - pub(crate) base_url: String, + base_url: String, /// @var array Map of tag name to identifier - pub(crate) tags: Option>, + tags: Option>, /// @var array Map of branch name to identifier - pub(crate) branches: Option>, + branches: Option>, /// @var ?string - pub(crate) root_identifier: Option, + root_identifier: Option, - pub(crate) trunk_path: Option, + trunk_path: Option, /// @var string - pub(crate) branches_path: String, + branches_path: String, /// @var string - pub(crate) tags_path: String, + tags_path: String, /// @var string - pub(crate) package_path: String, + package_path: String, /// @var bool - pub(crate) cache_credentials: bool, + cache_credentials: bool, /// @var SvnUtil util: Option, @@ -152,7 +152,7 @@ impl SvnDriver { None } - pub(crate) fn should_cache(&self, identifier: &str) -> bool { + fn should_cache(&self, identifier: &str) -> bool { self.inner.cache.is_some() && Preg::is_match(php_regex!(r"{@\d+$}"), identifier) } @@ -530,7 +530,7 @@ impl SvnDriver { } /// An absolute path (leading '/') is converted to a file:// url. - pub(crate) fn normalize_url(url: &str) -> String { + fn normalize_url(url: &str) -> String { let fs = Filesystem::new(None); if fs.is_absolute_path(url) { return format!("file://{}", strtr(url, "\\", "/")); @@ -545,7 +545,7 @@ impl SvnDriver { /// @param non-empty-list $command The svn command to run. /// @param string $url The SVN URL. /// @throws \RuntimeException - pub(crate) fn execute(&mut self, command: Vec, url: &str) -> anyhow::Result { + fn execute(&mut self, command: Vec, url: &str) -> anyhow::Result { if self.util.is_none() { self.util = Some(SvnUtil::new( self.base_url.clone(), @@ -589,7 +589,7 @@ impl SvnDriver { /// /// @param string $baseDir The path to trunk/branch/tag /// @param int $revision The revision mark to add to identifier - pub(crate) fn build_identifier(&self, base_dir: &str, revision: i64) -> String { + fn build_identifier(&self, base_dir: &str, revision: i64) -> String { format!( "{}{}/@{}", base_dir.trim_end_matches('/'), diff --git a/crates/shirabe/src/repository/vcs_repository.rs b/crates/shirabe/src/repository/vcs_repository.rs index 4da3f0ad..4066ac44 100644 --- a/crates/shirabe/src/repository/vcs_repository.rs +++ b/crates/shirabe/src/repository/vcs_repository.rs @@ -37,36 +37,36 @@ use shirabe_semver::constraint::SimpleConstraint; // TODO(port): the driver registration should be refactored later. #[derive(Debug)] pub struct VcsRepository { - pub(crate) inner: ArrayRepository, + inner: ArrayRepository, /// @var string - pub(crate) url: String, + url: String, /// @var ?string /// /// Interior mutability: set lazily by the (now `&self`) `initialize`, mirroring how PHP's /// inherited ArrayRepository methods drive the overridden `initialize()` on first access. - pub(crate) package_name: std::cell::RefCell>, + package_name: std::cell::RefCell>, /// @var bool - pub(crate) is_verbose: bool, + is_verbose: bool, /// @var bool - pub(crate) is_very_verbose: bool, + is_very_verbose: bool, /// @var IOInterface - pub(crate) io: std::rc::Rc>, + io: std::rc::Rc>, /// @var Config - pub(crate) config: std::rc::Rc>, + config: std::rc::Rc>, /// @var VersionParser - pub(crate) version_parser: std::cell::RefCell>, + version_parser: std::cell::RefCell>, /// @var string - pub(crate) r#type: String, + r#type: String, /// @var ?LoaderInterface - pub(crate) loader: std::cell::RefCell>>, + loader: std::cell::RefCell>>, /// @var array - pub(crate) repo_config: IndexMap, + repo_config: IndexMap, /// @var HttpDownloader - pub(crate) http_downloader: std::rc::Rc>, + http_downloader: std::rc::Rc>, /// @var ProcessExecutor - pub(crate) process_executor: std::rc::Rc>, + process_executor: std::rc::Rc>, /// @var bool - pub(crate) branch_error_occurred: std::cell::Cell, + branch_error_occurred: std::cell::Cell, /// @var array> drivers: IndexMap, /// @var ?VcsDriverInterface diff --git a/crates/shirabe/src/util/auth_helper.rs b/crates/shirabe/src/util/auth_helper.rs index ac7caa35..2c2ee725 100644 --- a/crates/shirabe/src/util/auth_helper.rs +++ b/crates/shirabe/src/util/auth_helper.rs @@ -18,8 +18,8 @@ use shirabe_php_shim::{ #[derive(Debug)] pub struct AuthHelper { - pub(crate) io: std::rc::Rc>, - pub(crate) config: std::rc::Rc>, + io: std::rc::Rc>, + config: std::rc::Rc>, /// @var array Map of origins to message displayed displayed_origin_authentications: IndexMap, /// @var array Map of URLs and whether they already retried with authentication from Bitbucket diff --git a/crates/shirabe/src/util/filesystem.rs b/crates/shirabe/src/util/filesystem.rs index 066b1981..532c96dd 100644 --- a/crates/shirabe/src/util/filesystem.rs +++ b/crates/shirabe/src/util/filesystem.rs @@ -848,7 +848,7 @@ impl Filesystem { false } - pub(crate) fn directory_size(&self, directory: &Path) -> anyhow::Result { + fn directory_size(&self, directory: &Path) -> anyhow::Result { let it = shirabe_php_shim::recursive_directory_iterator(directory, shirabe_php_shim::SKIP_DOTS)?; let ri = shirabe_php_shim::recursive_iterator_iterator(it, shirabe_php_shim::CHILD_FIRST); @@ -863,7 +863,7 @@ impl Filesystem { Ok(size) } - pub(crate) fn get_process(&mut self) -> std::cell::RefMut<'_, ProcessExecutor> { + fn get_process(&mut self) -> std::cell::RefMut<'_, ProcessExecutor> { self.get_process_handle(); self.process_executor.as_ref().unwrap().borrow_mut() @@ -871,9 +871,7 @@ impl Filesystem { /// Hands out the executor handle itself so async callers can hold only a shared borrow /// across their awaits (a RefMut held across an await panics once calls overlap). - pub(crate) fn get_process_handle( - &mut self, - ) -> std::rc::Rc> { + fn get_process_handle(&mut self) -> std::rc::Rc> { if self.process_executor.is_none() { self.process_executor = Some(std::rc::Rc::new(std::cell::RefCell::new( ProcessExecutor::new(None), diff --git a/crates/shirabe/src/util/git.rs b/crates/shirabe/src/util/git.rs index 26ea1898..f8fea562 100644 --- a/crates/shirabe/src/util/git.rs +++ b/crates/shirabe/src/util/git.rs @@ -25,11 +25,11 @@ use std::sync::Mutex; #[derive(Debug)] pub struct Git { - pub(crate) io: std::rc::Rc>, - pub(crate) config: std::rc::Rc>, - pub(crate) process: std::rc::Rc>, - pub(crate) filesystem: std::rc::Rc>, - pub(crate) http_downloader: Option>>, + io: std::rc::Rc>, + config: std::rc::Rc>, + process: std::rc::Rc>, + filesystem: std::rc::Rc>, + http_downloader: Option>>, } /// @var string|false|null diff --git a/crates/shirabe/src/util/gitlab.rs b/crates/shirabe/src/util/gitlab.rs index 3d1fb2be..ef68c82f 100644 --- a/crates/shirabe/src/util/gitlab.rs +++ b/crates/shirabe/src/util/gitlab.rs @@ -17,10 +17,10 @@ use shirabe_php_shim::{ #[derive(Debug)] pub struct GitLab { - pub(crate) io: std::rc::Rc>, - pub(crate) config: std::rc::Rc>, - pub(crate) process: std::rc::Rc>, - pub(crate) http_downloader: std::rc::Rc>, + io: std::rc::Rc>, + config: std::rc::Rc>, + process: std::rc::Rc>, + http_downloader: std::rc::Rc>, } impl GitLab { diff --git a/crates/shirabe/src/util/no_proxy_pattern.rs b/crates/shirabe/src/util/no_proxy_pattern.rs index 7d4d7b84..6d19637a 100644 --- a/crates/shirabe/src/util/no_proxy_pattern.rs +++ b/crates/shirabe/src/util/no_proxy_pattern.rs @@ -12,11 +12,11 @@ use shirabe_php_shim::{ #[derive(Debug)] pub struct NoProxyPattern { /// @var string[] - pub(crate) host_names: Vec, + host_names: Vec, /// @var (null|object)[] - pub(crate) rules: IndexMap>, + rules: IndexMap>, /// @var bool - pub(crate) noproxy: bool, + noproxy: bool, } #[derive(Debug, Clone)] @@ -69,7 +69,7 @@ impl NoProxyPattern { } /// Returns false is the url cannot be parsed, otherwise a data object - pub(crate) fn get_url_data(&self, url: &str) -> anyhow::Result> { + fn get_url_data(&self, url: &str) -> anyhow::Result> { let host = parse_url(url, PHP_URL_HOST); if empty(&host) { return Ok(None); @@ -107,12 +107,7 @@ impl NoProxyPattern { } /// Returns true if the url is matched by a rule - pub(crate) fn r#match( - &mut self, - index: i64, - host_name: &str, - url: &UrlData, - ) -> anyhow::Result { + fn r#match(&mut self, index: i64, host_name: &str, url: &UrlData) -> anyhow::Result { let rule = match self.get_rule(index, host_name)? { Some(r) => r, None => { @@ -148,7 +143,7 @@ impl NoProxyPattern { } /// Returns true if the target ip is in the network range - pub(crate) fn match_range(&self, network: &IpData, target: &IpData) -> anyhow::Result { + fn match_range(&self, network: &IpData, target: &IpData) -> anyhow::Result { let net = network.ip.as_slice(); let mask = network.netmask.as_deref().unwrap_or_default(); let ip = target.ip.as_slice(); diff --git a/crates/shirabe/src/util/perforce.rs b/crates/shirabe/src/util/perforce.rs index 246e37f5..fbab6889 100644 --- a/crates/shirabe/src/util/perforce.rs +++ b/crates/shirabe/src/util/perforce.rs @@ -18,22 +18,22 @@ use shirabe_symfony_process::Process; /// @phpstan-type RepoConfig array{unique_perforce_client_name?: string, depot?: string, branch?: string, p4user?: string, p4password?: string} #[derive(Debug)] pub struct Perforce { - pub(crate) path: String, - pub(crate) p4_depot: Option, - pub(crate) p4_client: Option, - pub(crate) p4_user: Option, - pub(crate) p4_password: Option, - pub(crate) p4_port: String, - pub(crate) p4_stream: Option, - pub(crate) p4_client_spec: String, - pub(crate) p4_depot_type: Option, - pub(crate) p4_branch: Option, - pub(crate) process: std::rc::Rc>, - pub(crate) unique_perforce_client_name: String, - pub(crate) windows_flag: bool, - pub(crate) command_result: String, - pub(crate) io: std::rc::Rc>, - pub(crate) filesystem: Option>>, + path: String, + p4_depot: Option, + p4_client: Option, + p4_user: Option, + p4_password: Option, + p4_port: String, + p4_stream: Option, + p4_client_spec: String, + p4_depot_type: Option, + p4_branch: Option, + process: std::rc::Rc>, + unique_perforce_client_name: String, + windows_flag: bool, + command_result: String, + io: std::rc::Rc>, + filesystem: Option>>, } impl Perforce { @@ -147,7 +147,7 @@ impl Perforce { file_system.borrow_mut().remove(&client_spec); } - pub(crate) fn execute_command(&mut self, command: PhpMixed) -> i64 { + fn execute_command(&mut self, command: PhpMixed) -> i64 { self.command_result = String::new(); let cmd_vec: Vec = match &command { @@ -180,7 +180,7 @@ impl Perforce { self.p4_client.clone().unwrap_or_default() } - pub(crate) fn get_path(&self) -> &str { + fn get_path(&self) -> &str { &self.path } @@ -190,7 +190,7 @@ impl Perforce { fs.borrow_mut().ensure_directory_exists(path); } - pub(crate) fn get_port(&self) -> &str { + fn get_port(&self) -> &str { &self.p4_port } @@ -278,7 +278,7 @@ impl Perforce { Ok(()) } - pub(crate) fn get_p4_variable(&mut self, name: &str) -> Option { + fn get_p4_variable(&mut self, name: &str) -> Option { if self.windows_flag { let command = format!("{} set", Self::get_p4_executable()); self.execute_command(PhpMixed::String(command)); @@ -507,7 +507,7 @@ impl Perforce { Ok(()) } - pub(crate) fn read(&self, pipe: &PhpResource, _name: PhpMixed) { + fn read(&self, pipe: &PhpResource, _name: PhpMixed) { if feof(pipe) { return; } @@ -743,7 +743,7 @@ impl Perforce { false } - pub(crate) fn get_change_list(&mut self, reference: &str) -> Option { + fn get_change_list(&mut self, reference: &str) -> Option { let index = strpos(reference, "@")?; let label = substr(reference, index as i64, None); let command = diff --git a/crates/shirabe/src/util/process_executor.rs b/crates/shirabe/src/util/process_executor.rs index 3f300317..00091029 100644 --- a/crates/shirabe/src/util/process_executor.rs +++ b/crates/shirabe/src/util/process_executor.rs @@ -30,11 +30,11 @@ static TIMEOUT: LazyLock> = LazyLock::new(|| Mutex::new(300)); #[derive(Debug)] pub struct ProcessExecutor { /// @var bool - pub(crate) capture_output: bool, + capture_output: bool, /// @var string - pub(crate) error_output: String, + error_output: String, /// @var ?IOInterface - pub(crate) io: Option>>, + io: Option>>, /// @var int max_jobs: i64, /// PHP throttles async jobs through the $jobs queue and $maxJobs; here concurrent diff --git a/crates/shirabe/src/util/svn.rs b/crates/shirabe/src/util/svn.rs index 395f176f..bde2583d 100644 --- a/crates/shirabe/src/util/svn.rs +++ b/crates/shirabe/src/util/svn.rs @@ -23,21 +23,21 @@ pub struct SvnCredentials { #[derive(Debug)] pub struct Svn { /// @var ?array{username: string, password: string} - pub(crate) credentials: Option, + credentials: Option, /// @var bool - pub(crate) has_auth: Option, + has_auth: Option, /// @var IOInterface - pub(crate) io: std::rc::Rc>, + io: std::rc::Rc>, /// @var string - pub(crate) url: String, + url: String, /// @var bool - pub(crate) cache_credentials: bool, + cache_credentials: bool, /// @var ProcessExecutor - pub(crate) process: std::rc::Rc>, + process: std::rc::Rc>, /// @var int - pub(crate) qty_auth_tries: i64, + qty_auth_tries: i64, /// @var Config - pub(crate) config: std::rc::Rc>, + config: std::rc::Rc>, } /// @var string|null @@ -202,7 +202,7 @@ impl Svn { /// Repositories requests credentials, let's put them in. /// /// @throws \RuntimeException - pub(crate) fn do_auth_dance(&mut self) -> anyhow::Result<&mut Self> { + fn do_auth_dance(&mut self) -> anyhow::Result<&mut Self> { // cannot ask for credentials in non interactive mode if !self.io.is_interactive() { return Err(RuntimeException::new( @@ -247,12 +247,7 @@ impl Svn { /// @param non-empty-list $cmd Usually 'svn ls' or something like that. /// @param string $url Repo URL. /// @param string $path Target for a checkout - pub(crate) fn get_command( - &mut self, - mut cmd: Vec, - url: &str, - path: Option<&str>, - ) -> Vec { + fn get_command(&mut self, mut cmd: Vec, url: &str, path: Option<&str>) -> Vec { cmd.push("--non-interactive".to_string()); cmd.extend(self.get_credential_args()); cmd.push("--".to_string()); @@ -268,7 +263,7 @@ impl Svn { /// Return the credential string for the svn command. /// /// Adds --no-auth-cache when credentials are present. - pub(crate) fn get_credential_args(&mut self) -> Vec { + fn get_credential_args(&mut self) -> Vec { if !self.has_auth() { return vec![]; } @@ -299,7 +294,7 @@ impl Svn { /// Get the password for the svn command. Can be empty. /// /// @throws \LogicException - pub(crate) fn get_password(&self) -> anyhow::Result { + fn get_password(&self) -> anyhow::Result { if self.credentials.is_none() { return Err(LogicException::new("No svn auth detected.".to_string()).into()); } @@ -310,7 +305,7 @@ impl Svn { /// Get the username for the svn command. /// /// @throws \LogicException - pub(crate) fn get_username(&self) -> anyhow::Result { + fn get_username(&self) -> anyhow::Result { if self.credentials.is_none() { return Err(LogicException::new("No svn auth detected.".to_string()).into()); } @@ -319,7 +314,7 @@ impl Svn { } /// Detect Svn Auth. - pub(crate) fn has_auth(&mut self) -> bool { + fn has_auth(&mut self) -> bool { if let Some(has_auth) = self.has_auth { return has_auth; } @@ -332,7 +327,7 @@ impl Svn { } /// Return the no-auth-cache switch. - pub(crate) fn get_auth_cache_args(&self) -> Vec { + fn get_auth_cache_args(&self) -> Vec { if self.cache_credentials { vec![] } else { -- cgit v1.3.1-4-g156e