From 92d2199afcecd0056e82d2559700769715401ef0 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 6 Aug 2026 03:46:41 +0900 Subject: refactor(php-shim): take filesystem paths as impl AsRef 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`, 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) --- crates/shirabe/tests/command/validate_command_test.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/shirabe/tests/command/validate_command_test.rs') diff --git a/crates/shirabe/tests/command/validate_command_test.rs b/crates/shirabe/tests/command/validate_command_test.rs index c40f66b2..8e78dfe7 100644 --- a/crates/shirabe/tests/command/validate_command_test.rs +++ b/crates/shirabe/tests/command/validate_command_test.rs @@ -163,7 +163,7 @@ fn test_unaccessible_file() { let tear_down = init_temp_composer(Some(&minimal_valid_configuration()), None, None, true); let composer_json = tear_down.working_dir().join("composer.json"); - shirabe_php_shim::chmod(&composer_json.to_string_lossy(), 0o200); + shirabe_php_shim::chmod(&composer_json, 0o200); let mut app_tester = get_application_tester(); app_tester @@ -176,6 +176,6 @@ fn test_unaccessible_file() { ); assert_eq!(3, app_tester.get_status_code()); - shirabe_php_shim::chmod(&composer_json.to_string_lossy(), 0o700); + shirabe_php_shim::chmod(&composer_json, 0o700); drop(tear_down); } -- cgit v1.3.1