aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-class-map-generator/src/class_map.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-17 02:53:53 +0900
committernsfisis <nsfisis@gmail.com>2026-05-17 02:53:53 +0900
commita1c7e6908a26e10f6e1f23a51721664b5e2d838d (patch)
treec575c76f1b43359ed74913da4c6a2636643f1ba0 /crates/shirabe-class-map-generator/src/class_map.rs
parent7f606f36fef0c0467c3c0db3d0da33af486dae8a (diff)
downloadphp-shirabe-a1c7e6908a26e10f6e1f23a51721664b5e2d838d.tar.gz
php-shirabe-a1c7e6908a26e10f6e1f23a51721664b5e2d838d.tar.zst
php-shirabe-a1c7e6908a26e10f6e1f23a51721664b5e2d838d.zip
chore(style): cargo fmt
Diffstat (limited to 'crates/shirabe-class-map-generator/src/class_map.rs')
-rw-r--r--crates/shirabe-class-map-generator/src/class_map.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/crates/shirabe-class-map-generator/src/class_map.rs b/crates/shirabe-class-map-generator/src/class_map.rs
index 51d2bef..311924b 100644
--- a/crates/shirabe-class-map-generator/src/class_map.rs
+++ b/crates/shirabe-class-map-generator/src/class_map.rs
@@ -1,8 +1,10 @@
//! ref: composer/vendor/composer/class-map-generator/src/ClassMap.php
use indexmap::IndexMap;
-use shirabe_php_shim::{Countable, InvalidArgumentException, OutOfBoundsException, rtrim, strpos, strtr};
use shirabe_external_packages::composer::pcre::preg::Preg;
+use shirabe_php_shim::{
+ Countable, InvalidArgumentException, OutOfBoundsException, rtrim, strpos, strtr,
+};
#[derive(Debug, Clone)]
pub struct PsrViolationEntry {
@@ -105,20 +107,25 @@ impl ClassMap {
self.psr_violations
.entry(path)
.or_default()
- .push(PsrViolationEntry { warning, class_name });
+ .push(PsrViolationEntry {
+ warning,
+ class_name,
+ });
}
pub fn clear_psr_violations_by_path(&mut self, path_prefix: &str) {
let path_prefix = rtrim(&strtr(path_prefix, "\\", "/"), Some("/"));
self.psr_violations.retain(|path, _| {
- path != &path_prefix
- && strpos(path, &format!("{}/", path_prefix)) != Some(0)
+ path != &path_prefix && strpos(path, &format!("{}/", path_prefix)) != Some(0)
});
}
pub fn add_ambiguous_class(&mut self, class_name: String, path: String) {
- self.ambiguous_classes.entry(class_name).or_default().push(path);
+ self.ambiguous_classes
+ .entry(class_name)
+ .or_default()
+ .push(path);
}
/// Get the raw psr violations