| Age | Commit message (Collapse) | Author |
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Composer hands the exception it caught to the one it throws in its place,
so `getPrevious()` reaches the cause and Application's renderer prints the
whole chain. Every ported site dropped it, because the flat exception
structs had nowhere to put one. `AnyThrowable::into_previous` turns the
caught error into that argument, and the 13 sites now pass it.
`getCode()` came along for the ride at the four sites that derive the new
exception's code from the caught one (PharArchiver, ArrayLoader x2), and
ComposerRepository's message now names the caught exception's class
instead of the literal "Exception".
GitHubDriver::attemptCloneFallback took the previous exception's message
and appended it to its own, which no `\RuntimeException('Fallback to git
driver disabled')` in Composer ever says; it now chains it instead.
Git::syncMirror restores what PHP's `finally` does to an exception in
flight: the `git remote set-url` that scrubs credentials back out of the
URL runs in a `finally`, and when it fails PHP propagates *its* exception
over the one already leaving, chaining the displaced one as previous. The
port discarded the finally's result, so a failure to scrub the URL was
reported as a successful mirror sync. `AnyThrowable::set_previous`
models the engine-level chaining.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
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>
|
|
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>
|
|
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
|
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>
|
|
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
|
|
|
|
|
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>
|
|
|
|
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>
|