From 90b3be462bd2f91ef366df06c2b5bbae2821a394 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 17 May 2026 04:44:51 +0900 Subject: fix(class-map-generator): introduce CaptureKey enum and fix class-map-generator compile errors - Add CaptureKey enum to Preg stub for typed capture access (by index or name) - Expand Preg stub with complete method set matching the PHP Composer\Pcre\Preg API - Update class-map-generator, php-file-cleaner, and php-file-parser to use new API - Add Display impls for exception types in shirabe-php-shim - Add follow_links/exclude stubs to Finder and new/get_pathname stubs to SplFileInfo Co-Authored-By: Claude Sonnet 4.6 --- .../src/composer/pcre/preg.rs | 497 +++++++++++++++++++-- .../src/symfony/component/finder/finder.rs | 8 + .../src/symfony/component/finder/spl_file_info.rs | 6 +- 3 files changed, 485 insertions(+), 26 deletions(-) (limited to 'crates/shirabe-external-packages') 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 { + pub fn r#match(pattern: &str, subject: &str) -> anyhow::Result { + todo!() + } + + pub fn match3( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>, + ) -> anyhow::Result { + todo!() + } + + pub fn match4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>, + flags: i64, + ) -> anyhow::Result { + todo!() + } + + pub fn match5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>, + flags: i64, + offset: usize, + ) -> anyhow::Result { + todo!() + } + + pub fn match_strict_groups(pattern: &str, subject: &str) -> anyhow::Result { + todo!() + } + + pub fn match_strict_groups3( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>, + ) -> anyhow::Result { + todo!() + } + + pub fn match_strict_groups4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>, + flags: i64, + ) -> anyhow::Result { + todo!() + } + + pub fn match_strict_groups5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>, + flags: i64, + offset: usize, + ) -> anyhow::Result { + todo!() + } + + pub fn match_with_offsets(pattern: &str, subject: &str) -> anyhow::Result { + todo!() + } + + pub fn match_with_offsets3( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>, + ) -> anyhow::Result { + todo!() + } + + pub fn match_with_offsets4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>, + flags: i64, + ) -> anyhow::Result { + todo!() + } + + pub fn match_with_offsets5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>, + flags: i64, + offset: usize, + ) -> anyhow::Result { + todo!() + } + + pub fn match_all(pattern: &str, subject: &str) -> anyhow::Result { + todo!() + } + + pub fn match_all3( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>>, + ) -> anyhow::Result { + todo!() + } + + pub fn match_all4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>>, + flags: i64, + ) -> anyhow::Result { + todo!() + } + + pub fn match_all5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>>, + flags: i64, + offset: usize, + ) -> anyhow::Result { + todo!() + } + + pub fn match_all_strict_groups(pattern: &str, subject: &str) -> anyhow::Result { + todo!() + } + + pub fn match_all_strict_groups3( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>>, + ) -> anyhow::Result { + todo!() + } + + pub fn match_all_strict_groups4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>>, + flags: i64, + ) -> anyhow::Result { + todo!() + } + + pub fn match_all_strict_groups5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>>, + flags: i64, + offset: usize, + ) -> anyhow::Result { + todo!() + } + + pub fn match_all_with_offsets(pattern: &str, subject: &str) -> anyhow::Result { + todo!() + } + + pub fn match_all_with_offsets3( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>>, + ) -> anyhow::Result { + todo!() + } + + pub fn match_all_with_offsets4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>>, + flags: i64, + ) -> anyhow::Result { + todo!() + } + + pub fn match_all_with_offsets5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>>, + flags: i64, + offset: usize, + ) -> anyhow::Result { todo!() } @@ -12,18 +192,93 @@ impl Preg { todo!() } - pub fn replace_callback(pattern: &str, callback: F, subject: &str) -> anyhow::Result - where - F: Fn(&IndexMap) -> String, - { + pub fn replace4( + pattern: &str, + replacement: &str, + subject: &str, + limit: i64, + ) -> anyhow::Result { 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 { + todo!() + } + + pub fn replace_callback) -> String>( + pattern: &str, + replacement: F, + subject: &str, + ) -> anyhow::Result { + todo!() + } + + pub fn replace_callback4) -> String>( + pattern: &str, + replacement: F, + subject: &str, + limit: i64, + ) -> anyhow::Result { + todo!() + } + + pub fn replace_callback5) -> String>( + pattern: &str, + replacement: F, + subject: &str, + limit: i64, + count: &mut usize, + ) -> anyhow::Result { + todo!() + } + + pub fn replace_callback6) -> String>( + pattern: &str, + replacement: F, + subject: &str, + limit: i64, + count: Option<&mut usize>, + flags: i64, + ) -> anyhow::Result { + todo!() + } + + pub fn replace_callback_array( + pattern: &indexmap::IndexMap, + subject: &str, + ) -> anyhow::Result { + todo!() + } + + pub fn replace_callback_array3( + pattern: &indexmap::IndexMap, + subject: &str, + limit: i64, + ) -> anyhow::Result { + todo!() + } + + pub fn replace_callback_array4( + pattern: &indexmap::IndexMap, + subject: &str, + limit: i64, + count: &mut usize, + ) -> anyhow::Result { + todo!() + } + + pub fn replace_callback_array5( + pattern: &indexmap::IndexMap, + subject: &str, + limit: i64, + count: Option<&mut usize>, + flags: i64, ) -> anyhow::Result { todo!() } @@ -32,48 +287,240 @@ impl Preg { todo!() } - pub fn grep(pattern: &str, input: Vec) -> anyhow::Result> { + pub fn split3(pattern: &str, subject: &str, limit: i64) -> anyhow::Result> { + todo!() + } + + pub fn split4( + pattern: &str, + subject: &str, + limit: i64, + flags: i64, + ) -> anyhow::Result> { + todo!() + } + + pub fn split_with_offsets( + pattern: &str, + subject: &str, + ) -> anyhow::Result> { + todo!() + } + + pub fn split_with_offsets3( + pattern: &str, + subject: &str, + limit: i64, + ) -> anyhow::Result> { + todo!() + } + + pub fn split_with_offsets4( + pattern: &str, + subject: &str, + limit: i64, + flags: i64, + ) -> anyhow::Result> { + todo!() + } + + pub fn grep(pattern: &str, array: &[&str]) -> anyhow::Result> { + todo!() + } + + pub fn grep3(pattern: &str, array: &[&str], flags: i64) -> anyhow::Result> { + todo!() + } + + pub fn is_match(pattern: &str, subject: &str) -> anyhow::Result { + todo!() + } + + pub fn is_match3( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>, + ) -> anyhow::Result { + todo!() + } + + pub fn is_match4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>, + flags: i64, + ) -> anyhow::Result { + todo!() + } + + pub fn is_match5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>, + flags: i64, + offset: usize, + ) -> anyhow::Result { + todo!() + } + + pub fn is_match_strict_groups(pattern: &str, subject: &str) -> anyhow::Result { + todo!() + } + + pub fn is_match_strict_groups3( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>, + ) -> anyhow::Result { + todo!() + } + + pub fn is_match_strict_groups4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>, + flags: i64, + ) -> anyhow::Result { 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> { + pub fn is_match_strict_groups5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>, + flags: i64, + offset: usize, + ) -> anyhow::Result { todo!() } - /// Returns named captures in an IndexMap. - pub fn is_match_named( + pub fn is_match_with_offsets(pattern: &str, subject: &str) -> anyhow::Result { + todo!() + } + + pub fn is_match_with_offsets3( pattern: &str, subject: &str, - matches: &mut IndexMap, + matches: Option<&mut indexmap::IndexMap>, ) -> anyhow::Result { 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>> { + pub fn is_match_with_offsets4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>, + flags: i64, + ) -> anyhow::Result { todo!() } - /// Returns captures with byte offsets: IndexMap>. - pub fn is_match_all_with_offsets( + pub fn is_match_with_offsets5( pattern: &str, subject: &str, - matches: &mut IndexMap>, + matches: Option<&mut indexmap::IndexMap>, + flags: i64, + offset: usize, ) -> anyhow::Result { 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 { + todo!() + } + + pub fn is_match_all3( pattern: &str, subject: &str, - ) -> anyhow::Result>> { + matches: Option<&mut indexmap::IndexMap>>, + ) -> anyhow::Result { + todo!() + } + + pub fn is_match_all4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>>, + flags: i64, + ) -> anyhow::Result { + todo!() + } + + pub fn is_match_all5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>>, + flags: i64, + offset: usize, + ) -> anyhow::Result { todo!() } - /// Like is_match_strict_groups but returns named captures as IndexMap. - pub fn match_strict_groups(pattern: &str, subject: &str) -> Option> { + pub fn is_match_all_strict_groups(pattern: &str, subject: &str) -> anyhow::Result { todo!() } + + pub fn is_match_all_strict_groups3( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>>, + ) -> anyhow::Result { + todo!() + } + + pub fn is_match_all_strict_groups4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>>, + flags: i64, + ) -> anyhow::Result { + todo!() + } + + pub fn is_match_all_strict_groups5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>>, + flags: i64, + offset: usize, + ) -> anyhow::Result { + todo!() + } + + pub fn is_match_all_with_offsets(pattern: &str, subject: &str) -> anyhow::Result { + todo!() + } + + pub fn is_match_all_with_offsets3( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>>, + ) -> anyhow::Result { + todo!() + } + + pub fn is_match_all_with_offsets4( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>>, + flags: i64, + ) -> anyhow::Result { + todo!() + } + + pub fn is_match_all_with_offsets5( + pattern: &str, + subject: &str, + matches: Option<&mut indexmap::IndexMap>>, + flags: i64, + offset: usize, + ) -> anyhow::Result { + 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!() } -- cgit v1.3.1