diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-06 03:46:41 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-06 03:46:41 +0900 |
| commit | 92d2199afcecd0056e82d2559700769715401ef0 (patch) | |
| tree | b9d65620db53bc19f800247660e560f3f8775217 /crates/shirabe/tests/package/archiver | |
| parent | 27e81d5e5ca0a89eb176a65b1d9f186658b16f50 (diff) | |
| download | php-shirabe-92d2199afcecd0056e82d2559700769715401ef0.tar.gz php-shirabe-92d2199afcecd0056e82d2559700769715401ef0.tar.zst php-shirabe-92d2199afcecd0056e82d2559700769715401ef0.zip | |
refactor(php-shim): take filesystem paths as impl AsRef<Path>
The shim's filesystem entry points took `&str` even though each one resolves
to a local path through `std::fs` or a syscall, so callers holding a `PathBuf`
had to stringify it at the call site. They now take `impl AsRef<Path>`, the
form `file_exists`, `is_dir`, `unlink` and the rest of the already-converted
set use.
`Phar`, `PharData` and `ZipArchive` keep their archive path as a `PathBuf`.
`PharData::compress` names the compressed sibling by appending the suffix to
the file name rather than formatting the path into a `String`.
Arguments PHP resolves through a stream wrapper (`fopen`, `file_put_contents`,
`include`) still take `&str`, as do the byte-string operations (`dirname`,
`basename`, `pathinfo`) and archive-internal entry names, which are `/`-joined
logical names rather than OS paths.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests/package/archiver')
| -rw-r--r-- | crates/shirabe/tests/package/archiver/phar_archiver_test.rs | 2 | ||||
| -rw-r--r-- | crates/shirabe/tests/package/archiver/zip_archiver_test.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/crates/shirabe/tests/package/archiver/phar_archiver_test.rs b/crates/shirabe/tests/package/archiver/phar_archiver_test.rs index 7d879973..a9163058 100644 --- a/crates/shirabe/tests/package/archiver/phar_archiver_test.rs +++ b/crates/shirabe/tests/package/archiver/phar_archiver_test.rs @@ -53,7 +53,7 @@ impl ArchiverTestCase { fn write_file(&self, path: &str, content: &str, current_work_dir: &str) { if !file_exists(dirname(path)) { - mkdir(&dirname(path), 0o777, true); + mkdir(dirname(path), 0o777, true); } let result = file_put_contents(path, content.as_bytes()); diff --git a/crates/shirabe/tests/package/archiver/zip_archiver_test.rs b/crates/shirabe/tests/package/archiver/zip_archiver_test.rs index b94beb6c..e20ca624 100644 --- a/crates/shirabe/tests/package/archiver/zip_archiver_test.rs +++ b/crates/shirabe/tests/package/archiver/zip_archiver_test.rs @@ -106,7 +106,7 @@ impl ArchiverTestCase { fn write_file(&self, path: &str, content: String, current_work_dir: &str) { if !file_exists(dirname(path)) { - mkdir(&dirname(path), 0o777, true); + mkdir(dirname(path), 0o777, true); } let result = file_put_contents(path, content.as_bytes()); |
