| Age | Commit message (Collapse) | Author |
|
Three fixes for the ComposerRepository/FilesystemRepository/PlatformRepository
hazards where inner-composition delegation skipped PHP's late-bound virtual
dispatch:
- ComposerRepository::has_package now builds its packageMap through the
late-bound getPackages() equivalent, so lazy-providers repos surface the
LogicException and available-packages repos load their package list, as in
PHP, instead of silently answering false from the raw array.
- RepositoryInterface::get_repo_name returns anyhow::Result<String>: PHP's
getRepoName() counts through the late-bound initialize(), which is fallible
in file-reading subclasses. FilesystemRepository and PackageRepository now
run that initialization instead of freezing the inner array repository to an
empty state (which also made a later write() truncate installed.json).
Supporting changes keep the initialization chain callable from &self:
JsonFile::read takes &self (indent moved into a RefCell), FilesystemRepository
dev_mode became a Cell, and WritableArrayRepository dev_package_names a
RefCell.
- PlatformRepository::new routes constructor packages through its own
add_package so the override handling and full platform initialization run
as they do via PHP's parent constructor; the inner find_package/add_package
delegations inside add_package (and ComposerRepository::add_package) gained
the same is_initialized guard, since the constructor path would otherwise
freeze the repository.
Same defect class as 7db937af, 97b5211a and 3e367f78.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
fallthroughs
findPackage()/findPackages()/search() delegate their non-lazy, non-provider
fallthrough to the inner ArrayRepository, whose self-initialization froze the
packages array before ComposerRepository::initialize could read the root file,
so a plain v1-style repo (inline "packages" in packages.json) always answered
empty. Guard the delegations with the same is_initialized() check used by
count()/hasPackage().
getProviders() had the inverse defect: PHP reads the raw $this->packages
property, but the port went through count(), whose initialize poisoned the
initialization flag so the root file would never load afterwards. Check the
raw field for non-empty instead, matching PHP's truthiness test.
Same defect class as 97b5211a and the 3e367f78 downloader fix.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
add/remove
ArrayRepository::addPackage()/removePackage() rely on PHP late binding to run
FilesystemRepository::initialize (reading the file) on first touch. The inner
delegation skipped that: an add on a not-yet-read repository froze the array
to just the added packages (a later write() would truncate installed.json),
and a remove hit the packages-initialized expect(). Guard both with
ensure_initialized(), matching the pattern used by the read paths.
Same defect class as the 3e367f78 downloader fix.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
Add NO_COLOR=1, the COMPOSER/COMPOSER_VENDOR_DIR/COMPOSER_BIN_DIR clears and
the timezone normalization, and make bootstrap() Once-guarded so additional
call sites stay safe. Wiring it into every test binary still needs a libtest
setup hook (ctor crate or fixture-level calls), recorded in the TODO.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
mb_check_encoding
http_get_last_response_headers()/http_clear_last_response_headers() now back
a thread-local store with a recording hook for the (still unported) HTTP
stream layer; with no request recorded they return None, matching PHP.
mb_check_encoding gains the trivial ASCII arm; other encodings still need
the mbstring tables and stay todo!().
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
PHP's JsonFile::encode throws a RuntimeException when json_encode fails; the
port swallowed that into an .unwrap() marked TODO(phase-c). Return
anyhow::Result from encode/encode_with_options and propagate at every call
site (print_table and list_repositories become Result-returning to carry it).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
PHP's getStyle returns the shared style instance (reference semantics), which
the previous Box-returning signature could not express, leaving a todo!().
Store each style behind Rc<RefCell<...>> and hand out handle clones, per the
shared-ownership policy.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
Phar::running has its only Composer call site in SelfUpdateCommand, and
self-update will not go through a phar in Shirabe. The .phar writing API
(and the SHA512 constant it takes) is only used by Composer's Compiler,
which packages composer.phar and has no counterpart in a native binary.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Retag every Shirabe-authored TODO comment to one of the fixed tags:
phase-c, phase-d, plugin, php-runtime, phase-e.
Upstream-authored TODO comments from Composer/Symfony are left
untouched to preserve the ported code shape.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
Rust has no runtime class name, so `Command::get_class` existed purely to
let each command hand back its PHP class name, supplied through the
two-argument variant of `delegate_command_trait_impls_to_inner!` at the
impl site. Replace it with a general `PhpClass` trait plus an
`impl_php_class!` macro, so the name is stated once next to the type
definition and the mechanism is reusable outside commands.
`Command` gains `PhpClass` as a supertrait and drops `get_class`, and
`VcsDriverKind`'s hand-rolled `php_class_name` table moves onto the trait.
Behavior is unchanged: the same class-name strings are reported, and the
base command state still panics when asked for a name it cannot supply.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
args
Review of the suggested-values wiring against the PHP originals found:
- audit --format (Auditor::FORMATS) and --abandoned (Auditor::ABANDONEDS)
had no suggestions; only ignore-severity had been converted
- the same constant-passing shape was missed on --audit-format
(Auditor::FORMATS) in update, install, require, create-project and
remove
- update's packages argument used suggest_installed_package(false, true),
but PHP's suggestInstalledPackage(false) expands to (false, false); the
stray true came from an incorrect old TODO comment, and made platform
packages appear among the candidates
With these, every one of the 47 suggestedValues sites in the PHP command
definitions has a matching new5/new6 call.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
Adds the Symfony console test helper (Tester/CommandCompletionTester) and
ports every CompletionFunctionalTest data-provider entry as an individual
test. The tests reproduce the PHP environment by chdir'ing into the
vendored composer/ checkout (its composer.json/lock provide the installed
packages, scripts and package properties the expectations reference); the
Packagist-backed entries query the live repository exactly like the PHP
test does. Only `exec ` is ignored: its expectations require the dev
checkout's fully installed vendor/bin, which the vendored checkout does
not ship.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
Ports the per-command completion metadata that PHP passes as the
suggestedValues constructor argument, resolving all TODO(cli-completion)
markers:
- CompletionTrait providers on 18 argument/option sites (installed/root/
available package names, package types, prefer-install)
- static value lists (--format on show/outdated/search/fund/licenses/
check-platform-reqs, archive's FORMATS, audit --ignore-severity,
update --bump-after-update, repository's action list)
- command-specific closures: ConfigCommand::suggest_setting_keys,
ShowCommand::suggest_package_based_on_mode, RepositoryCommand's
suggest_repo_names/suggest_type_for_add, exec/run-script inline
closures (downcast from the this argument, as the closures are bound
to their concrete command in PHP)
- GlobalCommand::complete, delegating completion to the wrapped
subcommand through CompletionInput::from_string
- a complete() override on every Composer command forwarding to
base_command_complete (BaseCommand inheritance restoration)
Also fixes CompleteCommand to call merge_application_definition(true) as
PHP's default-argument call does; with false the application-level
"command" argument was missing from the bound definition, shifting every
argument-position detection by one.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
The seven suggest* methods resolve package names, types, and install
preferences for shell completion. PHP returns $this-bound closures; here
each method returns a SuggestedValues whose closure receives the bound
command as `this` at call time. The blanket impl over every BaseCommand
mirrors PHP's per-command `use CompletionTrait;` (the methods are private
there, so the wider visibility is observationally equivalent).
Notable PHP shapes kept: the hintsToFind counter machine iterates a
by-value copy per package (continue 2 -> labelled continue), and
suggestAvailablePackage pins an exact vendor match before truncating to
$max entries.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
PHP's CompletionInput extends ArgvInput, so it can be passed anywhere an
InputInterface is expected (GlobalCommand::complete binds and forwards it,
suggestion closures read options and arguments from it). The Rust port only
embedded the ArgvInput, so none of that surface was reachable.
Implement InputInterface by forwarding to the embedded ArgvInput, with bind
dispatching to the specialized CompletionInput::bind (PHP's virtual
dispatch), derive Clone, and teach GlobalCommand::input_to_string the
CompletionInput branch.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
InputArgument/InputOption
Composer backports symfony/console 6.1's $suggestedValues parameter in
Composer\Console\Input\{InputArgument,InputOption}; the Rust newtypes had
dropped it. PHP closures are bound to the command ($this), but a command
cannot capture a handle to itself while configure() runs inside new(), so
the closure receives the bound command as an explicit `this` argument at
call time instead.
- add SuggestedValues (list | this-taking closure) and wire it through
InputArgument::new5 / InputOption::new6 and their complete() methods
- track Composer-typed definition entries by name in BaseCommandData side
maps, standing in for PHP's instanceof checks (set_definition converts
entries to the Symfony types for storage)
- add base_command_complete, the BaseCommand::complete dispatch shared by
every Composer command
- introduce BaseCommand::base_command_data and make command_data a default
method on top of it
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
The _complete and completion commands were registered but always panicked:
get_class_of_command / instantiate_completion_output / tail_debug_log were
todo!() and the completion.bash resource was not shipped.
- make Command::complete return anyhow::Result so completion errors
propagate to CompleteCommand's catch-all (exit code 2) like PHP
- add Command::get_class as the port hook for PHP's get_class() debug log;
every command supplies its PHP FQCN via the delegation macro
- embed Resources/completion.bash at compile time (single-binary port);
get_supported_shells becomes a static list
- implement tail_debug_log by moving the shared output handle into the
'static process callback
- add OutputInterface::as_console_output so unsupported-shell errors go to
stderr as in PHP
- fix CompletionInput::bind to keep the argument name PHP assigns in the
foreach head even when the loop breaks on the first unset argument;
application-level completion always hit this and returned no suggestions
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
Several shim functions were left as todo!() because the standard library
exposes no equivalent and no syscall crate was available. Adding nix
unblocks them:
- proc_open now wires descriptors beyond stderr, creating the pipe itself
and installing the child end with dup2(2) from pre_exec
- proc_terminate and posix_kill deliver arbitrary signals via kill(2)
- get_current_user reports the owner of the running executable
- php_uname answers every mode from uname(2) instead of only "s" and "r"
It also closes gaps that were previously approximated:
- fstat stats the stdio streams and pipes rather than reporting failure
- touch stamps mtime/atime on an existing path, including directories
- is_writable/is_executable use access(2) instead of permission bits
- umask falls back to the read-modify-write umask(2) off Linux
The hand-written repr(C) structs and extern "C" declarations for getpwuid,
utime, statvfs, fcntl and select are replaced by their nix wrappers, which
in turn lets disk_free_space drop its Linux-only cfg.
cli_set_process_title, setproctitle and the pcntl_signal pair stay as
todo!(): the first two need access to the process's own argv block, and
the latter two depend on the signal-handling subsystem rather than on
sigaction(2) itself.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
IOInterface::ask/select now return anyhow::Result<PhpMixed>, and
ConsoleIO::ask_question forwards QuestionHelper errors (validator
failures, MissingInputException) instead of collapsing them with
.expect(). In PHP these exceptions propagate from QuestionHelper
through ConsoleIO to the caller, so callers such as UpdateCommand's
interactive package selection must be able to observe them; the
MissingInputException is wrapped with its concrete type preserved so
Application's ExceptionInterface downcast keeps working. All call
sites now propagate with `?` (Perforce::query_p4_user becomes
Result-returning: PHP declares it void but exceptions still escape),
and the previously ignored
test_interactive_mode_throws_if_no_package_entered passes.
ask_confirmation/ask_and_hide_answer still collapse errors; extending
propagation to them is left as TODO(phase-c) pending a decision.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
PHP's Input::bind() -> ArgvInput::parse() calls $this->parseToken(),
which late-binds to CompletionInput::parseToken; that override swallows
per-token RuntimeExceptions so an incomplete command line still parses.
Delegating CompletionInput::bind to ArgvInput::bind pinned the call to
ArgvInput's parseToken, aborting the whole parse on the first invalid
token and leaving CompletionInput::parse_token dead.
parseToken is protected and not on any trait, so ArgvInput::base_bind
threads the concrete implementation in as a callback instead of a trait
object.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
PHP's ArrayRepository::count()/hasPackage() call $this->initialize(),
which late-binds to the concrete repository class and lazily loads its
packages. The Rust pass-throughs skipped that: they ran ArrayRepository's
stub initialize instead, returning 0/false and marking the repository
initialized with an empty package list, which made ensure_initialized()
skip the real initialization forever after.
Take &mut self in RepositoryInterface::count/has_package so the lazy
repositories (Filesystem, Platform, Composer) can guard with their real
initialize, and return Result from has_package since that initialization
can fail (PHP propagates the exception). InstallerInterface::is_installed
and InstallationManager::is_package_installed/mark_alias_installed
propagate the same way, which also resolves the TODO(phase-d) markers on
Package/Path/Artifact/Vcs repositories about initialization errors being
swallowed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
PHP's FileDownloader::getLocalChanges and ::update call $this->download()
/ $this->install() / $this->remove() / $this->getInstallOperationAppendix(),
which late-bind to the concrete downloader class. The Rust port embeds the
parent as `inner`, so delegating these methods to FileDownloader pinned the
calls to FileDownloader's own implementations: `status` built the compare
tree without extracting the archive (flagging every file of dist-installed
packages as changed), and `update` re-installed the raw dist file instead
of extracting it.
Thread the concrete downloader in as `this: &dyn DownloaderInterface` via
shared helpers (base_get_local_changes / base_update) and pass `self` from
each delegating downloader.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
|
|
Rust's &str is always valid UTF-8, so the mbstring/iconv sanitization
chain can never trigger. Reduce it to a no-op with a TODO(phase-c)
marker: once the codebase strictly separates Vec<u8> from String, this
should take &[u8] and convert lossily. This removes the last caller of
the php-shim iconv(), so delete it as well.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
Remove the eight Cursor methods that have no callers, and the sscanf
shim whose only caller was Cursor::get_current_position.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
The only callers were trivial fixed-format uses: reading the first
four hash bytes as a native int, splitting in_addr byte strings, and
building a constant ZIP EOCD record. Each site now does the byte
manipulation directly, so the general-purpose shims are no longer
needed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
%e/%E/%g/%G never appear in Composer's own format strings (verified by
sweeping composer/src and vendor); supporting PHP's exponent formatting
is intentionally out of scope, so fail permanently instead of marking
the specifiers as pending work.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
The two summary templates are compile-time constants, so the runtime
sprintf shim is unnecessary; carry the tag and the "ignored " prefix
through the passes list instead of pre-built template strings.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
A native binary never ships vendor/composer/installed.json, so
Composer's "non-standard Composer installation" warning fired on every
diagnose run and forced exit 1. The self-audit itself stays: a Composer
source snapshot is planned to be embedded together with the plugin API
implementation, which will make it functional; until then the missing
file reports success, marked with TODO(phase-c).
Also un-ignore diagnose_command_test::test_cmd_success: the other half
of its ignore reason ("requires real network access") is no blocker —
the PHP original runs its live packagist/github checks unguarded too.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
Glob::toRegex emits PCRE-only constructs — the (?=[^\.]) look-ahead for
the strict-leading-dot rule, the possessive [^/]++ in /**/ segments,
and, via BaseExcludeFilter, the (?=$|/) dir-boundary look-ahead — which
the regex crate cannot compile, so `archive` and every
ArchivableFilesFinder path panicked. Rewrite the port to tokenize the
glob (mirroring the PHP loop's dispatch) and resolve every no-dot
constraint by recursive union expansion. The dir boundary must take
part in that expansion (a trailing `*` matching zero characters drops
the constraint onto the boundary itself), so BaseExcludeFilter now uses
the new Glob::to_regex_dir_boundary instead of string surgery.
Equivalence was verified against PHP 8.5.8 (vendored Glob.php +
preg_match) over 66,176 glob x flag x subject combinations with zero
divergence. Un-ignores the five archiver tests blocked on this and
updates GitExcludeFilterTest's expected pattern text, an explicitly
authorized exception to the no-test-modification rule.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
Resolve the remaining todo!()s in SymfonyStyle, OutputStyle,
QuestionHelper and SymfonyQuestionHelper:
* Wire up the virtual dispatch PHP performs for the protected
writePrompt()/writeError() overrides, following the codebase's
established inheritance idiom (Command, ArchiveDownloader): the base
class becomes a trait (QuestionHelperInterface, named after the
QuestionInterface precedent) whose provided methods ask/do_ask/
validate_attempts carry the template logic and late-bind the
write_prompt/write_error hooks through Self, with inner()/inner_mut()
reaching the base-class state. SymfonyQuestionHelper overrides the
hooks as plain trait-impl methods, mirroring PHP's protected-method
overriding, so SymfonyStyle-driven questions now render the Symfony
Style Guide prompt.
* Type definition_list input as an enum (string|array|TableSeparator)
because PhpMixed intentionally cannot carry objects; the
InvalidArgumentException branch (a LogicException) becomes
unrepresentable. horizontal_table now takes typed Cells/Rows.
* Propagate the MissingInputException thrown inside autocomplete()
through a Result instead of aborting.
* Implement as_console_output_interface via Ref::filter_map on
ConsoleOutput, the interface's only implementor.
* Port progressIterate eagerly, following ProgressBar::iterate.
* Map __FILE__ to current_exe(): a native binary never runs from a
phar, so the hiddeninput.exe relocation branch correctly never fires.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
Adopt the tar, flate2, and bzip2 crates to fill in the phar.rs and
compress.rs todos: PharData tar/zip reading, building, and whole-archive
compression, plus a native .phar reader that follows the php.net
file-format manual and verifies hash-based signatures. Callers now
propagate the constructor/extract errors PHP throws, and fwrite accepts
byte strings so gzread no longer needs lossy UTF-8.
The native .phar writing API stays todo!() (no call sites; Composer's
Compiler is not ported) and OPENSSL phar signatures are accepted
unverified (TODO(phase-c)).
This unblocks Tar::getComposerJson and the tar/phar/gzip downloaders;
tar_test (7), artifact_repository_test (2), and phar_archiver_test zip
(1) are un-ignored. The archive command itself still panics because
ArchiveManager::archive always generates glob excludes whose look-ahead
regexes the regex crate cannot compile; converting those patterns to
regex-compatible ones is a separate, still-undecided work item.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
The audit in .ken/php-shim-copying.md judged 14 functions in
shirabe-php-shim (plus php_wordwrap in shirabe-external-packages) to be
line-by-line transcriptions or structural imitations of php-src. PHP's
relicensing to 3-clause BSD makes keeping them legal, but the boundary
between BSD-derived and MIT code was invisible in the source tree.
Moving them into their own crate puts the license into the build
metadata (so NOTICE generation follows the binary), makes a reverse
dependency a compile error, and encodes the origin in the module path,
which mirrors php-src's ext tree. Each function records its origin in a
fixed-format doc comment, and a new php_src_derivation_boundary linter
fails if `php-src` appears in any Rust source outside the crate.
Public paths under shirabe_php_shim:: are unchanged: functions that are
themselves derived are re-exported with `pub use`, and the wrappers that
only validate arguments stay on the MIT side.
This also resolves the duplicate wordwrap implementation.
shirabe_php_shim::wordwrap was todo!(), so SymfonyStyle::block panicked,
while shirabe-external-packages carried its own copy. Both now go
through the single port, verified against real PHP on 13 cases covering
multi-character breaks and cut.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
The line was a "TODO: curl_version()" placeholder. Extend the diagnose
payload with curl_version() and the CURL_* constants getCurlVersion()
consults, so the libz/brotli/zstd/ssl/HTTP details come from the PHP
runtime instead of being guessed. curl_version() is only reachable while
the extension is loaded, mirroring the ioncube_loader_* entries.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
PHP's BufferIO defaults to StreamOutput::VERBOSITY_NORMAL; passing 0 sits
below VERBOSITY_QUIET, so every write was dropped and "Audit found some
issues:" was followed by an empty advisory table.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
mb_detect_encoding reports "ASCII" for pure ASCII input, so the
conversion paths of toCodePointString/toByteString are reachable: the
formatter's addLineBreaks feeds the detected encoding straight back into
them. Port PHP's mb_convert_encoding calls, which the shim already
handles for ASCII/UTF-8.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
buildTableRows panicked on the unported formatAndWrap call, so any table
with a max column width (e.g. the audit advisory table) aborted the
process. PHP calls the formatter as a WrappableOutputFormatterInterface;
model that instanceof as an AsAny downcast to OutputFormatter, the sole
implementor in this port.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
diagnose used to read hardcoded shim stubs, so it described a fictional
runtime: OPENSSL_VERSION_NUMBER was always 0 and tripped the TLSv1.1/1.2
check, PHP_BINARY and OPENSSL_VERSION_TEXT were empty, and the extension,
function and ini probes answered from a fixed table.
The PHP worker gained a `diagnose` entry that returns every fact the
command needs as one PHP array, cached in a OnceLock so the several call
sites share a single round trip. Reading it back needed array support in
the serialize() parser, which in turn lets get_loaded_extensions and
get_all_ini_files return real lists instead of comma-joined strings.
Also fixes the openssl_version message, which dropped strstr()'s
before_needle argument during the port, and check_connectivity's
allow_url_fopen test, which did not follow PHP string truthiness.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
The ALLOW_SHADOWED_REPOSITORIES probe that decides whether to raise the
repository-priority error hardcoded ignoreNothing(), while PHP reuses
$platformRequirementFilter. With --ignore-platform-req the probe could fail to
find the lower-priority package and suppress the error PHP would raise.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
The `fixed` option was read as a temporary inside the argument list of
update_requirements_after_resolution(), so the Ref lived until the end of the
enclosing let statement — i.e. across the whole call. When the resolved version
looks like a feature branch, that call asks for confirmation, and ConsoleIO
takes the same input RefCell mutably, panicking with "RefCell already borrowed".
Hoisting the read into its own statement ends the borrow before the call.
The expected output of the un-ignored test transcribed PHP's string
concatenation operator (`[y,n]? '.'`, used to keep the trailing space visible)
as a literal `.`; it now matches RequireCommandTest.php.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
findBestVersionForPackage is the only findBestCandidate() caller that PHP hands
$this->getIO() to; the port passed None, so VersionSelector silently skipped
every "Cannot use <pkg> as it requires <ext> which is missing from your
platform" warning. require/update/create-project therefore dropped a candidate
without telling the user why.
Un-ignores require_command_test::test_require, whose first data-provider case
asserts exactly that warning.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
get_plugin_commands now yields shared command handles so the discovered
commands can go through the same add() path as built-in ones, dropping the
placeholder that discarded them.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
build.rs guessed target/<profile> from OUT_DIR to place res/*.json next to
the executable (twice, since test binaries live in deps/), and JsonFile
resolved them through current_exe(). That made the binary undistributable
on its own.
The schemas are now include_str!'d and referenced through a
shirabe:///res/ URI that SchemaRetriever resolves, keeping the $ref
indirection PHP uses for the phar case. The res/ path segment is required
so composer-lock-schema.json's relative "./composer-schema.json" reference
still resolves.
|
|
PHP's SecurityAdvisoryPoolFilter stores advisory *object references* in
$securityRemovedVersions, and PoolOptimizer::applyRemovalsToPool hands
that array to the new Pool by copy-on-write. Porting AnySecurityAdvisory
as a value type turned both of those into deep copies.
Measured on `require laravel/framework` (offline, warm cache): 113
distinct advisories were duplicated into 314,309 copies of ~1.08 KiB,
retaining 331.9 MiB in the filter loop and another 331.9 MiB when
apply_removals_to_pool cloned the whole map.
3.54s -> 2.62s (-26%), peak RSS 975 MB -> 343 MB, which matches the upper
bound measured by ablation. Composer runs the same workload in 1.49s.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
|
Operations are only ever constructed by the dependency resolver, so a
plugin has no way to inject an implementation of its own and the set is
closed. Modelling it as an enum, like AnyPackage, removes the
OperationInterface trait together with its two parallel downcast
mechanisms (as_any() + downcast_ref, and as_*_operation()) and the
get_package() default method that panicked on UpdateOperation.
The PHP idiom `$op instanceof UpdateOperation ? getTargetPackage() :
getPackage()`, written out at six call sites, becomes
AnyOperation::get_target_package(). InstallationManager's three blocks
that matched on the type string and then recovered the type with
expect() collapse into exhaustive matches.
SolverOperation keeps only its TYPE constant; the shared
getOperationType()/__toString() implementations move to AnyOperation,
which also drops the five Self::TYPE.to_string() allocations.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
|
|
is_callable
RequireCommand registers an inline listener on InstallerEvents::PRE_OPERATIONS_EXEC
to track dependency_resolution_completed, mirroring PHP's `function () use
(&$dependencyResolutionCompleted) { ... }`. This is Composer's own code, not a
Plugin subscriber, but it went through the shared non-string-callable path, which
checked is_callable() against a hardcoded PhpMixed::Null and always failed,
breaking every `require` that reaches the install step.
Callable::Closure now carries the actual Rc<dyn Fn> instead of being a data-less
placeholder, and is invoked directly (Closures are always callable in PHP). The
ArrayCallable path used by future Plugin subscribers is untouched.
Un-ignoring the two require_command_test cases that cited this bug reveals two
separate, pre-existing issues (a missing ext-requirement warning message, and a
RefCell re-entrancy panic in ConsoleIO::ask_question); their #[ignore] reasons
are updated to describe the real current blocker instead of the now-fixed one.
|