aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-external-packages/src/symfony/filesystem/filesystem.rs
AgeCommit message (Collapse)Author
2026-08-09refactor(symfony-filesystem): extract symfony/filesystem into the ↵nsfisis
shirabe-symfony-filesystem crate Move `Symfony\Component\Filesystem` out of shirabe-external-packages and into its own crate, so the path is `shirabe_symfony_filesystem::Filesystem` instead of `shirabe_external_packages::symfony::filesystem::Filesystem`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-09refactor(php-shim): make the fs mutators return Resultnsfisis
mkdir, rmdir, unlink and symlink each had a bool version and a _result twin returning the io::Error, which left two names for one call. Keep only the Result form and let the callers that want a boolean spell out .is_ok(). Call sites that discard the outcome, as their PHP originals do, are unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-09feat(symfony-filesystem): append the failure reason to IOExceptionsnsfisis
Symfony wraps its native filesystem calls in box(), which captures the warning text of a failed call into self::$lastError and appends it to the IOException message. The port dropped that text because the shim's mkdir, rmdir, unlink and symlink only return PHP's bare false. Give each of those a Result-returning variant carrying the io::Error, and use it to restore the appended reason. That also makes two conditions portable: doRemove()'s "Permission denied" test, and linkException()'s Windows error code 1314 special case. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-09refactor(external-packages): test for Windows with cfg!(windows)nsfisis
MAIN_SEPARATOR is the path separator; PHP's `'\\' === DIRECTORY_SEPARATOR` uses it as an OS test only because PHP has no dedicated one. cfg!(windows) says what the branch actually selects on, and leaves MAIN_SEPARATOR to the sites that really join or split paths. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-09refactor(php-shim): use std::path::MAIN_SEPARATOR over a shim constantnsfisis
The shim's DIRECTORY_SEPARATOR was hardcoded to "/", so every ported `'\\' === DIRECTORY_SEPARATOR` check compared against a constant that does not track the target platform. std::path::MAIN_SEPARATOR and MAIN_SEPARATOR_STR carry the same meaning as PHP's constant and resolve per platform, so the Windows branches are selected on Windows targets. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-08feat(php-shim): give ported exceptions PHP's class hierarchynsfisis
Ported exceptions were flat structs reached with `downcast_ref`, so Composer's `catch (\RuntimeException $e)` only matched the exact leaf type and `get_class($e)` had nothing to report. Each exception now embeds an instance of the class it extends and travels inside an `AnyThrowable`; `Catch::catch`/`catch_mut` walk that chain, and `PhpClass::php_class_name` yields the PHP FQCN. Dropping the `std::error::Error` impls from the exception types leaves `AnyThrowable` as the only route into an `anyhow::Error`, so the walk cannot be bypassed. A `no_exception_downcast` linter catches the `downcast::<X>()` calls that would now silently answer `None`. Three sites change behavior as a result: the `TransportException` exit-code override reaches `MaxFileSizeExceededException`, the `catch (\LogicException)` in findSimilar() reaches its subclasses, and rendered exception titles carry the real class name rather than a guess. `get_class_err()` is no longer a `todo!()`, which re-enables FilesystemRepositoryTest::testCorruptedRepositoryFile. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-06fix(symfony-filesystem): restore upstream behavior in five spotsnsfisis
Port the Symfony Filesystem branches this file had left out: * copy() preserves the origin mtime via touch() * exists() rejects paths longer than PHP_MAXPATHLEN - 2, so its return type becomes anyhow::Result<bool> * doRemove()'s symlink branch keeps the DIRECTORY_SEPARATOR disjunct, which stops it from throwing on Unix where upstream never does * symlink() normalizes separators and mirrors instead of linking when copyOnWindows is set * mirror() skips entries whose real path is the target directory or was already created earlier in the same call PHP_MAXPATHLEN is new in shirabe-php-shim. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04docs: state code facts instead of porting-phase progressnsfisis
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-25refactor: replace redundant clones with movesnsfisis
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-24docs(symfony-filesystem): mark unported Filesystem gaps with TODO(phase-c)nsfisis
Audited every remaining method in the Symfony Filesystem port against composer/vendor/symfony/filesystem/Filesystem.php and tagged each divergence with a searchable TODO(phase-c): the missing self::$lastError propagation, copy()'s collapsed fopen-failure messages and skipped mtime preservation, exists()'s missing PHP_MAXPATHLEN guard, do_remove()'s unported rename/rollback safety trick and its Unix short-circuit gap, symlink()'s unported Windows path-normalization/copy_on_windows fallback, link_exception()'s unported error-code-1314 message, read_link()'s missing canonicalize=true overload and its Windows PHP<7.4 quirk, and mirror()'s missing getRealPath()/filesCreatedWhileMirroring dedup. Windows-only branches were previously left with plain comments claiming they "never run on Unix" instead of the required TODO marker, which understates them as permanently out of scope rather than unported work. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-24refactor(symfony-filesystem): remove unused Filesystem API surfacensfisis
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-06-27refactor: fix compiler warnings and clippy warningsnsfisis
2026-06-25feat(filesystem): port Symfony Filesystem methodsnsfisis
Faithfully port the Symfony Filesystem component methods (copy, mkdir, exists, touch, remove, chmod, rename, symlink, hard_link, read_link, make_path_relative, mirror, is_absolute_path, dump_file, append_to_file, temp_nam) from the PHP source, using existing php-shim functions and std where no shim exists. chown/chgrp need chown(2) (no std/shim equivalent) and the mirror filter-iterator branch is unmodeled; both left as todo!() with documented reasons. The four Composer\Util\Filesystem helpers mistakenly stubbed here stay todo!(). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14chore: add "ref" comments to file headernsfisis
2026-06-08refactor(external-packages): drop component segment from symfony pathsnsfisis
Align the Symfony namespace mapping with the documented convention (symfony::component::X -> symfony::X) and remove now-unused console stub files. Update all import paths across the workspace. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>