diff options
Diffstat (limited to 'crates/shirabe/src')
43 files changed, 0 insertions, 340 deletions
diff --git a/crates/shirabe/src/advisory/auditor.rs b/crates/shirabe/src/advisory/auditor.rs index 853fa36f..d20c9453 100644 --- a/crates/shirabe/src/advisory/auditor.rs +++ b/crates/shirabe/src/advisory/auditor.rs @@ -242,9 +242,6 @@ impl Auditor { Ok(audit_bitmask) } - /// @param array<string, array<SecurityAdvisory|AnySecurityAdvisory>> $advisories - /// @param array<string, string|null> $ignoreList - /// @return bool pub fn needs_complete_advisory_load( &self, advisories: &IndexMap<String, Vec<std::rc::Rc<AnySecurityAdvisory>>>, @@ -272,9 +269,6 @@ impl Auditor { array_any(&ignored_ids, |id: &String| !str_starts_with(id, "PKSA-")) } - /// @param array<PackageInterface> $packages - /// @param array<string, string|null> $ignoreAbandoned - /// @return array<CompletePackageInterface> pub fn filter_abandoned_packages( &self, packages: &[PackageInterfaceHandle], @@ -409,7 +403,6 @@ impl Auditor { (advisories.len() as i64, count) } - /// @param array<string, array<SecurityAdvisory>> $advisories /// @param self::FORMAT_* $format The format that will be used to output audit results. fn output_advisories( &self, @@ -456,7 +449,6 @@ impl Auditor { } } - /// @param array<string, array<SecurityAdvisory>> $advisories fn output_advisories_table( &self, io: &ConsoleIO, @@ -517,7 +509,6 @@ impl Auditor { Ok(()) } - /// @param array<string, array<SecurityAdvisory>> $advisories fn output_advisories_plain( &self, io: &std::rc::Rc<std::cell::RefCell<dyn IOInterface>>, @@ -563,8 +554,6 @@ impl Auditor { Ok(()) } - /// @param array<CompletePackageInterface> $packages - /// @param self::FORMAT_PLAIN|self::FORMAT_TABLE $format fn output_abandoned_packages( &self, io: &std::rc::Rc<std::cell::RefCell<dyn IOInterface>>, @@ -710,7 +699,6 @@ impl Auditor { ) } - /// @return int-mask<self::STATUS_*> fn calculate_bitmask( &self, has_vulnerable_packages: bool, diff --git a/crates/shirabe/src/autoload/class_loader.rs b/crates/shirabe/src/autoload/class_loader.rs index 3bcc6f81..89758269 100644 --- a/crates/shirabe/src/autoload/class_loader.rs +++ b/crates/shirabe/src/autoload/class_loader.rs @@ -56,7 +56,6 @@ pub struct ClassLoader { } impl ClassLoader { - /// @param string|null $vendorDir pub fn new(vendor_dir: Option<String>) -> Self { let this = Self { vendor_dir, @@ -75,7 +74,6 @@ impl ClassLoader { this } - /// @return array<string, list<string>> pub fn get_prefixes(&self) -> IndexMap<String, Vec<String>> { if !self.prefixes_psr0.is_empty() { // PHP: call_user_func_array('array_merge', array_values($this->prefixesPsr0)) @@ -94,17 +92,14 @@ impl ClassLoader { IndexMap::new() } - /// @return array<string, list<string>> pub fn get_prefixes_psr4(&self) -> &IndexMap<String, Vec<String>> { &self.prefix_dirs_psr4 } - /// @return list<string> pub fn get_fallback_dirs(&self) -> &Vec<String> { &self.fallback_dirs_psr0 } - /// @return list<string> pub fn get_fallback_dirs_psr4(&self) -> &Vec<String> { &self.fallback_dirs_psr4 } @@ -369,13 +364,10 @@ impl ClassLoader { } /// Returns the currently registered loaders keyed by their corresponding vendor directories. - /// - /// @return array<string, self> pub fn get_registered_loaders() -> IndexMap<String, ClassLoader> { REGISTERED_LOADERS.lock().unwrap().clone() } - /// @return string|false fn find_file_with_extension(&self, class: &str, ext: &str) -> Option<String> { // PSR-4 lookup let logical_path_psr4 = format!("{}{}", strtr(class, "\\", DIRECTORY_SEPARATOR), ext); diff --git a/crates/shirabe/src/cache.rs b/crates/shirabe/src/cache.rs index 2e7ff3cb..354e559e 100644 --- a/crates/shirabe/src/cache.rs +++ b/crates/shirabe/src/cache.rs @@ -124,7 +124,6 @@ impl Cache { &self.root } - /// @return string|false pub fn read(&mut self, file: &str) -> Option<String> { if self.is_enabled() { let file = Preg::replace(format!("{{[^{}]}}i", self.allowlist), "-", file); @@ -344,8 +343,6 @@ impl Cache { false } - /// @return int|false - /// @phpstan-return int<0, max>|false pub fn get_age(&mut self, file: &str) -> Option<i64> { if self.is_enabled() { let file = Preg::replace(format!("{{[^{}]}}i", self.allowlist), "-", file); @@ -463,7 +460,6 @@ impl Cache { false } - /// @return string|false pub fn sha1(&mut self, file: &str) -> Option<String> { if self.is_enabled() { let file = Preg::replace(format!("{{[^{}]}}i", self.allowlist), "-", file); @@ -476,7 +472,6 @@ impl Cache { None } - /// @return string|false pub fn sha256(&mut self, file: &str) -> Option<String> { if self.is_enabled() { let file = Preg::replace(format!("{{[^{}]}}i", self.allowlist), "-", file); diff --git a/crates/shirabe/src/command/base_command.rs b/crates/shirabe/src/command/base_command.rs index f9682de9..41b8d0f8 100644 --- a/crates/shirabe/src/command/base_command.rs +++ b/crates/shirabe/src/command/base_command.rs @@ -211,23 +211,16 @@ pub trait BaseCommand: Command { input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>, ) -> anyhow::Result<std::rc::Rc<dyn PlatformRequirementFilterInterface>>; - /// @param array<string> $requirements - /// - /// @return array<string, string> fn format_requirements( &self, requirements: Vec<String>, ) -> anyhow::Result<IndexMap<String, String>>; - /// @param array<string> $requirements - /// - /// @return list<array{name: string, version?: string}> fn normalize_requirements( &self, requirements: Vec<String>, ) -> anyhow::Result<Vec<IndexMap<String, String>>>; - /// @param array<TableSeparator|mixed[]> $table fn render_table( &self, table: Vec<PhpMixed>, @@ -237,8 +230,6 @@ pub trait BaseCommand: Command { fn get_terminal_width(&self) -> i64; /// @internal - /// @param 'format'|'audit-format' $optName - /// @return Auditor::FORMAT_* fn get_audit_format( &self, input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>, diff --git a/crates/shirabe/src/command/create_project_command.rs b/crates/shirabe/src/command/create_project_command.rs index 756ebfac..260685c7 100644 --- a/crates/shirabe/src/command/create_project_command.rs +++ b/crates/shirabe/src/command/create_project_command.rs @@ -288,8 +288,6 @@ impl BaseCommand for CreateProjectCommand { } impl CreateProjectCommand { - /// @param string|array<string>|null $repositories - /// /// @throws \Exception #[allow(clippy::too_many_arguments)] pub fn install_project( @@ -632,8 +630,6 @@ impl CreateProjectCommand { Ok(0) } - /// @param array<string>|null $repositories - /// /// @throws \Exception #[allow(clippy::too_many_arguments)] fn install_root_package( diff --git a/crates/shirabe/src/command/init_command.rs b/crates/shirabe/src/command/init_command.rs index 6923f768..99a7de00 100644 --- a/crates/shirabe/src/command/init_command.rs +++ b/crates/shirabe/src/command/init_command.rs @@ -923,7 +923,6 @@ impl BaseCommand for InitCommand { } impl InitCommand { - /// @return array{name: string, email: string|null} fn parse_author_string( &self, author: &str, @@ -968,7 +967,6 @@ impl InitCommand { .into()) } - /// @return array<int, array{name: string, email?: string}> pub(crate) fn format_authors( &self, author: &str, @@ -1007,7 +1005,6 @@ impl InitCommand { Some(implode("\\", &namespace)) } - /// @return array<string, string> pub(crate) fn get_git_config(&self) -> IndexMap<String, String> { if self.git_config.borrow().is_some() { return self.git_config.borrow().clone().unwrap_or_default(); @@ -1161,7 +1158,6 @@ impl InitCommand { } } - /// @param array<string, string|array<string>> $options fn has_dependencies(&self, options: &IndexMap<String, PhpMixed>) -> bool { let requires = options.get("require").cloned().unwrap_or(PhpMixed::Null); let requires_arr_empty = match &requires { diff --git a/crates/shirabe/src/command/package_discovery_trait.rs b/crates/shirabe/src/command/package_discovery_trait.rs index cfd2d302..a1faff35 100644 --- a/crates/shirabe/src/command/package_discovery_trait.rs +++ b/crates/shirabe/src/command/package_discovery_trait.rs @@ -60,7 +60,6 @@ pub trait PackageDiscoveryTrait: BaseCommand { self.get_repos_mut().as_ref().unwrap().clone() } - /// @param key-of<BasePackage::STABILITIES>|null $minimumStability fn get_repository_set( &self, input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>, @@ -91,7 +90,6 @@ pub trait PackageDiscoveryTrait: BaseCommand { self.get_repository_sets_mut().get(&key).unwrap().clone() } - /// @return key-of<BasePackage::STABILITIES> fn get_minimum_stability( &self, input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>, @@ -750,7 +748,6 @@ pub trait PackageDiscoveryTrait: BaseCommand { )) } - /// @return array<string> fn find_similar(&self, package: &str) -> anyhow::Result<Vec<String>> { let results: Vec<SearchResult> = match (|| -> anyhow::Result<Vec<SearchResult>> { if self.get_repos_mut().is_none() { diff --git a/crates/shirabe/src/command/require_command.rs b/crates/shirabe/src/command/require_command.rs index 9d7d7553..d2b8360d 100644 --- a/crates/shirabe/src/command/require_command.rs +++ b/crates/shirabe/src/command/require_command.rs @@ -673,8 +673,6 @@ impl BaseCommand for RequireCommand { } impl RequireCommand { - /// @param array<string, string> $newRequirements - /// @return string[] fn get_inconsistent_require_keys( &self, new_requirements: &IndexMap<String, String>, @@ -694,7 +692,6 @@ impl RequireCommand { inconsistent_requirements } - /// @return array<string, string> fn get_packages_by_require_key(&self) -> IndexMap<String, String> { let json = self.json.borrow().as_ref().unwrap().clone(); let composer_definition = json.borrow_mut().read().unwrap_or_default(); @@ -748,9 +745,6 @@ impl RequireCommand { .unwrap_or_default() } - /// @param array<string, string> $requirements - /// @param 'require'|'require-dev' $requireKey - /// @param 'require'|'require-dev' $removeKey /// @throws \Exception fn do_update( &self, @@ -1053,7 +1047,6 @@ impl RequireCommand { Ok(status) } - /// @param list<string> $requirementsToUpdate fn update_requirements_after_resolution( &self, requirements_to_update: &[String], @@ -1192,7 +1185,6 @@ impl RequireCommand { Ok(0) } - /// @param array<string, string> $new fn update_file( &self, json: &std::rc::Rc<std::cell::RefCell<JsonFile>>, @@ -1235,7 +1227,6 @@ impl RequireCommand { let _ = json.borrow().write(PhpMixed::Array(composer_definition)); } - /// @param array<string, string> $new fn update_file_cleanly( &self, json: &std::rc::Rc<std::cell::RefCell<JsonFile>>, diff --git a/crates/shirabe/src/command/show_command.rs b/crates/shirabe/src/command/show_command.rs index a3bf7157..a6bb906d 100644 --- a/crates/shirabe/src/command/show_command.rs +++ b/crates/shirabe/src/command/show_command.rs @@ -1662,7 +1662,6 @@ impl ShowCommand { combined.keys().map(|k| strtolower(k)).collect() } - /// @return array|string|string[] pub(crate) fn get_version_style( &self, latest_package: PackageInterfaceHandle, diff --git a/crates/shirabe/src/command/update_command.rs b/crates/shirabe/src/command/update_command.rs index 8dcf7061..e5602763 100644 --- a/crates/shirabe/src/command/update_command.rs +++ b/crates/shirabe/src/command/update_command.rs @@ -602,8 +602,6 @@ impl BaseCommand for UpdateCommand { } impl UpdateCommand { - /// @param array<string> $packages - /// @return array<string> fn get_packages_interactively( &self, io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>, diff --git a/crates/shirabe/src/config.rs b/crates/shirabe/src/config.rs index cb5b5ea9..f33aa24e 100644 --- a/crates/shirabe/src/config.rs +++ b/crates/shirabe/src/config.rs @@ -296,8 +296,6 @@ impl Config { } /// Merges new config values with the existing ones (overriding) - /// - /// @param array{config?: array<string, mixed>, repositories?: array<mixed>} $config pub fn merge(&mut self, config: &IndexMap<String, PhpMixed>, source: &str) { // override defaults with given config let config_section = config.get("config").cloned().unwrap_or(PhpMixed::Null); @@ -555,7 +553,6 @@ impl Config { } } - /// @return array<int|string, mixed> pub fn get_repositories(&self) -> IndexMap<String, PhpMixed> { self.repositories.clone() } @@ -564,8 +561,6 @@ impl Config { /// /// @param int $flags Options (see class constants) /// @throws \RuntimeException - /// - /// @return mixed pub fn get(&self, key: &str) -> PhpMixed { self.get_with_flags(key, 0).unwrap_or(PhpMixed::Null) } @@ -949,7 +944,6 @@ impl Config { } } - /// @return array<string, mixed[]> pub fn all(&mut self, flags: i64) -> anyhow::Result<IndexMap<String, PhpMixed>> { let mut all: IndexMap<String, PhpMixed> = IndexMap::new(); all.insert( @@ -976,7 +970,6 @@ impl Config { .unwrap_or_else(|| Self::SOURCE_UNKNOWN.to_string()) } - /// @param mixed $configValue fn set_source_of_config_value(&self, config_value: &PhpMixed, path: &str, source: &str) { self.source_of_config_value .borrow_mut() @@ -996,7 +989,6 @@ impl Config { } } - /// @return array<string, mixed[]> pub fn raw(&self) -> IndexMap<String, PhpMixed> { let mut result: IndexMap<String, PhpMixed> = IndexMap::new(); result.insert( @@ -1016,8 +1008,6 @@ impl Config { /// /// @param string|mixed $value a config string that can contain {$refs-to-other-config} /// @param int $flags Options (see class constants) - /// - /// @return string|mixed fn process(&self, value: PhpMixed, flags: i64) -> anyhow::Result<PhpMixed> { if !is_string(&value) { return Ok(value); @@ -1063,10 +1053,6 @@ impl Config { /// /// This should be used to read COMPOSER_ environment variables /// that overload config values. - /// - /// @param non-empty-string $var - /// - /// @return string|false fn get_composer_env(&self, var: &str) -> PhpMixed { if self.use_environment { return match Platform::get_env(var) { diff --git a/crates/shirabe/src/dependency_resolver/pool.rs b/crates/shirabe/src/dependency_resolver/pool.rs index a9dffe71..80534b0a 100644 --- a/crates/shirabe/src/dependency_resolver/pool.rs +++ b/crates/shirabe/src/dependency_resolver/pool.rs @@ -35,12 +35,6 @@ pub struct Pool { } impl Pool { - /// @param BasePackage[] $packages - /// @param BasePackage[] $unacceptableFixedOrLockedPackages - /// @param array<string, array<string, string>> $removedVersions - /// @param array<string, array<string, string>> $removedVersionsByPackage - /// @param array<string, array<string, array<SecurityAdvisory|PartialSecurityAdvisory>>> $securityRemovedVersions - /// @param array<string, array<string, string>> $abandonedRemovedVersions pub fn new( packages: Vec<BasePackageHandle>, unacceptable_fixed_or_locked_packages: Vec<BasePackageHandle>, @@ -67,7 +61,6 @@ impl Pool { this } - /// @return array<string, string> pub fn get_removed_versions( &self, name: &str, @@ -89,12 +82,10 @@ impl Pool { result } - /// @return array<string, array<string, string>> pub fn get_all_removed_versions(&self) -> &IndexMap<String, IndexMap<String, String>> { &self.removed_versions } - /// @return array<string, string> pub fn get_removed_versions_by_package(&self, object_hash: &str) -> IndexMap<String, String> { let Some(versions) = self.removed_versions_by_package.get(object_hash) else { return IndexMap::new(); @@ -103,7 +94,6 @@ impl Pool { versions.clone() } - /// @return array<string, array<string, string>> pub fn get_all_removed_versions_by_package( &self, ) -> &IndexMap<String, IndexMap<String, String>> { @@ -133,7 +123,6 @@ impl Pool { false } - /// @return string[] pub fn get_security_advisory_identifiers_for_package_version( &self, package_name: &str, @@ -183,21 +172,18 @@ impl Pool { false } - /// @return array<string, array<string, array<SecurityAdvisory|PartialSecurityAdvisory>>> pub fn get_all_security_removed_package_versions( &self, ) -> &IndexMap<String, IndexMap<String, Vec<std::rc::Rc<AnySecurityAdvisory>>>> { &self.security_removed_versions } - /// @return array<string, array<string, string>> pub fn get_all_abandoned_removed_package_versions( &self, ) -> &IndexMap<String, IndexMap<String, String>> { &self.abandoned_removed_versions } - /// @param BasePackage[] $packages fn set_packages(&mut self, packages: Vec<BasePackageHandle>) { let mut id: i64 = 1; @@ -216,7 +202,6 @@ impl Pool { } } - /// @return BasePackage[] pub fn get_packages(&self) -> &Vec<BasePackageHandle> { &self.packages } @@ -259,7 +244,6 @@ impl Pool { /// @param string $name The package name to be searched for /// @param ?ConstraintInterface $constraint A constraint that all returned /// packages must match or null to return all - /// @return BasePackage[] pub(crate) fn compute_what_provides( &self, name: &str, @@ -286,7 +270,6 @@ impl Pool { self.package_by_id(package_id) } - /// @param array<int, BasePackage> $installedMap pub fn literal_to_pretty_string( &self, literal: i64, @@ -376,7 +359,6 @@ impl Pool { .any(|p| p.ptr_eq(&package)) } - /// @return BasePackage[] pub fn get_unacceptable_fixed_or_locked_packages(&self) -> &Vec<BasePackageHandle> { &self.unacceptable_fixed_or_locked_packages } diff --git a/crates/shirabe/src/dependency_resolver/pool_optimizer.rs b/crates/shirabe/src/dependency_resolver/pool_optimizer.rs index 16013e34..972d2f21 100644 --- a/crates/shirabe/src/dependency_resolver/pool_optimizer.rs +++ b/crates/shirabe/src/dependency_resolver/pool_optimizer.rs @@ -423,8 +423,6 @@ impl PoolOptimizer { self.packages_to_remove.insert(id, true); } - /// @param array<string, array<string, array<string, list<BasePackage>>>> $identicalDefinitionsPerPackage - /// @param array<int, array<string, array{groupHash: string, dependencyHash: string}>> $packageIdenticalDefinitionLookup fn keep_package( &mut self, package: BasePackageHandle, @@ -626,8 +624,6 @@ impl PoolOptimizer { /// Disjunctive require constraints need to be considered in their own group. E.g. "^2.14 || ^3.3" needs to generate /// two require constraint groups in order for us to keep the best matching package for "^2.14" AND "^3.3" as otherwise, we'd /// only keep either one which can cause trouble (e.g. when using --prefer-lowest). - /// - /// @return void fn extract_require_constraints_per_package( &mut self, package: &str, @@ -644,8 +640,6 @@ impl PoolOptimizer { /// Disjunctive conflict constraints need to be considered in their own group. E.g. "^2.14 || ^3.3" needs to generate /// two conflict constraint groups in order for us to keep the best matching package for "^2.14" AND "^3.3" as otherwise, we'd /// only keep either one which can cause trouble (e.g. when using --prefer-lowest). - /// - /// @return void fn extract_conflict_constraints_per_package( &mut self, package: &str, @@ -659,7 +653,6 @@ impl PoolOptimizer { } } - /// @return ConstraintInterface[] fn expand_disjunctive_multi_constraints( &self, constraint: AnyConstraint, diff --git a/crates/shirabe/src/dependency_resolver/rule.rs b/crates/shirabe/src/dependency_resolver/rule.rs index 4ed8619c..0ed442ce 100644 --- a/crates/shirabe/src/dependency_resolver/rule.rs +++ b/crates/shirabe/src/dependency_resolver/rule.rs @@ -129,12 +129,10 @@ impl Rule { } } - /// @return self::RULE_* pub fn get_reason(&self) -> i64 { (self.bitfield() & (255 << BITFIELD_REASON)) >> BITFIELD_REASON } - /// @phpstan-return ReasonData pub fn get_reason_data(&self) -> &ReasonData { self.reason_data() } @@ -157,7 +155,6 @@ impl Rule { } } - /// @param RuleSet::TYPE_* $type pub fn set_type(&mut self, r#type: i64) { *self.bitfield_mut() = (self.bitfield() & !(255i64 << BITFIELD_TYPE)) | ((255 & r#type) << BITFIELD_TYPE); @@ -302,8 +299,6 @@ impl Rule { } } - /// @param BasePackage[] $installedMap - /// @param array<Rule[]> $learnedPool pub fn get_pretty_string( &self, repository_set: &RepositorySet, diff --git a/crates/shirabe/src/dependency_resolver/transaction.rs b/crates/shirabe/src/dependency_resolver/transaction.rs index 4abe85d4..78037338 100644 --- a/crates/shirabe/src/dependency_resolver/transaction.rs +++ b/crates/shirabe/src/dependency_resolver/transaction.rs @@ -47,8 +47,6 @@ impl Default for Transaction { } impl Transaction { - /// @param PackageInterface[] $presentPackages - /// @param PackageInterface[] $resultPackages pub fn new( present_packages: Vec<PackageInterfaceHandle>, result_packages: Vec<PackageInterfaceHandle>, @@ -68,7 +66,6 @@ impl Transaction { &self.operations } - /// @param PackageInterface[] $resultPackages fn set_result_package_maps(&mut self, result_packages: Vec<PackageInterfaceHandle>) { let package_sort = |a: &PackageInterfaceHandle, b: &PackageInterfaceHandle| -> i64 { // sort alias packages by the same name behind their non alias version @@ -107,7 +104,6 @@ impl Transaction { } } - /// @return OperationInterface[] pub(crate) fn calculate_operations(&mut self) -> Vec<AnyOperation> { let mut operations: Vec<AnyOperation> = vec![]; @@ -222,8 +218,6 @@ 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 - /// - /// @return array<string, PackageInterface> pub(crate) fn get_root_packages(&self) -> IndexMap<String, PackageInterfaceHandle> { let mut roots: IndexMap<String, PackageInterfaceHandle> = self .result_package_map @@ -251,7 +245,6 @@ impl Transaction { roots } - /// @return PackageInterface[] pub(crate) fn get_providers_in_result(&self, link: &Link) -> Vec<PackageInterfaceHandle> { let Some(packages) = self.result_packages_by_name.get(link.get_target()) else { return vec![]; @@ -269,7 +262,6 @@ impl Transaction { /// it at least fixes the symptoms and makes usage of composer possible (again) /// in such scenarios. /// - /// @param OperationInterface[] $operations /// @return OperationInterface[] reordered operation list fn move_plugins_to_front(&self, mut operations: Vec<AnyOperation>) -> Vec<AnyOperation> { let mut dl_modifying_plugins_no_deps: Vec<AnyOperation> = vec![]; @@ -370,7 +362,6 @@ impl Transaction { /// Removals of packages should be executed before installations in /// case two packages resolve to the same path (due to custom installers) /// - /// @param OperationInterface[] $operations /// @return OperationInterface[] reordered operation list fn move_uninstalls_to_front(&self, mut operations: Vec<AnyOperation>) -> Vec<AnyOperation> { let mut uninst_ops: Vec<AnyOperation> = vec![]; diff --git a/crates/shirabe/src/downloader/download_manager.rs b/crates/shirabe/src/downloader/download_manager.rs index 2aa9c74e..ea3fed41 100644 --- a/crates/shirabe/src/downloader/download_manager.rs +++ b/crates/shirabe/src/downloader/download_manager.rs @@ -180,7 +180,6 @@ impl DownloadManager { /// @param PackageInterface $package package instance /// @param string $targetDir target dir /// @param PackageInterface|null $prevPackage previous package instance in case of updates - /// @phpstan-return PromiseInterface<void|null> /// /// @throws \InvalidArgumentException if package have no urls to download from /// @throws \RuntimeException @@ -270,7 +269,6 @@ impl DownloadManager { /// @param PackageInterface $package package instance /// @param string $targetDir target dir /// @param PackageInterface|null $prevPackage previous package instance in case of updates - /// @phpstan-return PromiseInterface<void|null> pub async fn prepare( &self, r#type: &str, @@ -293,7 +291,6 @@ impl DownloadManager { /// /// @param PackageInterface $package package instance /// @param string $targetDir target dir - /// @phpstan-return PromiseInterface<void|null> /// /// @throws \InvalidArgumentException if package have no urls to download from /// @throws \RuntimeException @@ -315,7 +312,6 @@ impl DownloadManager { /// @param PackageInterface $initial initial package version /// @param PackageInterface $target target package version /// @param string $targetDir target dir - /// @phpstan-return PromiseInterface<void|null> /// /// @throws \InvalidArgumentException if initial package is not installed pub async fn update( @@ -398,7 +394,6 @@ impl DownloadManager { /// /// @param PackageInterface $package package instance /// @param string $targetDir target dir - /// @phpstan-return PromiseInterface<void|null> pub async fn remove( &self, package: PackageInterfaceHandle, @@ -418,7 +413,6 @@ impl DownloadManager { /// @param PackageInterface $package package instance /// @param string $targetDir target dir /// @param PackageInterface|null $prevPackage previous package instance in case of updates - /// @phpstan-return PromiseInterface<void|null> pub async fn cleanup( &self, r#type: &str, @@ -465,8 +459,6 @@ impl DownloadManager { } } - /// @return string[] - /// @phpstan-return array<'dist'|'source'>&non-empty-array fn get_available_sources( &self, package: PackageInterfaceHandle, diff --git a/crates/shirabe/src/downloader/file_downloader.rs b/crates/shirabe/src/downloader/file_downloader.rs index 19ce8b4a..48925b4b 100644 --- a/crates/shirabe/src/downloader/file_downloader.rs +++ b/crates/shirabe/src/downloader/file_downloader.rs @@ -720,7 +720,6 @@ impl FileDownloader { } impl FileDownloader { - /// @param PATHINFO_EXTENSION|PATHINFO_BASENAME $component fn get_dist_path(&self, package: PackageInterfaceHandle, component: i64) -> String { pathinfo( PhpMixed::String( diff --git a/crates/shirabe/src/downloader/git_downloader.rs b/crates/shirabe/src/downloader/git_downloader.rs index fe725507..e9c70da3 100644 --- a/crates/shirabe/src/downloader/git_downloader.rs +++ b/crates/shirabe/src/downloader/git_downloader.rs @@ -557,7 +557,6 @@ impl GitDownloader { } } - /// @phpstan-return PromiseInterface<void|null> /// @throws \RuntimeException pub(crate) async fn discard_changes(&self, path: &str) -> anyhow::Result<Option<PhpMixed>> { let path = self.normalize_path(path); @@ -593,7 +592,6 @@ impl GitDownloader { Ok(None) } - /// @phpstan-return PromiseInterface<void|null> /// @throws \RuntimeException pub(crate) async fn stash_changes(&self, path: &str) -> anyhow::Result<Option<PhpMixed>> { let path = self.normalize_path(path); diff --git a/crates/shirabe/src/installed_versions.rs b/crates/shirabe/src/installed_versions.rs index 3cda1c43..ce78f013 100644 --- a/crates/shirabe/src/installed_versions.rs +++ b/crates/shirabe/src/installed_versions.rs @@ -40,9 +40,6 @@ static INSTALLED_BY_VENDOR: std::sync::LazyLock< impl InstalledVersions { /// Returns a list of all package names which are present, either by being installed, replaced or provided - /// - /// @return string[] - /// @psalm-return list<string> pub fn get_installed_packages() -> Vec<String> { let mut packages: Vec<Vec<String>> = vec![]; for installed in Self::get_installed() { @@ -75,10 +72,6 @@ impl InstalledVersions { } /// Returns a list of all package names with a specific type e.g. 'library' - /// - /// @param string $type - /// @return string[] - /// @psalm-return list<string> pub fn get_installed_packages_by_type(r#type: &str) -> Vec<String> { let mut packages_by_type: Vec<String> = vec![]; @@ -104,10 +97,6 @@ impl InstalledVersions { /// Checks whether the given package is installed /// /// This also returns true if the package name is provided or replaced by another package - /// - /// @param string $packageName - /// @param bool $includeDevRequirements - /// @return bool pub fn is_installed(package_name: &str, include_dev_requirements: bool) -> bool { for installed in Self::get_installed() { let Some(versions) = installed.get("versions").and_then(|v| v.as_array()) else { @@ -135,9 +124,7 @@ impl InstalledVersions { /// Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') /// /// @param VersionParser $parser Install composer/semver to have access to this class and functionality - /// @param string $packageName /// @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package - /// @return bool pub fn satisfies( parser: &VersionParser, package_name: &str, @@ -154,7 +141,6 @@ impl InstalledVersions { /// It is easier to use this via isInstalled() with the $constraint argument if you need to check /// whether a given version of a package is installed, and not just whether it exists /// - /// @param string $packageName /// @return string Version constraint usable with composer/semver pub fn get_version_ranges(package_name: &str) -> anyhow::Result<String> { for installed in Self::get_installed() { @@ -223,7 +209,6 @@ impl InstalledVersions { .into()) } - /// @param string $packageName /// @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present pub fn get_version(package_name: &str) -> anyhow::Result<Option<String>> { for installed in Self::get_installed() { @@ -251,7 +236,6 @@ impl InstalledVersions { .into()) } - /// @param string $packageName /// @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present pub fn get_pretty_version(package_name: &str) -> anyhow::Result<Option<String>> { for installed in Self::get_installed() { @@ -279,7 +263,6 @@ impl InstalledVersions { .into()) } - /// @param string $packageName /// @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference pub fn get_reference(package_name: &str) -> anyhow::Result<Option<String>> { for installed in Self::get_installed() { @@ -307,7 +290,6 @@ impl InstalledVersions { .into()) } - /// @param string $packageName /// @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. pub fn get_install_path(package_name: &str) -> anyhow::Result<Option<String>> { for installed in Self::get_installed() { @@ -334,8 +316,6 @@ impl InstalledVersions { .into()) } - /// @return array - /// @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} pub fn get_root_package() -> IndexMap<String, PhpMixed> { let installed = Self::get_installed(); @@ -348,7 +328,6 @@ impl InstalledVersions { /// Returns the raw data of all installed.php which are currently loaded for custom implementations /// - /// @return array[] /// Returns the first dataset loaded, which may not be what you expect. Use get_all_raw_data /// instead, which returns all datasets for all autoloaders present in the process. pub fn get_raw_data() -> IndexMap<String, PhpMixed> { @@ -380,7 +359,6 @@ impl InstalledVersions { /// interference between PHPUnit's dependencies and the project's dependencies. /// /// @param array[] $data A vendor/composer/installed.php data set - /// @return void pub fn reload(data: IndexMap<String, PhpMixed>) { *INSTALLED.lock().unwrap() = Some(data); *INSTALLED_BY_VENDOR.lock().unwrap() = IndexMap::new(); @@ -402,7 +380,6 @@ impl InstalledVersions { *INSTALLED_IS_LOCAL_DIR.lock().unwrap() = value; } - /// @return string fn get_self_dir() -> String { let mut self_dir = SELF_DIR.lock().unwrap(); if self_dir.is_none() { @@ -416,8 +393,6 @@ impl InstalledVersions { self_dir.clone().unwrap() } - /// @return array[] - /// @psalm-return list<array{root: ..., versions: ...}> fn get_installed() -> Vec<IndexMap<String, PhpMixed>> { { let mut can_get_vendors = CAN_GET_VENDORS.lock().unwrap(); diff --git a/crates/shirabe/src/installer/binary_installer.rs b/crates/shirabe/src/installer/binary_installer.rs index 1fc5af0d..81f58b84 100644 --- a/crates/shirabe/src/installer/binary_installer.rs +++ b/crates/shirabe/src/installer/binary_installer.rs @@ -219,7 +219,6 @@ impl BinaryInstaller { "php".to_string() } - /// @return string[] pub(crate) fn get_binaries(&self, package: PackageInterfaceHandle) -> Vec<String> { package.get_binaries() } diff --git a/crates/shirabe/src/installer/library_installer.rs b/crates/shirabe/src/installer/library_installer.rs index a037fac9..e53b9546 100644 --- a/crates/shirabe/src/installer/library_installer.rs +++ b/crates/shirabe/src/installer/library_installer.rs @@ -142,8 +142,6 @@ impl LibraryInstaller { install_path } - /// @return PromiseInterface|null - /// @phpstan-return PromiseInterface<void|null>|null pub(crate) async fn install_code( &self, package: PackageInterfaceHandle, @@ -156,8 +154,6 @@ impl LibraryInstaller { .await } - /// @return PromiseInterface|null - /// @phpstan-return PromiseInterface<void|null>|null pub(crate) async fn update_code( &self, initial: PackageInterfaceHandle, @@ -187,8 +183,6 @@ impl LibraryInstaller { .await } - /// @return PromiseInterface|null - /// @phpstan-return PromiseInterface<void|null>|null pub(crate) async fn remove_code( &self, package: PackageInterfaceHandle, diff --git a/crates/shirabe/src/json/json_file.rs b/crates/shirabe/src/json/json_file.rs index e37ba10c..1d6a75ce 100644 --- a/crates/shirabe/src/json/json_file.rs +++ b/crates/shirabe/src/json/json_file.rs @@ -135,7 +135,6 @@ impl JsonFile { /// /// @throws ParsingException /// @throws \RuntimeException - /// @return mixed pub fn read(&self) -> anyhow::Result<PhpMixed> { let json: Option<String> = match (|| -> anyhow::Result<Option<String>> { if let Some(http_downloader) = &self.http_downloader { @@ -281,8 +280,6 @@ impl JsonFile { } /// Modify file properties only if content modified - /// - /// @return int|false fn file_put_contents_if_modified( &self, path: &str, @@ -306,8 +303,6 @@ impl JsonFile { /// @throws JsonValidationException /// @throws ParsingException /// @return true true on success - /// - /// @phpstan-param self::*_SCHEMA $schema pub fn validate_schema(&self, schema: i64, schema_file: Option<&str>) -> anyhow::Result<bool> { if !Filesystem::is_readable(&self.path) { return Err(RuntimeException { @@ -333,8 +328,6 @@ impl JsonFile { /// @param string|null $schemaFile a path to the schema file /// @throws JsonValidationException /// @return true true on success - /// - /// @phpstan-param self::*_SCHEMA $schema pub fn validate_json_schema( source: &str, data: &PhpMixed, @@ -487,7 +480,6 @@ impl JsonFile { /// @param string $file the json file /// /// @throws ParsingException - /// @return mixed pub fn parse_json(json: Option<&str>, file: Option<&str>) -> anyhow::Result<PhpMixed> { let json = match json { None => return Ok(PhpMixed::Null), diff --git a/crates/shirabe/src/package/alias_package.rs b/crates/shirabe/src/package/alias_package.rs index ef503b16..8073f3ff 100644 --- a/crates/shirabe/src/package/alias_package.rs +++ b/crates/shirabe/src/package/alias_package.rs @@ -120,10 +120,6 @@ impl AliasPackage { self.root_package_alias } - /// @param Link[] $links - /// @param Link::TYPE_* $linkType - /// - /// @return Link[] pub(crate) fn replace_self_version_dependencies( &mut self, mut links: IndexMap<String, Link>, @@ -266,19 +262,16 @@ impl PackageInterface for AliasPackage { } /// @inheritDoc - /// @return array<string, Link> fn get_conflicts(&self) -> IndexMap<String, Link> { self.conflicts.clone() } /// @inheritDoc - /// @return array<string, Link> fn get_provides(&self) -> IndexMap<String, Link> { self.provides.clone() } /// @inheritDoc - /// @return array<string, Link> fn get_replaces(&self) -> IndexMap<String, Link> { self.replaces.clone() } diff --git a/crates/shirabe/src/package/loader/array_loader.rs b/crates/shirabe/src/package/loader/array_loader.rs index 3ebdc488..f0399e89 100644 --- a/crates/shirabe/src/package/loader/array_loader.rs +++ b/crates/shirabe/src/package/loader/array_loader.rs @@ -189,9 +189,6 @@ impl LoaderInterface for ArrayLoader { } impl ArrayLoader { - /// @param array<array<mixed>> $versions - /// - /// @return list<CompletePackage|CompleteAliasPackage> #[tracing::instrument(skip_all)] pub fn load_packages( &self, @@ -773,10 +770,6 @@ impl ArrayLoader { /// @param string $sourceVersion source package version (pretty version ideally) /// @param string $description link description (e.g. requires, replaces, ..) /// @param array<string|int, string> $links array of package name => constraint mappings - /// - /// @return Link[] - /// - /// @phpstan-param Link::TYPE_* $description pub fn parse_links( &self, source: &str, diff --git a/crates/shirabe/src/package/locker.rs b/crates/shirabe/src/package/locker.rs index d2d1b109..f06f2bdc 100644 --- a/crates/shirabe/src/package/locker.rs +++ b/crates/shirabe/src/package/locker.rs @@ -339,7 +339,6 @@ impl Locker { Ok(requirements.into_iter().map(|(_, v)| v).collect()) } - /// @return key-of<BasePackage::STABILITIES> pub fn get_minimum_stability(&mut self) -> anyhow::Result<String> { let lock_data = self.get_lock_data()?; @@ -382,7 +381,6 @@ impl Locker { Ok(lock_data.get("prefer-lowest").and_then(|v| v.as_bool())) } - /// @return array<string, string> pub fn get_platform_overrides(&mut self) -> anyhow::Result<IndexMap<String, String>> { let lock_data = self.get_lock_data()?; @@ -399,7 +397,6 @@ impl Locker { .unwrap_or_default()) } - /// @return string[][] pub fn get_aliases(&mut self) -> anyhow::Result<Vec<IndexMap<String, String>>> { let lock_data = self.get_lock_data()?; @@ -435,7 +432,6 @@ impl Locker { .to_string()) } - /// @return array<string, mixed> pub fn get_lock_data(&mut self) -> anyhow::Result<IndexMap<String, PhpMixed>> { if let Some(cache) = self.lock_data_cache.borrow().clone() { return Ok(cache); @@ -719,7 +715,6 @@ impl Locker { lock_data } - /// @param PackageInterface[] $packages fn lock_packages(&mut self, packages: &[PackageInterfaceHandle]) -> anyhow::Result<PhpMixed> { let mut locked: Vec<IndexMap<String, PhpMixed>> = vec![]; @@ -891,7 +886,6 @@ impl Locker { Ok(datetime.map(|d| d.format(DATE_RFC3339).to_string())) } - /// @return array<string> pub fn get_missing_requirement_info( &mut self, package: RootPackageInterfaceHandle, diff --git a/crates/shirabe/src/package/package_interface.rs b/crates/shirabe/src/package/package_interface.rs index 8c9213c0..ffbec286 100644 --- a/crates/shirabe/src/package/package_interface.rs +++ b/crates/shirabe/src/package/package_interface.rs @@ -76,13 +76,11 @@ pub trait PackageInterface: std::fmt::Display + std::fmt::Debug { /// Sets source from which this package was installed (source/dist). /// /// @param ?string $type source/dist - /// @phpstan-param 'source'|'dist'|null $type fn set_installation_source(&mut self, r#type: Option<String>); /// Returns source from which this package was installed (source/dist). /// /// @return ?string source/dist - /// @phpstan-return 'source'|'dist'|null fn get_installation_source(&self) -> Option<String>; /// Returns the repository type of this package, e.g. git, svn @@ -96,8 +94,6 @@ pub trait PackageInterface: std::fmt::Display + std::fmt::Debug { fn get_source_url(&self) -> Option<String>; /// Returns the repository urls of this package including mirrors, e.g. git://github.com/naderman/composer.git - /// - /// @return list<string> fn get_source_urls(&self) -> Vec<String>; /// Returns the repository reference of this package, e.g. master, 1.0.0 or a commit hash for git @@ -106,11 +102,8 @@ pub trait PackageInterface: std::fmt::Display + std::fmt::Debug { fn get_source_reference(&self) -> Option<String>; /// Returns the source mirrors of this package - /// - /// @return ?list<array{url: non-empty-string, preferred: bool}> fn get_source_mirrors(&self) -> Option<Vec<Mirror>>; - /// @param null|list<array{url: non-empty-string, preferred: bool}> $mirrors fn set_source_mirrors(&mut self, mirrors: Option<Vec<Mirror>>); /// Returns the type of the distribution archive of this version, e.g. zip, tarball @@ -119,13 +112,9 @@ pub trait PackageInterface: std::fmt::Display + std::fmt::Debug { fn get_dist_type(&self) -> Option<String>; /// Returns the url of the distribution archive of this version - /// - /// @return ?non-empty-string fn get_dist_url(&self) -> Option<String>; /// Returns the urls of the distribution archive of this version, including mirrors - /// - /// @return non-empty-string[] fn get_dist_urls(&self) -> Vec<String>; /// Returns the reference of the distribution archive of this version, e.g. master, 1.0.0 or a commit hash for git @@ -137,11 +126,8 @@ pub trait PackageInterface: std::fmt::Display + std::fmt::Debug { fn get_dist_sha1_checksum(&self) -> Option<String>; /// Returns the dist mirrors of this package - /// - /// @return ?list<array{url: non-empty-string, preferred: bool}> fn get_dist_mirrors(&self) -> Option<Vec<Mirror>>; - /// @param null|list<array{url: non-empty-string, preferred: bool}> $mirrors fn set_dist_mirrors(&mut self, mirrors: Option<Vec<Mirror>>); /// Returns the version of this package @@ -167,8 +153,6 @@ pub trait PackageInterface: std::fmt::Display + std::fmt::Debug { fn get_release_date(&self) -> Option<DateTime<Utc>>; /// Returns the stability of this package: one of (dev, alpha, beta, RC, stable) - /// - /// @phpstan-return 'stable'|'RC'|'beta'|'alpha'|'dev' fn get_stability(&self) -> &str; /// Returns a set of links to packages which need to be installed before @@ -205,7 +189,6 @@ pub trait PackageInterface: std::fmt::Display + std::fmt::Debug { /// combination with this package. /// /// @return array An array of package suggestions with descriptions - /// @phpstan-return array<string, string> fn get_suggests(&self) -> IndexMap<String, String>; /// PHP helper that switches on the link kind (require/require-dev/conflict/etc.). @@ -228,7 +211,6 @@ pub trait PackageInterface: std::fmt::Display + std::fmt::Debug { /// directories for autoloading using the type specified. /// /// @return array Mapping of autoloading rules - /// @phpstan-return AutoloadRules fn get_autoload(&self) -> IndexMap<String, PhpMixed>; /// Returns an associative array of dev autoloading rules @@ -239,18 +221,13 @@ pub trait PackageInterface: std::fmt::Display + std::fmt::Debug { /// directories for autoloading using the type specified. /// /// @return array Mapping of dev autoloading rules - /// @phpstan-return DevAutoloadRules fn get_dev_autoload(&self) -> IndexMap<String, PhpMixed>; /// Returns a list of directories which should get added to PHP's /// include path. - /// - /// @return string[] fn get_include_paths(&self) -> Vec<String>; /// Returns the settings for php extension packages - /// - /// @phpstan-return PhpExtConfig|null fn get_php_ext(&self) -> Option<IndexMap<String, PhpMixed>>; /// Stores a reference to the repository that owns the package @@ -260,8 +237,6 @@ pub trait PackageInterface: std::fmt::Display + std::fmt::Debug { fn get_repository(&self) -> Option<RepositoryInterfaceHandle>; /// Returns the package binaries - /// - /// @return string[] fn get_binaries(&self) -> Vec<String>; /// Returns package unique name, constructed from name and version. @@ -278,13 +253,9 @@ pub trait PackageInterface: std::fmt::Display + std::fmt::Debug { fn is_default_branch(&self) -> bool; /// Returns a list of options to download package dist files - /// - /// @return mixed[] fn get_transport_options(&self) -> IndexMap<String, PhpMixed>; /// Configures the list of options to download package dist files - /// - /// @param mixed[] $options fn set_transport_options(&mut self, options: IndexMap<String, PhpMixed>); fn set_source_reference(&mut self, reference: Option<String>); diff --git a/crates/shirabe/src/package/version/version_guesser.rs b/crates/shirabe/src/package/version/version_guesser.rs index 22b78a59..98853952 100644 --- a/crates/shirabe/src/package/version/version_guesser.rs +++ b/crates/shirabe/src/package/version/version_guesser.rs @@ -94,10 +94,7 @@ impl VersionGuesser { } } - /// @param array<string, mixed> $packageConfig /// @param string $path Path to guess into - /// - /// @phpstan-return Version|null pub fn guess_version( &mut self, package_config: &IndexMap<String, PhpMixed>, @@ -145,9 +142,6 @@ impl VersionGuesser { Ok(None) } - /// @phpstan-param Version $versionData - /// - /// @phpstan-return Version fn postprocess(&self, mut version_data: VersionData) -> VersionData { // PHP: !empty($versionData['feature_version']) && $versionData['feature_version'] === $versionData['version'] && $versionData['feature_pretty_version'] === $versionData['pretty_version'] let feature_matches = version_data @@ -202,9 +196,6 @@ impl VersionGuesser { version_data } - /// @param array<string, mixed> $packageConfig - /// - /// @return array{version: string|null, commit: string|null, pretty_version: string|null, feature_version?: string|null, feature_pretty_version?: string|null} fn guess_git_version( &mut self, package_config: &IndexMap<String, PhpMixed>, @@ -370,7 +361,6 @@ impl VersionGuesser { }) } - /// @return array{version: string, pretty_version: string}|null fn version_from_git_tags(&mut self, path: &str) -> anyhow::Result<Option<(String, String)>> { // try to fetch current version from git tags let mut output = String::new(); @@ -393,9 +383,6 @@ impl VersionGuesser { Ok(None) } - /// @param array<string, mixed> $packageConfig - /// - /// @return array{version: string|null, commit: ''|null, pretty_version: string|null, feature_version?: string|null, feature_pretty_version?: string|null}|null fn guess_hg_version( &mut self, package_config: &IndexMap<String, PhpMixed>, @@ -486,11 +473,6 @@ impl VersionGuesser { Ok(None) } - /// @param array<string, mixed> $packageConfig - /// @param list<string> $branches - /// @param list<string> $scmCmdline - /// - /// @return array{version: string|null, pretty_version: string|null} fn guess_feature_version( &mut self, package_config: &IndexMap<String, PhpMixed>, @@ -613,7 +595,6 @@ impl VersionGuesser { }) } - /// @param array<string, mixed> $packageConfig fn is_feature_branch( &self, package_config: &IndexMap<String, PhpMixed>, @@ -642,7 +623,6 @@ impl VersionGuesser { ) } - /// @return array{version: string|null, commit: '', pretty_version: string|null} fn guess_fossil_version(&mut self, path: &str) -> anyhow::Result<VersionData> { let mut version: Option<String> = None; let mut pretty_version: Option<String> = None; @@ -688,9 +668,6 @@ impl VersionGuesser { }) } - /// @param array<string, mixed> $packageConfig - /// - /// @return array{version: string, commit: '', pretty_version: string}|null fn guess_svn_version( &mut self, package_config: &IndexMap<String, PhpMixed>, diff --git a/crates/shirabe/src/repository/array_repository.rs b/crates/shirabe/src/repository/array_repository.rs index c05434fc..ed48b0cb 100644 --- a/crates/shirabe/src/repository/array_repository.rs +++ b/crates/shirabe/src/repository/array_repository.rs @@ -116,7 +116,6 @@ impl ArrayRepository { Ok(packages) } - /// @param array<PackageInterface> $packages pub fn new(packages: Vec<PackageInterfaceHandle>) -> anyhow::Result<Self> { let this = Self { packages: std::cell::RefCell::new(None), @@ -158,7 +157,6 @@ impl ArrayRepository { Ok(()) } - /// @return AliasPackage|CompleteAliasPackage pub(crate) fn create_alias_package( &self, package: BasePackageHandle, diff --git a/crates/shirabe/src/repository/filesystem_repository.rs b/crates/shirabe/src/repository/filesystem_repository.rs index b8ee30c6..7ecd0664 100644 --- a/crates/shirabe/src/repository/filesystem_repository.rs +++ b/crates/shirabe/src/repository/filesystem_repository.rs @@ -381,7 +381,6 @@ impl FilesystemRepository { true } - /// @param array<mixed> $array fn dump_to_php_code(&self, array: &IndexMap<String, PhpMixed>, level: i64) -> String { let mut lines = String::from("array(\n"); let level = level + 1; @@ -448,7 +447,6 @@ impl FilesystemRepository { lines } - /// @param array<string, string> $installPaths fn generate_installed_versions( &mut self, installation_manager: &dyn InstallationManagerInterface, @@ -612,9 +610,6 @@ impl FilesystemRepository { Ok(versions) } - /// @param array<string, string> $installPaths - /// @param array<string, int> $devPackages - /// @return array{pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev_requirement: bool} fn dump_installed_package( &self, package: PackageInterfaceHandle, @@ -693,9 +688,6 @@ impl FilesystemRepository { data } - /// @param array<string, string> $installPaths - /// @param array<string, int> $devPackages - /// @return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} fn dump_root_package( &self, package: RootPackageInterfaceHandle, diff --git a/crates/shirabe/src/repository/repository_set.rs b/crates/shirabe/src/repository/repository_set.rs index 8443400f..def73f14 100644 --- a/crates/shirabe/src/repository/repository_set.rs +++ b/crates/shirabe/src/repository/repository_set.rs @@ -89,15 +89,9 @@ impl RepositorySet { /// passing minimumStability is all you need to worry about. The rest is for advanced pool creation including /// aliases, pinned references and other special cases. /// - /// @param key-of<BasePackage::STABILITIES> $minimumStability /// @param int[] $stabilityFlags an array of package name => BasePackage::STABILITY_* value - /// @phpstan-param array<string, BasePackage::STABILITY_*> $stabilityFlags - /// @param array[] $rootAliases - /// @phpstan-param list<array{package: string, version: string, alias: string, alias_normalized: string}> $rootAliases /// @param string[] $rootReferences an array of package name => source reference - /// @phpstan-param array<string, string> $rootReferences /// @param ConstraintInterface[] $rootRequires an array of package name => constraint from the root package - /// @phpstan-param array<string, ConstraintInterface> $rootRequires /// @param array<string, ConstraintInterface> $temporaryConstraints Runtime temporary constraints that will be used to filter packages pub fn new( minimum_stability: &str, @@ -144,7 +138,6 @@ impl RepositorySet { } /// @return ConstraintInterface[] an array of package name => constraint from the root package, platform requirements excluded - /// @phpstan-return array<string, ConstraintInterface> pub fn get_root_requires(&self) -> &IndexMap<String, AnyConstraint> { &self.root_requires } @@ -191,7 +184,6 @@ impl RepositorySet { /// Returned in the order of repositories, matching priority /// /// @param int $flags any of the ALLOW_* constants from this class to tweak what is returned - /// @return BasePackage[] pub fn find_packages( &self, name: &str, @@ -268,8 +260,6 @@ impl RepositorySet { Ok(result) } - /// @param string[] $packageNames - /// @return ($allowPartialAdvisories is true ? array{advisories: array<string, array<PartialSecurityAdvisory|SecurityAdvisory>>, unreachableRepos: array<string>} : array{advisories: array<string, array<SecurityAdvisory>>, unreachableRepos: array<string>}) pub fn get_security_advisories( &self, package_names: Vec<String>, @@ -295,8 +285,6 @@ impl RepositorySet { }) } - /// @param PackageInterface[] $packages - /// @return ($allowPartialAdvisories is true ? array{advisories: array<string, array<PartialSecurityAdvisory|SecurityAdvisory>>, unreachableRepos: array<string>} : array{advisories: array<string, array<SecurityAdvisory>>, unreachableRepos: array<string>}) #[tracing::instrument(skip_all)] pub fn get_matching_security_advisories( &self, @@ -354,9 +342,7 @@ impl RepositorySet { }) } - /// @param array<string, ConstraintInterface> $packageConstraintMap /// @param array<string> &$unreachableRepos Array to store messages about unreachable repositories - /// @return ($allowPartialAdvisories is true ? array<string, array<PartialSecurityAdvisory|SecurityAdvisory>> : array<string, array<SecurityAdvisory>>) fn get_security_advisories_for_constraints( &self, package_constraint_map: IndexMap<String, AnyConstraint>, @@ -417,7 +403,6 @@ impl RepositorySet { } /// @return array[] an array with the provider name as key and value of array('name' => '...', 'description' => '...', 'type' => '...') - /// @phpstan-return array<string, array{name: string, description: string|null, type: string}> pub fn get_providers( &self, package_name: &str, @@ -435,7 +420,6 @@ impl RepositorySet { /// Check for each given package name whether it would be accepted by this RepositorySet in the given $stability /// - /// @param string[] $names /// @param key-of<BasePackage::STABILITIES> $stability one of 'stable', 'RC', 'beta', 'alpha' or 'dev' pub fn is_package_acceptable(&self, names: &[String], stability: &str) -> bool { StabilityFilter::is_package_acceptable( @@ -588,7 +572,6 @@ impl RepositorySet { self.create_pool_for_packages(vec![package_name.to_string()], locked_repo) } - /// @param string[] $packageNames pub fn create_pool_for_packages( &mut self, package_names: Vec<String>, @@ -625,10 +608,6 @@ impl RepositorySet { ) } - /// @param array[] $aliases - /// @phpstan-param list<array{package: string, version: string, alias: string, alias_normalized: string}> $aliases - /// - /// @return array<string, array<string, array{alias: string, alias_normalized: string}>> fn get_root_aliases_per_package( aliases: Vec<RootAliasInput>, ) -> IndexMap<String, IndexMap<String, RootAliasEntry>> { diff --git a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs index 394077e9..87cf7c44 100644 --- a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs +++ b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs @@ -741,7 +741,6 @@ impl GitBitbucketDriver { /// @phpstan-impure /// - /// @return true /// @throws \RuntimeException fn attempt_clone_fallback(&mut self) -> anyhow::Result<bool> { match self.setup_fallback_driver(&self.generate_ssh_url()) { @@ -775,7 +774,6 @@ impl GitBitbucketDriver { Ok(()) } - /// @param array<array{name: string, href: string}> $cloneLinks fn parse_clone_urls(&mut self, clone_links: Option<PhpMixed>) { let list = match clone_links { Some(PhpMixed::List(l)) => l, diff --git a/crates/shirabe/src/repository/vcs/github_driver.rs b/crates/shirabe/src/repository/vcs/github_driver.rs index 8134a16b..c7b84e51 100644 --- a/crates/shirabe/src/repository/vcs/github_driver.rs +++ b/crates/shirabe/src/repository/vcs/github_driver.rs @@ -416,7 +416,6 @@ impl GitHubDriver { .unwrap_or(None)) } - /// @return array<int, array{type: string, url: string}>|false fn get_funding_info(&mut self) -> PhpMixed { if let Some(ref info) = self.funding_info { return info.clone(); @@ -996,8 +995,6 @@ impl GitHubDriver { } /// Gives back the loaded <github-api>/repos/<owner>/<repo> result - /// - /// @return mixed[]|null pub fn get_repo_data(&mut self) -> anyhow::Result<Option<IndexMap<String, PhpMixed>>> { self.fetch_root_identifier()?; @@ -1234,7 +1231,6 @@ impl GitHubDriver { /// @phpstan-impure /// - /// @return true /// @throws \RuntimeException pub(crate) fn attempt_clone_fallback( &mut self, diff --git a/crates/shirabe/src/repository/vcs/gitlab_driver.rs b/crates/shirabe/src/repository/vcs/gitlab_driver.rs index 9a4c22a1..35d0b5ca 100644 --- a/crates/shirabe/src/repository/vcs/gitlab_driver.rs +++ b/crates/shirabe/src/repository/vcs/gitlab_driver.rs @@ -721,7 +721,6 @@ impl GitLabDriver { /// @phpstan-impure /// - /// @return true /// @throws \RuntimeException pub(crate) fn attempt_clone_fallback(&mut self) -> anyhow::Result<bool> { let url = if !self.is_private { @@ -1030,8 +1029,6 @@ impl GitLabDriver { } /// Gives back the loaded <gitlab-api>/projects/<owner>/<repo> result - /// - /// @return mixed[]|null pub fn get_repo_data(&mut self) -> anyhow::Result<Option<IndexMap<String, PhpMixed>>> { self.fetch_project()?; @@ -1061,10 +1058,6 @@ impl GitLabDriver { None } - /// @param array<string> $configuredDomains - /// @param array<string> $urlParts - /// - /// @return string|false fn determine_origin( configured_domains: &PhpMixed, guessed_domain: String, diff --git a/crates/shirabe/src/repository/vcs_repository.rs b/crates/shirabe/src/repository/vcs_repository.rs index 7ce00ce5..059d4dbd 100644 --- a/crates/shirabe/src/repository/vcs_repository.rs +++ b/crates/shirabe/src/repository/vcs_repository.rs @@ -265,12 +265,10 @@ impl VcsRepository { self.branch_error_occurred.get() } - /// @return list<string> pub fn get_empty_references(&self) -> Vec<String> { self.empty_references.borrow().clone() } - /// @return array<'tags'|'branches', array<string, TransportException>> pub fn get_version_transport_exceptions( &self, ) -> IndexMap<String, IndexMap<String, TransportException>> { @@ -835,9 +833,6 @@ impl VcsRepository { Ok(()) } - /// @param array{name?: string, dist?: array{type: string, url: string, reference: string, shasum: string}, source?: array{type: string, url: string, reference: string}} $data - /// - /// @return array{name: string|null, dist: array{type: string, url: string, reference: string, shasum: string}|null, source: array{type: string, url: string, reference: string}} fn pre_process( &self, driver: &dyn VcsDriverInterface, @@ -916,7 +911,6 @@ impl VcsRepository { Ok(data) } - /// @return string|false fn validate_branch(&self, branch: &str) -> Option<String> { let result = self .version_parser @@ -941,7 +935,6 @@ impl VcsRepository { None } - /// @return string|false fn validate_tag(&self, version: &str) -> Option<String> { self.version_parser .borrow() diff --git a/crates/shirabe/src/util/auth_helper.rs b/crates/shirabe/src/util/auth_helper.rs index 2131a107..0e02e764 100644 --- a/crates/shirabe/src/util/auth_helper.rs +++ b/crates/shirabe/src/util/auth_helper.rs @@ -52,7 +52,6 @@ impl AuthHelper { } } - /// @param 'prompt'|bool $storeAuth pub fn store_auth(&self, origin: &str, store_auth: StoreAuth) -> anyhow::Result<()> { let mut store: Option<()> = None; let mut config = self.config.borrow_mut(); @@ -443,8 +442,6 @@ impl AuthHelper { }) } - /// @param array<string, mixed> $options - /// /// @return array<string, mixed> updated options pub fn add_authentication_options( &mut self, diff --git a/crates/shirabe/src/util/git.rs b/crates/shirabe/src/util/git.rs index 1c3474ea..cbda0d43 100644 --- a/crates/shirabe/src/util/git.rs +++ b/crates/shirabe/src/util/git.rs @@ -95,7 +95,6 @@ impl Git { /// /// As soon as a single command fails it will halt, so assume the commands are run as && in bash /// - /// @param non-empty-array<non-empty-list<string>> $commands /// @param mixed $commandOutput the output will be written into this var if passed by ref /// if a callable is passed it will be used as output handler pub fn run_commands( @@ -141,7 +140,6 @@ impl Git { self.run_command(command_callable, url, cwd, initial_clone, command_output) } - /// @param callable|array<callable> $commandCallable /// @param mixed $commandOutput the output will be written into this var if passed by ref /// if a callable is passed it will be used as output handler fn run_command( @@ -994,7 +992,6 @@ impl Git { String::new() } - /// @return list<string> pub fn get_no_show_signature_flags( process: &std::rc::Rc<std::cell::RefCell<ProcessExecutor>>, ) -> Vec<String> { @@ -1023,7 +1020,6 @@ impl Git { /// /// @internal /// @param list<string> $arguments Additional arguments for git rev-list - /// @return non-empty-list<string> pub fn build_rev_list_command( process: &std::rc::Rc<std::cell::RefCell<ProcessExecutor>>, arguments: Vec<String>, @@ -1091,7 +1087,6 @@ impl Git { Ok(false) } - /// @return array<int, string>|null fn get_authentication_failure(&self, url: &str) -> Option<IndexMap<CaptureKey, String>> { let mut m: IndexMap<CaptureKey, String> = IndexMap::new(); if !Preg::is_match3( @@ -1249,7 +1244,6 @@ impl Git { Platform::clear_env("DYLD_LIBRARY_PATH"); } - /// @return non-empty-string pub fn get_github_domains_regex(config: &Config) -> String { let domains: Vec<String> = match config.get("github-domains") { PhpMixed::List(l) => l @@ -1262,7 +1256,6 @@ impl Git { format!("({})", implode("|", &escaped)) } - /// @return non-empty-string pub fn get_gitlab_domains_regex(config: &Config) -> String { let domains: Vec<String> = match config.get("gitlab-domains") { PhpMixed::List(l) => l @@ -1275,9 +1268,6 @@ impl Git { format!("({})", implode("|", &escaped)) } - /// @param non-empty-string $message - /// - /// @return never fn throw_exception(&mut self, message: &str, url: &str) -> anyhow::Result<()> { // git might delete a directory when it fails and php will not know clearstatcache(); @@ -1352,7 +1342,6 @@ impl Git { *VERSION.lock().unwrap() = Some(version); } - /// @param string[] $credentials fn mask_credentials(&self, error: &str, credentials: &[String]) -> String { let mut masked_credentials: Vec<String> = vec![]; diff --git a/crates/shirabe/src/util/http/curl_downloader.rs b/crates/shirabe/src/util/http/curl_downloader.rs index 1207dea0..2d2259b9 100644 --- a/crates/shirabe/src/util/http/curl_downloader.rs +++ b/crates/shirabe/src/util/http/curl_downloader.rs @@ -63,7 +63,6 @@ enum Decision { } impl CurlDownloader { - /// @param mixed[] $options pub fn new( io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>, config: std::rc::Rc<std::cell::RefCell<Config>>, @@ -100,9 +99,6 @@ impl CurlDownloader { } } - /// @param mixed[] $options - /// @param non-empty-string $url - /// /// Runs the request through the redirect/retry/status state machine until it resolves, /// mirroring what the PHP promise resolver + `tick()` loop used to do together. pub async fn download( diff --git a/crates/shirabe/src/util/http_downloader.rs b/crates/shirabe/src/util/http_downloader.rs index 2346c351..b60664da 100644 --- a/crates/shirabe/src/util/http_downloader.rs +++ b/crates/shirabe/src/util/http_downloader.rs @@ -191,8 +191,6 @@ impl HttpDownloader { self.execute(url, options, Some(to), false).await } - /// @phpstan-param non-empty-string $url - /// /// Shared core of `get`/`add`/`copy`/`add_copy`: mock short-circuit, empty-URL guard, the /// sync/allow_async gate, and the concurrency-limiting semaphore permit. Mirrors PHP `addJob` /// up to (but not including) the resolver, which is `dispatch`. @@ -366,8 +364,6 @@ impl HttpDownloader { } /// @internal - /// - /// @param array{warning?: string, info?: string, warning-versions?: string, info-versions?: string, warnings?: array<array{versions: string, message: string}>, infos?: array<array{versions: string, message: string}>} $data pub fn output_warnings( io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>, url: &str, @@ -466,8 +462,6 @@ impl HttpDownloader { } /// @internal - /// - /// @return ?string[] pub fn get_exception_hints(e: &anyhow::Error) -> Option<Vec<String>> { let e_as_transport: Option<&TransportException> = e.downcast_ref::<TransportException>(); e_as_transport?; diff --git a/crates/shirabe/src/util/no_proxy_pattern.rs b/crates/shirabe/src/util/no_proxy_pattern.rs index 5ece7942..582fdb68 100644 --- a/crates/shirabe/src/util/no_proxy_pattern.rs +++ b/crates/shirabe/src/util/no_proxy_pattern.rs @@ -69,8 +69,6 @@ impl NoProxyPattern { } /// Returns false is the url cannot be parsed, otherwise a data object - /// - /// @return bool|stdClass pub(crate) fn get_url_data(&self, url: &str) -> anyhow::Result<Option<UrlData>> { let host = parse_url(url, PHP_URL_HOST); if empty(&host) { diff --git a/crates/shirabe/src/util/perforce.rs b/crates/shirabe/src/util/perforce.rs index e2591301..ac455fc7 100644 --- a/crates/shirabe/src/util/perforce.rs +++ b/crates/shirabe/src/util/perforce.rs @@ -37,7 +37,6 @@ pub struct Perforce { } impl Perforce { - /// @phpstan-param RepoConfig $repoConfig pub fn new( repo_config: IndexMap<String, PhpMixed>, port: String, @@ -69,7 +68,6 @@ impl Perforce { this } - /// @phpstan-param RepoConfig $repoConfig pub fn create( repo_config: IndexMap<String, PhpMixed>, port: String, @@ -95,7 +93,6 @@ impl Perforce { ) == 0 } - /// @phpstan-param RepoConfig $repoConfig pub fn initialize(&mut self, repo_config: &IndexMap<String, PhpMixed>) { self.unique_perforce_client_name = self.generate_unique_perforce_client_name(); if repo_config.is_empty() { @@ -133,7 +130,6 @@ impl Perforce { } } - /// @return non-empty-string pub fn generate_unique_perforce_client_name(&self) -> String { format!("{}_{}", gethostname(), time()) } @@ -151,7 +147,6 @@ impl Perforce { file_system.borrow_mut().remove(&client_spec); } - /// @param non-empty-string|non-empty-list<string> $command pub(crate) fn execute_command(&mut self, command: PhpMixed) -> i64 { self.command_result = String::new(); @@ -239,7 +234,6 @@ impl Perforce { } } - /// @return non-empty-string pub fn get_p4_client_spec(&mut self) -> String { let path = self.path.clone(); format!("{}/{}.p4.spec", path, self.get_client()) @@ -333,7 +327,6 @@ impl Perforce { /// @internal /// @param non-empty-list<string> $arguments Additional arguments for git rev-list - /// @return non-empty-list<string> pub fn generate_p4_command(&mut self, arguments: Vec<String>, use_client: bool) -> Vec<String> { let mut p4_command: Vec<String> = vec![Self::get_p4_executable()]; if self.get_user().is_some() { @@ -415,7 +408,6 @@ impl Perforce { Ok(()) } - /// @param resource|false $spec pub fn write_client_spec_to_file(&mut self, spec: &PhpResource) { fwrite( spec, @@ -527,8 +519,6 @@ impl Perforce { Ok(()) } - /// @param resource $pipe - /// @param mixed $name pub(crate) fn read(&self, pipe: &PhpResource, _name: PhpMixed) { if feof(pipe) { return; @@ -590,7 +580,6 @@ impl Perforce { Ok(()) } - /// @return mixed[]|null pub fn get_composer_information( &mut self, identifier: &str, @@ -663,7 +652,6 @@ impl Perforce { None } - /// @return array{master: string} pub fn get_branches(&mut self) -> IndexMap<String, String> { let mut possible_branches: IndexMap<String, String> = IndexMap::new(); if !self.is_stream() { @@ -725,7 +713,6 @@ impl Perforce { result } - /// @return array<string, string> pub fn get_tags(&mut self) -> IndexMap<String, String> { let command = self.generate_p4_command(vec!["labels".to_string()], true); self.execute_command(PhpMixed::List( @@ -771,7 +758,6 @@ impl Perforce { false } - /// @return mixed|null pub(crate) fn get_change_list(&mut self, reference: &str) -> Option<String> { let index = strpos(reference, "@")?; let label = substr(reference, index as i64, None); @@ -789,7 +775,6 @@ impl Perforce { Some(fields.get(1).cloned().unwrap_or_default()) } - /// @return mixed|null pub fn get_commit_logs(&mut self, from_reference: &str, to_reference: &str) -> Option<String> { let from_change_list = self.get_change_list(from_reference)?; let to_change_list = self.get_change_list(to_reference)?; diff --git a/crates/shirabe/src/util/platform.rs b/crates/shirabe/src/util/platform.rs index 259d5c95..7b1c8f61 100644 --- a/crates/shirabe/src/util/platform.rs +++ b/crates/shirabe/src/util/platform.rs @@ -58,10 +58,6 @@ impl Platform { } /// getenv() equivalent but reads from the runtime global variables first - /// - /// @param non-empty-string $name - /// - /// @return string|false pub fn get_env(name: &str) -> Option<String> { if let Some(value) = PHP_SERVER.lock().unwrap().get(name) { return Some(value.to_string_lossy().into_owned()); @@ -388,7 +384,6 @@ impl Platform { cached.unwrap_or(false) } - /// @return 'NUL'|'/dev/null' pub fn get_dev_null() -> String { if Self::is_windows() { return "NUL".to_string(); diff --git a/crates/shirabe/src/util/process_executor.rs b/crates/shirabe/src/util/process_executor.rs index 9e89bdd4..c24e2f83 100644 --- a/crates/shirabe/src/util/process_executor.rs +++ b/crates/shirabe/src/util/process_executor.rs @@ -790,7 +790,6 @@ impl ProcessExecutor { self.allow_async = true; } - /// @return string[] pub fn split_lines(&self, output: &str) -> Vec<String> { let output = trim(output, None); @@ -821,7 +820,6 @@ impl ProcessExecutor { Self::escape_argument(argument) } - /// @param string|list<string> $command fn output_command_run(&self, command: &PhpMixed, cwd: Option<&str>, r#async: bool) { Self::output_command_run_with(&self.io, command, cwd, r#async); } @@ -943,7 +941,6 @@ impl ProcessExecutor { argument } - /// @param string[]|string $command pub fn requires_git_dir_env(&self, command: &PhpMixed) -> bool { let cmd: Vec<String> = if !is_array(command) { explode(" ", command.as_string().unwrap_or("")) diff --git a/crates/shirabe/src/util/svn.rs b/crates/shirabe/src/util/svn.rs index 50315316..a2974760 100644 --- a/crates/shirabe/src/util/svn.rs +++ b/crates/shirabe/src/util/svn.rs @@ -124,7 +124,6 @@ impl Svn { .map(|o| o.unwrap_or_default()) } - /// @param non-empty-list<string> $svnCommand fn execute_with_auth_retry( &mut self, svn_command: Vec<String>, @@ -257,8 +256,6 @@ impl Svn { /// @param non-empty-list<string> $cmd Usually 'svn ls' or something like that. /// @param string $url Repo URL. /// @param string $path Target for a checkout - /// - /// @return non-empty-list<string> pub(crate) fn get_command( &mut self, mut cmd: Vec<String>, @@ -280,8 +277,6 @@ impl Svn { /// Return the credential string for the svn command. /// /// Adds --no-auth-cache when credentials are present. - /// - /// @return list<string> pub(crate) fn get_credential_args(&mut self) -> Vec<String> { if !self.has_auth() { return vec![]; @@ -354,8 +349,6 @@ impl Svn { } /// Return the no-auth-cache switch. - /// - /// @return list<string> pub(crate) fn get_auth_cache_args(&self) -> Vec<String> { if self.cache_credentials { vec![] |
