From e89e1785e3df047a869c48b91709289a3b145b49 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 6 Jun 2026 14:29:50 +0900 Subject: refactor(archiver): yield PathBuf from ArchivableFilesFinder, drop SplFileInfo Migrate ArchivableFilesFinder off Symfony's SplFileInfo onto Path/PathBuf, resolving the phar_archiver TODO(phase-b) that required a .map() adapter to bridge SplFileInfo -> PathBuf. - ArchivableFilesFinder now yields PathBuf; accept() takes &Path; the exclude closure receives &Path and uses Path::canonicalize / is_symlink. The SplFileInfo -> PathBuf conversion happens once at the symfony get_iterator boundary (get_iterator stays SplFileInfo for cache.rs). - symfony Finder::filter callback changed to FnMut(&Path) (sole caller is the finder). - PharArchiver passes the finder straight into ArchivableFilesFilter, mirroring PHP's new ArchivableFilesFilter($files). - ZipArchiver consumes PathBuf items, computing the relative path via strip_prefix(sources) in place of SplFileInfo::getRelativePathname. Co-Authored-By: Claude Opus 4.8 --- crates/shirabe/src/package/archiver/phar_archiver.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'crates/shirabe/src/package/archiver/phar_archiver.rs') diff --git a/crates/shirabe/src/package/archiver/phar_archiver.rs b/crates/shirabe/src/package/archiver/phar_archiver.rs index bf5332a..d2854eb 100644 --- a/crates/shirabe/src/package/archiver/phar_archiver.rs +++ b/crates/shirabe/src/package/archiver/phar_archiver.rs @@ -70,10 +70,7 @@ impl ArchiverInterface for PharArchiver { *formats.get(format.as_str()).unwrap_or(&Phar::TAR), ); let files = ArchivableFilesFinder::new(&sources, excludes, ignore_filters)?; - // TODO(phase-b): unify iterator types (ArchivableFilesFinder yields SplFileInfo, - // ArchivableFilesFilter expects PathBuf). - let mut files_only = - ArchivableFilesFilter::new(Box::new(files.map(|f| f.get_pathname().into()))); + let mut files_only = ArchivableFilesFilter::new(Box::new(files)); phar.build_from_iterator(&mut files_only, &sources); files_only.add_empty_dir(&phar, &sources); -- cgit v1.3.1