diff options
Diffstat (limited to 'crates')
7 files changed, 586 insertions, 59 deletions
diff --git a/crates/shirabe-class-map-generator/src/class_map_generator.rs b/crates/shirabe-class-map-generator/src/class_map_generator.rs index 1d2084d..608dccb 100644 --- a/crates/shirabe-class-map-generator/src/class_map_generator.rs +++ b/crates/shirabe-class-map-generator/src/class_map_generator.rs @@ -3,7 +3,8 @@ use crate::class_map::ClassMap; use crate::file_list::FileList; use crate::php_file_parser::PhpFileParser; -use shirabe_external_packages::composer::pcre::preg::Preg; +use indexmap::indexmap; +use shirabe_external_packages::composer::pcre::preg::{CaptureKey, Preg}; use shirabe_external_packages::symfony::component::finder::finder::Finder; use shirabe_external_packages::symfony::component::finder::spl_file_info::SplFileInfo; use shirabe_php_shim::{ @@ -149,7 +150,7 @@ impl ClassMapGenerator { for file in files { let mut file_path = file.get_pathname(); - let ext = pathinfo(&PhpMixed::String(file_path.clone()), PATHINFO_EXTENSION); + let ext = pathinfo(PhpMixed::String(file_path.clone()), PATHINFO_EXTENSION); if !in_array( ext, &PhpMixed::List( @@ -327,13 +328,13 @@ impl ClassMapGenerator { ".", &Self::normalize_path(file_path), ) - .unwrap_or_else(|| Self::normalize_path(file_path)); + .unwrap_or_else(|_| Self::normalize_path(file_path)); let short_base_path = Preg::replace( &format!("{{^{}}}", preg_quote(&cwd, None)), ".", &Self::normalize_path(base_path), ) - .unwrap_or_else(|| Self::normalize_path(base_path)); + .unwrap_or_else(|_| Self::normalize_path(base_path)); for class in rejected_classes { self.class_map.add_psr_violation( @@ -374,11 +375,18 @@ impl ClassMapGenerator { } // extract a prefix being a protocol://, protocol:, protocol://drive: or simply drive: - if let Some(m) = Preg::is_match_strict_groups( + let mut r#match: indexmap::IndexMap<_, _> = indexmap![]; + if Preg::is_match_strict_groups3( r"{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix", &path, - ) { - prefix = m.get(1).cloned().unwrap_or_default(); + Some(&mut r#match), + ) + .unwrap_or(false) + { + prefix = r#match + .get(&CaptureKey::ByIndex(1)) + .cloned() + .unwrap_or_default(); path = substr(&path, strlen(&prefix) as i64, None); } @@ -401,7 +409,12 @@ impl ClassMapGenerator { // ensure c: is normalized to C: let prefix = Preg::replace_callback( r"{(?:^|://)[a-z]:$}i", - |m| m.get("0").cloned().unwrap_or_default().to_uppercase(), + |m| { + m.get(&CaptureKey::ByIndex(0)) + .cloned() + .unwrap_or_default() + .to_uppercase() + }, &prefix, ) .unwrap_or(prefix); diff --git a/crates/shirabe-class-map-generator/src/php_file_cleaner.rs b/crates/shirabe-class-map-generator/src/php_file_cleaner.rs index 1a33533..ec59414 100644 --- a/crates/shirabe-class-map-generator/src/php_file_cleaner.rs +++ b/crates/shirabe-class-map-generator/src/php_file_cleaner.rs @@ -1,7 +1,7 @@ //! ref: composer/vendor/composer/class-map-generator/src/PhpFileCleaner.php use indexmap::IndexMap; -use shirabe_external_packages::composer::pcre::preg::Preg; +use shirabe_external_packages::composer::pcre::preg::{CaptureKey, Preg}; use shirabe_php_shim::preg_quote; use std::sync::Mutex; @@ -88,13 +88,13 @@ impl PhpFileCleaner { } if char == '<' && self.peek('<') { - let mut r#match: Vec<String> = vec![]; + let mut r#match: IndexMap<CaptureKey, String> = IndexMap::new(); if self.r#match( r#"{<<<[ \t]*+(['\"]?)([a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*+)\1(?:\r\n|\n|\r)}A"#, Some(&mut r#match), ) { - self.index += r#match[0].len(); - let delimiter = r#match[2].clone(); + self.index += r#match.get(&CaptureKey::ByIndex(0)).map(|s| s.len()).unwrap_or(0); + let delimiter = r#match.get(&CaptureKey::ByIndex(2)).cloned().unwrap_or_default(); self.skip_heredoc(&delimiter); clean.push_str("null"); continue; @@ -122,15 +122,21 @@ impl PhpFileCleaner { let end = self.index + entry.length; if end <= self.len && &self.contents[self.index..end] == entry.name { let offset = if self.index > 0 { self.index - 1 } else { 0 }; - let mut r#match: Vec<String> = vec![]; - if Preg::is_match_at( + let mut r#match: IndexMap<CaptureKey, String> = IndexMap::new(); + if Preg::is_match5( &entry.pattern, &self.contents, - &mut r#match, + Some(&mut r#match), 0, offset, - ) { - return clean + &r#match[0]; + ) + .unwrap_or(false) + { + return clean + + r#match + .get(&CaptureKey::ByIndex(0)) + .map(|s| s.as_str()) + .unwrap_or(""); } } } @@ -139,11 +145,15 @@ impl PhpFileCleaner { self.index += 1; let rest_pattern = REST_PATTERN.lock().unwrap().clone(); if let Some(rest_pattern) = rest_pattern { - let mut r#match: Vec<String> = vec![]; + let mut r#match: IndexMap<CaptureKey, String> = IndexMap::new(); if self.r#match(&rest_pattern, Some(&mut r#match)) { + let m0 = r#match + .get(&CaptureKey::ByIndex(0)) + .cloned() + .unwrap_or_default(); clean.push(char); - clean.push_str(&r#match[0]); - self.index += r#match[0].len(); + clean.push_str(&m0); + self.index += m0.len(); } else { clean.push(char); } @@ -257,7 +267,8 @@ impl PhpFileCleaner { self.index + 1 < self.len && self.contents.as_bytes()[self.index + 1] as char == char } - fn r#match(&self, regex: &str, r#match: Option<&mut Vec<String>>) -> bool { - Preg::is_match_strict_groups_at(regex, &self.contents, r#match, 0, self.index) + fn r#match(&self, regex: &str, r#match: Option<&mut IndexMap<CaptureKey, String>>) -> bool { + Preg::is_match_strict_groups5(regex, &self.contents, r#match, 0, self.index) + .unwrap_or(false) } } diff --git a/crates/shirabe-class-map-generator/src/php_file_parser.rs b/crates/shirabe-class-map-generator/src/php_file_parser.rs index 9bc7c5c..d87db82 100644 --- a/crates/shirabe-class-map-generator/src/php_file_parser.rs +++ b/crates/shirabe-class-map-generator/src/php_file_parser.rs @@ -3,7 +3,7 @@ use crate::php_file_cleaner::PhpFileCleaner; use anyhow::anyhow; use indexmap::IndexMap; -use shirabe_external_packages::composer::pcre::preg::Preg; +use shirabe_external_packages::composer::pcre::preg::{CaptureKey, Preg}; use shirabe_php_shim::{ HHVM_VERSION, PHP_EOL, PHP_VERSION_ID, RuntimeException, error_get_last, file_exists, file_get_contents, function_exists, is_file, is_readable, ltrim, php_strip_whitespace, sprintf, @@ -63,11 +63,10 @@ impl PhpFileParser { // return early if there is no chance of matching anything in this file let pattern = format!("{{\\b(?:class|interface|trait{})\\s}}i", extra_types); - let matches_0 = Preg::is_match_all_strict_groups(&pattern, &contents); - if matches_0.as_ref().map(|m| m[0].is_empty()).unwrap_or(true) { + let max_matches = Preg::match_all_strict_groups(&pattern, &contents)?; + if max_matches == 0 { return Ok(vec![]); } - let max_matches = matches_0.as_ref().unwrap()[0].len(); let mut p = PhpFileCleaner::new(contents, max_matches); let contents = p.clean(); @@ -81,22 +80,25 @@ impl PhpFileParser { )", et = extra_types ); - let mut matches: IndexMap<String, Vec<String>> = IndexMap::new(); - Preg::match_all(&pattern2, &contents, &mut matches); + let mut matches: IndexMap<_, _> = IndexMap::new(); + Preg::match_all3(&pattern2, &contents, Some(&mut matches))?; let mut classes = vec![]; let mut namespace = String::new(); - let len = matches.get("type").map(|v| v.len()).unwrap_or(0); + let len = matches + .get(&CaptureKey::ByName("type".to_owned())) + .map(|v| v.len()) + .unwrap_or(0); for i in 0..len { let ns = matches - .get("ns") + .get(&CaptureKey::ByName("ns".to_owned())) .and_then(|v| v.get(i)) .map(|s| s.as_str()) .unwrap_or(""); if !ns.is_empty() { let nsname = matches - .get("nsname") + .get(&CaptureKey::ByName("nsname".to_owned())) .and_then(|v| v.get(i)) .map(|s| s.as_str()) .unwrap_or(""); @@ -112,7 +114,7 @@ impl PhpFileParser { ) + "\\"; } else { let name = matches - .get("name") + .get(&CaptureKey::ByName("name".to_owned())) .and_then(|v| v.get(i)) .map(|s| s.as_str()) .unwrap_or(""); @@ -133,7 +135,7 @@ impl PhpFileParser { &name[1..], ) } else if matches - .get("type") + .get(&CaptureKey::ByName("type".to_owned())) .and_then(|v| v.get(i)) .map(|s| s.to_lowercase()) .as_deref() diff --git a/crates/shirabe-external-packages/src/composer/pcre/preg.rs b/crates/shirabe-external-packages/src/composer/pcre/preg.rs index 2f675cd..3dd8b4f 100644 --- a/crates/shirabe-external-packages/src/composer/pcre/preg.rs +++ b/crates/shirabe-external-packages/src/composer/pcre/preg.rs @@ -1,10 +1,190 @@ -use indexmap::IndexMap; - #[derive(Debug)] pub struct Preg; impl Preg { - pub fn is_match(pattern: &str, subject: &str) -> anyhow::Result<bool> { + pub fn r#match(pattern: &str, subject: &str) -> anyhow::Result<bool> { + todo!() + } + + pub fn match3( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>, + ) -> anyhow::Result<bool> { + todo!() + } + + pub fn match4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>, + flags: i64, + ) -> anyhow::Result<bool> { + todo!() + } + + pub fn match5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>, + flags: i64, + offset: usize, + ) -> anyhow::Result<bool> { + todo!() + } + + pub fn match_strict_groups(pattern: &str, subject: &str) -> anyhow::Result<bool> { + todo!() + } + + pub fn match_strict_groups3( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>, + ) -> anyhow::Result<bool> { + todo!() + } + + pub fn match_strict_groups4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>, + flags: i64, + ) -> anyhow::Result<bool> { + todo!() + } + + pub fn match_strict_groups5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>, + flags: i64, + offset: usize, + ) -> anyhow::Result<bool> { + todo!() + } + + pub fn match_with_offsets(pattern: &str, subject: &str) -> anyhow::Result<bool> { + todo!() + } + + pub fn match_with_offsets3( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, (String, usize)>>, + ) -> anyhow::Result<bool> { + todo!() + } + + pub fn match_with_offsets4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, (String, usize)>>, + flags: i64, + ) -> anyhow::Result<bool> { + todo!() + } + + pub fn match_with_offsets5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, (String, usize)>>, + flags: i64, + offset: usize, + ) -> anyhow::Result<bool> { + todo!() + } + + pub fn match_all(pattern: &str, subject: &str) -> anyhow::Result<usize> { + todo!() + } + + pub fn match_all3( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>, + ) -> anyhow::Result<usize> { + todo!() + } + + pub fn match_all4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>, + flags: i64, + ) -> anyhow::Result<usize> { + todo!() + } + + pub fn match_all5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>, + flags: i64, + offset: usize, + ) -> anyhow::Result<usize> { + todo!() + } + + pub fn match_all_strict_groups(pattern: &str, subject: &str) -> anyhow::Result<usize> { + todo!() + } + + pub fn match_all_strict_groups3( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>, + ) -> anyhow::Result<usize> { + todo!() + } + + pub fn match_all_strict_groups4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>, + flags: i64, + ) -> anyhow::Result<usize> { + todo!() + } + + pub fn match_all_strict_groups5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>, + flags: i64, + offset: usize, + ) -> anyhow::Result<usize> { + todo!() + } + + pub fn match_all_with_offsets(pattern: &str, subject: &str) -> anyhow::Result<usize> { + todo!() + } + + pub fn match_all_with_offsets3( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<(String, usize)>>>, + ) -> anyhow::Result<usize> { + todo!() + } + + pub fn match_all_with_offsets4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<(String, usize)>>>, + flags: i64, + ) -> anyhow::Result<usize> { + todo!() + } + + pub fn match_all_with_offsets5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<(String, usize)>>>, + flags: i64, + offset: usize, + ) -> anyhow::Result<usize> { todo!() } @@ -12,18 +192,93 @@ impl Preg { todo!() } - pub fn replace_callback<F>(pattern: &str, callback: F, subject: &str) -> anyhow::Result<String> - where - F: Fn(&IndexMap<String, String>) -> String, - { + pub fn replace4( + pattern: &str, + replacement: &str, + subject: &str, + limit: i64, + ) -> anyhow::Result<String> { todo!() } - pub fn replace_with_count( + pub fn replace5( pattern: &str, replacement: &str, subject: &str, - count: &mut i64, + limit: i64, + count: &mut usize, + ) -> anyhow::Result<String> { + todo!() + } + + pub fn replace_callback<F: Fn(&indexmap::IndexMap<CaptureKey, String>) -> String>( + pattern: &str, + replacement: F, + subject: &str, + ) -> anyhow::Result<String> { + todo!() + } + + pub fn replace_callback4<F: Fn(&indexmap::IndexMap<CaptureKey, String>) -> String>( + pattern: &str, + replacement: F, + subject: &str, + limit: i64, + ) -> anyhow::Result<String> { + todo!() + } + + pub fn replace_callback5<F: Fn(&indexmap::IndexMap<CaptureKey, String>) -> String>( + pattern: &str, + replacement: F, + subject: &str, + limit: i64, + count: &mut usize, + ) -> anyhow::Result<String> { + todo!() + } + + pub fn replace_callback6<F: Fn(&indexmap::IndexMap<CaptureKey, String>) -> String>( + pattern: &str, + replacement: F, + subject: &str, + limit: i64, + count: Option<&mut usize>, + flags: i64, + ) -> anyhow::Result<String> { + todo!() + } + + pub fn replace_callback_array( + pattern: &indexmap::IndexMap<String, String>, + subject: &str, + ) -> anyhow::Result<String> { + todo!() + } + + pub fn replace_callback_array3( + pattern: &indexmap::IndexMap<String, String>, + subject: &str, + limit: i64, + ) -> anyhow::Result<String> { + todo!() + } + + pub fn replace_callback_array4( + pattern: &indexmap::IndexMap<String, String>, + subject: &str, + limit: i64, + count: &mut usize, + ) -> anyhow::Result<String> { + todo!() + } + + pub fn replace_callback_array5( + pattern: &indexmap::IndexMap<String, String>, + subject: &str, + limit: i64, + count: Option<&mut usize>, + flags: i64, ) -> anyhow::Result<String> { todo!() } @@ -32,48 +287,240 @@ impl Preg { todo!() } - pub fn grep(pattern: &str, input: Vec<String>) -> anyhow::Result<Vec<String>> { + pub fn split3(pattern: &str, subject: &str, limit: i64) -> anyhow::Result<Vec<String>> { + todo!() + } + + pub fn split4( + pattern: &str, + subject: &str, + limit: i64, + flags: i64, + ) -> anyhow::Result<Vec<String>> { + todo!() + } + + pub fn split_with_offsets( + pattern: &str, + subject: &str, + ) -> anyhow::Result<Vec<(String, usize)>> { + todo!() + } + + pub fn split_with_offsets3( + pattern: &str, + subject: &str, + limit: i64, + ) -> anyhow::Result<Vec<(String, usize)>> { + todo!() + } + + pub fn split_with_offsets4( + pattern: &str, + subject: &str, + limit: i64, + flags: i64, + ) -> anyhow::Result<Vec<(String, usize)>> { + todo!() + } + + pub fn grep(pattern: &str, array: &[&str]) -> anyhow::Result<Vec<String>> { + todo!() + } + + pub fn grep3(pattern: &str, array: &[&str], flags: i64) -> anyhow::Result<Vec<String>> { + todo!() + } + + pub fn is_match(pattern: &str, subject: &str) -> anyhow::Result<bool> { + todo!() + } + + pub fn is_match3( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>, + ) -> anyhow::Result<bool> { + todo!() + } + + pub fn is_match4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>, + flags: i64, + ) -> anyhow::Result<bool> { + todo!() + } + + pub fn is_match5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>, + flags: i64, + offset: usize, + ) -> anyhow::Result<bool> { + todo!() + } + + pub fn is_match_strict_groups(pattern: &str, subject: &str) -> anyhow::Result<bool> { + todo!() + } + + pub fn is_match_strict_groups3( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>, + ) -> anyhow::Result<bool> { + todo!() + } + + pub fn is_match_strict_groups4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>, + flags: i64, + ) -> anyhow::Result<bool> { todo!() } - /// Returns captures as a flat Vec indexed by group number (index 0 = full match). - pub fn is_match_strict_groups(pattern: &str, subject: &str) -> Option<Vec<String>> { + pub fn is_match_strict_groups5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, String>>, + flags: i64, + offset: usize, + ) -> anyhow::Result<bool> { todo!() } - /// Returns named captures in an IndexMap. - pub fn is_match_named( + pub fn is_match_with_offsets(pattern: &str, subject: &str) -> anyhow::Result<bool> { + todo!() + } + + pub fn is_match_with_offsets3( pattern: &str, subject: &str, - matches: &mut IndexMap<String, String>, + matches: Option<&mut indexmap::IndexMap<CaptureKey, (String, usize)>>, ) -> anyhow::Result<bool> { todo!() } - /// Returns all matches; outer Vec indexed by group number, inner Vec by match occurrence. - pub fn is_match_all_strict_groups(pattern: &str, subject: &str) -> Option<Vec<Vec<String>>> { + pub fn is_match_with_offsets4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, (String, usize)>>, + flags: i64, + ) -> anyhow::Result<bool> { todo!() } - /// Returns captures with byte offsets: IndexMap<group_name, Vec<(match_str, offset)>>. - pub fn is_match_all_with_offsets( + pub fn is_match_with_offsets5( pattern: &str, subject: &str, - matches: &mut IndexMap<String, Vec<(String, i64)>>, + matches: Option<&mut indexmap::IndexMap<CaptureKey, (String, usize)>>, + flags: i64, + offset: usize, ) -> anyhow::Result<bool> { todo!() } - /// Returns indexed captures as Vec (index 0 = full match) when pattern matches. - pub fn is_match_with_indexed_captures( + pub fn is_match_all(pattern: &str, subject: &str) -> anyhow::Result<bool> { + todo!() + } + + pub fn is_match_all3( pattern: &str, subject: &str, - ) -> anyhow::Result<Option<Vec<String>>> { + matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>, + ) -> anyhow::Result<bool> { + todo!() + } + + pub fn is_match_all4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>, + flags: i64, + ) -> anyhow::Result<bool> { + todo!() + } + + pub fn is_match_all5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>, + flags: i64, + offset: usize, + ) -> anyhow::Result<bool> { todo!() } - /// Like is_match_strict_groups but returns named captures as IndexMap. - pub fn match_strict_groups(pattern: &str, subject: &str) -> Option<IndexMap<String, String>> { + pub fn is_match_all_strict_groups(pattern: &str, subject: &str) -> anyhow::Result<bool> { todo!() } + + pub fn is_match_all_strict_groups3( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>, + ) -> anyhow::Result<bool> { + todo!() + } + + pub fn is_match_all_strict_groups4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>, + flags: i64, + ) -> anyhow::Result<bool> { + todo!() + } + + pub fn is_match_all_strict_groups5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<String>>>, + flags: i64, + offset: usize, + ) -> anyhow::Result<bool> { + todo!() + } + + pub fn is_match_all_with_offsets(pattern: &str, subject: &str) -> anyhow::Result<bool> { + todo!() + } + + pub fn is_match_all_with_offsets3( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<(String, usize)>>>, + ) -> anyhow::Result<bool> { + todo!() + } + + pub fn is_match_all_with_offsets4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<(String, usize)>>>, + flags: i64, + ) -> anyhow::Result<bool> { + todo!() + } + + pub fn is_match_all_with_offsets5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap<CaptureKey, Vec<(String, usize)>>>, + flags: i64, + offset: usize, + ) -> anyhow::Result<bool> { + todo!() + } +} + +#[derive(Debug, Clone, PartialOrd, Ord, PartialEq, Eq, Hash)] +pub enum CaptureKey { + ByIndex(usize), + ByName(String), } diff --git a/crates/shirabe-external-packages/src/symfony/component/finder/finder.rs b/crates/shirabe-external-packages/src/symfony/component/finder/finder.rs index 95bc4f7..4a19b0f 100644 --- a/crates/shirabe-external-packages/src/symfony/component/finder/finder.rs +++ b/crates/shirabe-external-packages/src/symfony/component/finder/finder.rs @@ -28,6 +28,14 @@ impl Finder { todo!() } + pub fn follow_links(&mut self) -> &mut Self { + todo!() + } + + pub fn exclude(&mut self, exclude: &[String]) -> &mut Self { + todo!() + } + pub fn ignore_vcs(&mut self, ignore_vcs: bool) -> &mut Self { todo!() } diff --git a/crates/shirabe-external-packages/src/symfony/component/finder/spl_file_info.rs b/crates/shirabe-external-packages/src/symfony/component/finder/spl_file_info.rs index fd63b33..fa37718 100644 --- a/crates/shirabe-external-packages/src/symfony/component/finder/spl_file_info.rs +++ b/crates/shirabe-external-packages/src/symfony/component/finder/spl_file_info.rs @@ -2,7 +2,11 @@ pub struct SplFileInfo; impl SplFileInfo { - pub fn get_path_name(&self) -> String { + pub fn new(path: &str) -> Self { + todo!() + } + + pub fn get_pathname(&self) -> String { todo!() } diff --git a/crates/shirabe-php-shim/src/lib.rs b/crates/shirabe-php-shim/src/lib.rs index 2c09d7c..4b4d719 100644 --- a/crates/shirabe-php-shim/src/lib.rs +++ b/crates/shirabe-php-shim/src/lib.rs @@ -71,36 +71,72 @@ pub struct RuntimeException { pub code: i64, } +impl std::fmt::Display for RuntimeException { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + todo!() + } +} + #[derive(Debug)] pub struct UnexpectedValueException { pub message: String, pub code: i64, } +impl std::fmt::Display for UnexpectedValueException { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + todo!() + } +} + #[derive(Debug)] pub struct InvalidArgumentException { pub message: String, pub code: i64, } +impl std::fmt::Display for InvalidArgumentException { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + todo!() + } +} + #[derive(Debug)] pub struct LogicException { pub message: String, pub code: i64, } +impl std::fmt::Display for LogicException { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + todo!() + } +} + #[derive(Debug)] pub struct BadMethodCallException { pub message: String, pub code: i64, } +impl std::fmt::Display for BadMethodCallException { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + todo!() + } +} + #[derive(Debug)] pub struct OutOfBoundsException { pub message: String, pub code: i64, } +impl std::fmt::Display for OutOfBoundsException { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + todo!() + } +} + #[derive(Debug)] pub struct ErrorException { pub message: String, @@ -110,6 +146,12 @@ pub struct ErrorException { pub lineno: i64, } +impl std::fmt::Display for ErrorException { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + todo!() + } +} + pub fn is_bool(value: &PhpMixed) -> bool { todo!() } |
