| Age | Commit message (Collapse) | Author |
|
proc_open/proc_close/proc_get_status/proc_terminate represented the
process handle as a PhpMixed, which cannot hold a live child process or
its pipes, so they were stubs or todo!(). Model the handle as a new
PhpResource::Process variant and child pipes as a StreamBacking::Pipe,
with a native Descriptor enum for descriptorspec; proc_open now returns
io::Result and fills pipes as IndexMap<i64, PhpResource>.
Rewire the Symfony Process pipes and the Console terminal/cursor onto
the new types, removing the "PhpMixed cannot carry a PhpResource"
todo!()s. The remaining todo!()s are genuine syscall leaves
(proc_terminate signal delivery, stream_select, stream_set_blocking,
posix_kill, pty, fd>=3) left unimplemented since no syscall crate is
introduced.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
ComposerMirror is part of Composer itself (Util/ComposerMirror.php),
not an external package, so its stub belongs in the shirabe crate's
util module rather than shirabe-external-packages.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
composer::semver stubs
Flatten shirabe-semver's modules into glob re-exports at the crate
root and route all consumers through the short paths. Remove the
duplicate composer::semver stubs from shirabe-external-packages in
favor of the shirabe-semver types.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Move MetadataMinifier and SpdxLicenses out of shirabe-external-packages
into dedicated shirabe-metadata-minifier and shirabe-spdx-licenses
crates, updating all import sites accordingly.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Port composer/tests/Composer/Test/Mock/IOMock.php as a BufferIO-backed
mock with expects()/assert_complete(), authentication logging, and a Drop
guard mirroring TestCase::getIOMock + tearDown. This is the infrastructure
many IO-consuming tests need; wiring existing #[ignore] tests onto it is a
follow-up, gated on making BufferIO::get_output's look-behind regex
regex-crate compatible.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Wire StreamOutput into BufferIO::new, retrieve the stream in get_output
via downcast, and set the user input stream in set_user_inputs.
Add as_streamable_mut to InputInterface (and ArgvInput) for mutable
streamable access, and make StringInput implement StreamableInputInterface
to match PHP, where StringInput is streamable via its Input ancestor.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Introduce a QuestionInterface trait that the base Question and all its
subclasses (ChoiceQuestion, ConfirmationQuestion, StrictConfirmationQuestion)
implement, with as_choice/as_confirmation downcasts standing in for PHP's
instanceof. Consumers (QuestionHelper, SymfonyQuestionHelper, SymfonyStyle,
ConsoleIO) now take a QuestionInterface boundary generically.
This fixes the instanceof emulation, which previously went through
as_any().downcast_ref on a concrete &Question and always returned None, and
unblocks the select/confirm/choice paths that were left as todo!() because a
polymorphic ChoiceQuestion/ConfirmationQuestion could not be passed to ask.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Port the pure-method cases (parse/namespace/formatAuthors/git/vendor-ignore)
and build the ApplicationTester / initTempComposer harness the run cases need.
Supporting production changes:
- carry the streamable input stream as PhpResource (not PhpMixed) and add
InputInterface::as_streamable so QuestionHelper reads the injected stream
- add StreamOutput/ConsoleOutput __set_stream test helpers and
ApplicationHandle::set_catch_exceptions for the tester
- implement the interact() author validator via parse_author_string
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Replace the dynamic, string-keyed HelperSet (set/has/get/get_iterator,
HelperSetKey, deprecated set_command/get_command) with a closed set of
FormatterHelper, DebugFormatterHelper, ProcessHelper and QuestionHelper
instantiated by an argument-less constructor and exposed through typed
getters (get_formatter/get_debug_formatter/get_process/get_question).
The typed getters let ProcessHelper, QuestionHelper::write_error and
InitCommand::interact drop their downcast/placeholder todo!() stubs.
Dynamic registration of plugin-provided helpers is intentionally dropped
for now and tracked via TODO(plugin) comments.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
Every ConsoleIO construction site only ever registers a single QuestionHelper
(production) or none (tests), and routing asks through HelperSet::get('question')
loses the concrete type, forcing a downcast back to QuestionHelper. Receive the
QuestionHelper in the constructor and hold it directly (in a RefCell, since
QuestionHelper::ask takes &mut self while the IOInterfaceImmutable ask methods are
&self), dropping the HelperSet field and the throwaway HelperSet built at each
call site.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
Replace the hand-rolled `SERIAL` mutex guarding process-global env access
with serial_test's `#[serial]` attribute on each test.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
Script\Event extends BaseEvent in PHP, so setOriginatingEvent accepts
both a base event and a nested Script\Event, and calculateOriginatingEvent
walks the chain via an instanceof check. The port had pinned the field to a
concrete Option<Box<BaseEvent>>, leaving calculate_originating_event as
todo!() and the nested-event test unportable.
Introduce an OriginatingEvent enum (Base/Script) to model the instanceof
tag, implement the recursive flattening, and un-ignore both originating
event tests.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
solve() previously dropped the SolverProblemsException and returned a
placeholder anyhow error, because its Rc<RefCell<Rule>> payload is not
Send+Sync and cannot ride anyhow::Error. Return
anyhow::Result<Result<LockTransaction, SolverProblemsException>> instead,
keeping fatal errors on the outer Result and the recoverable exception on
the inner one.
This lets the three Installer callsites port their PHP catch handlers
faithfully (pretty-string output, GithubActionError emit, getCode-based
exit codes) and lets solver_test.rs assert getProblems/getCode/
getPrettyString. The four ported assertion tests stay ignored: their
pretty-string path still reaches unimplemented todo!()s downstream.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Re-evaluate the reason'd #[ignore] tests under the Phase D criterion:
a test is unportable ONLY if the APIs/types needed to WRITE it do not
exist. A test that compiles but panics at runtime (todo!() body, a
regex the regex crate cannot compile) or fails at runtime (incomplete
or incorrect impl behavior) is portable -- it is written in full and
marked with a reason-less #[ignore].
About 120 test functions move from reason'd #[ignore] to reason-less
#[ignore] (the ported-but-not-yet-passing signal). Impl crates gain
only additive __ test hatches (init_command, pool, file_downloader,
package handle link setters, artifact/path repository, repository
manager, svn); no existing logic changes. Tests whose required APIs
genuinely do not exist (mock/reflection harness, ApplicationTester,
solve() discarding SolverProblemsException, a script::Event that
cannot be passed as an originating event) keep their reason'd
#[ignore].
cargo check -p shirabe --tests passes.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Redesign PhpResource into a real stream handle (File/Memory backing with
tracked position, eof, closed state) and unify the whole fopen family
(fopen/fwrite/fread/fgets/fgetc/feof/fclose/ftell/fseek/rewind/fstat/
ftruncate/fflush and stream_get_contents/stream_copy_to_stream) on
&PhpResource, replacing the split PhpMixed/PhpResource APIs and their
todo!() stubs. fopen now returns Result; read functions stay String for
now (TODO(phase-e) to move to byte strings).
Propagate the signatures through callers: Process stdout/stderr, Cursor
input, curl header/body handles (extracted into typed maps keyed by job
id), Filesystem copy/safe_copy/files_are_equal, BufferIO, error_handler,
platform, perforce, zip. The proc_open pipe paths cannot carry a
PhpResource in a PhpMixed list, so they are left as todo!() with notes.
|
|
JsonFile's schema paths previously relied on php_dir() (__DIR__), which has
no runtime equivalent. Add a build.rs that copies composer-schema.json and
composer-lock-schema.json next to the built executable, and resolve them with
std::env::current_exe(). FilesystemRepository now embeds InstalledVersions.php
directly via include_str! instead of reading it through php_dir().
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Collapse the dual Application API (static methods taking
`&Rc<RefCell<Application>>` plus `&mut self` bridges via `shared()`) into a
single handle type `ApplicationHandle(Rc<RefCell<Application>>)`, mirroring the
Composer handle pattern.
Methods that invoke command callbacks (add, run, do_run, base_run, base_do_run,
do_run_command, add_commands, init) move to `impl ApplicationHandle` with
short-scoped borrows; data-only methods and `impl BaseApplication` stay on
`Application`. `shared()` now returns the handle, and `new_shared`/`init_shared`
fold into `ApplicationHandle::new`/`init`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Composer never uses Symfony's command loader, so LazyCommand is never
instantiated on any Composer execution path. Remove the stub port and
the instanceof branches that guarded against it.
|
|
Replace the DOMDocument/DOMNode placeholders and all todo!() bodies with a
faithful port backed by the shirabe-php-shim DOM types, so the XML descriptor
builds real documents and serializes them through save_xml.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Implements a minimal, PHP-compatible subset of \DOMDocument, \DOMNode and
\DOMNodeList for use by Symfony's XmlDescriptor. save_xml mirrors libxml2's
formatOutput serialization (XML declaration, 2-space indent, self-closing
empty elements, and no pretty-printing of text-bearing elements) and writes
to a std::io::Write sink. Verified byte-for-byte against real PHP libxml.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Remove #[ignore] from tests gated solely on a shim function that is now
implemented, where the test passes:
- metapackage_installer::test_update (version_compare)
- platform_requirement_filter_factory::test_from_bool_throws... (get_debug_type)
- runtime::test_parse_extension_info (html_entity_decode/strip_tags)
- package_sorter::test_sorting_does_nothing... (strnatcasecmp)
- no_proxy_pattern::test_host_name/test_port (unpack/substr_count)
- version_parser::test_is_upgrade (version_compare)
- pool::test_what_provides_package_with_constraint
- proxy_item::test_throws_on_malformed_url
Update the ignore reason where the cited shim is now implemented but the
test still cannot pass for a different reason:
- no_proxy_pattern::test_ip_address/test_ip_range (IPv4-mapped IPv6 gap)
- package_sorter::test_sorting_orders... (look-around regex)
- proxy_item::test_url_formatting (parse_url host discrepancy)
- json_manipulator/json_config_source/filesystem_repository stubs
(test bodies are still todo!(), not yet ported)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Give RecursiveDirectoryIterator/RecursiveIteratorIterator real backing
data: the iterator walks the tree in SELF_FIRST/CHILD_FIRST order, yields
SplFileInfo-like entries (is_dir/is_file/is_link/get_pathname/get_size),
and a Cell cursor lets get_sub_pathname() report the current entry.
Implement the std-backed file helpers: lstat, mkdir (umask-aware via
DirBuilder), symlink, chmod, fileperms, fileowner, is_executable,
unlink_silent, touch (create-if-absent), file()/file_put_contents3/
file_get_contents5, tempnam, umask (via /proc/self/status), and a glob()
supporting *, ?, [...] and {..} brace expansion.
The PhpMixed-keyed fopen stream family, disk_free_space, touch with an
explicit time, opendir and DirectoryIterator remain TODO(phase-d): they
need a PhpMixed stream representation or syscalls std does not expose.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Port php_version_compare (canonicalization + special-form ordering) and
expose it via version_compare()/version_compare_2(). Implement clone()
(via Clone), spl_object_hash()/spl_object_hash_process() (address-based),
get_loaded_extensions() and the main-version case of phpversion().
Interpreter/reflection/autoload/eval/$GLOBALS/memory-accounting and
Windows-only SAPI helpers remain TODO(phase-d): they have no equivalent
in the compiled shim.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Implement the bulk of string.rs shims:
- sprintf() with flags/width/precision/positional args for the common
conversions (s/d/u/b/o/x/X/c/f/F)
- pack()/unpack() for the C/c/n/v/N/V (+ s/S/i/I unpack) format codes
- base64_encode()/base64_decode() (non-strict)
- substr_replace, str_bitand, chr, hexdec, stripcslashes, addcslashes,
number_format (round-half-away-from-zero), uniqid, strip_tags,
html_entity_decode, iconv (UTF-8/ASCII identity)
%e/%E/%g/%G, wordwrap, sscanf, php_strip_whitespace and non-UTF-8 iconv
remain TODO(phase-d) (exact float-exponent/tokenizer/encoding-table
behavior not yet ported). Divergences in ported functions are noted with
TODO(phase-d) comments.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Run exec()/shell_exec()/system() through /bin/sh -c with PHP-faithful
line handling and return values. Port escapeshellcmd() (Unix branch,
including paired-quote handling) and escapeshellarg(). Implement
posix_isatty() via std::io::IsTerminal.
uid/signal/process-title helpers and proc_open-dependent status calls
remain TODO(phase-d): they need a libc/syscall crate or the deferred
process/signal subsystems.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Implement var.rs shims: serialize() (scalars/arrays with canonical
integer-key normalization), var_export()/var_export_str() (PHP-faithful
indentation and quoting), to_array() ((array) cast semantics),
get_debug_type() and is_iterable() for the scalar/array cases.
Reflection-dependent helpers (is_a, is_callable, get_class, instance_of,
etc.) and object variants remain TODO(phase-d) as they need runtime
class information PhpMixed does not carry.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
These slice/map wrappers mirrored PHP's internal array pointer and
have no clean Rust equivalent. Remove them and replace the lone
caller with direct first-element access; the rest were unused imports.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
PHP's internal array pointer (current/key/end) has no clean Rust
equivalent. Remove these todo!() shim stubs and replace each call
site with direct first/last element access matching Composer's
original behavior. Unblocks Config::merge of anonymous {name: false}
disable entries, re-enabling test_add_packagist_repository.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Implement array_unique, array_splice, array_merge_recursive, krsort,
ksort, asort, sort_with_flags and sort_natural_flag_case, plus the
strnatcmp/strnatcasecmp port they rely on. Drop array_key_last and
array_splice_mixed in favour of existing helpers at the call sites.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
|
|
Drop the get_as_float parameter; the Rust shim always returns f64.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Support md5, sha1, sha256, and xxh3 algorithms.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
|
|
ArrayObject was only a thin wrapper around IndexMap<String, PhpMixed>
used as an empty-{} vs empty-[] marker and as the assoc=false JSON
object representation; no reference semantics were involved. Inline its
payload directly into PhpMixed::Object and drop the type along with the
now-dead StdClass.
Side effects of the unification:
- ArrayObject::new was todo!(); the config --global / object-typed get
paths that built PhpMixed::Object(ArrayObject::new(None)) no longer
panic.
- base_config_command wrote 'config' as PhpMixed::Array(empty), emitting
[] instead of {}; now matches PHP's new \ArrayObject ({}).
- The dead is::<StdClass>()/is::<ArrayObject>() instanceof checks in
JsonManipulator are replaced with the faithful as_object() mapping.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
|
|
Replace the todo!() bodies of filter_var_email, filter_var_ip, and
filter_var_int_with_range with working validators. Like filter_var_url
these are pragmatic rather than byte-for-byte compatible with PHP's
hand-written filters; the divergences are noted in comments.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Replace the dispatch-on-constant filter_var() and filter_var_with_options()
with dedicated filter_var_boolean/url/email/ip and filter_var_int_with_range,
dropping the FILTER_VALIDATE_* constants and updating all call sites.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
apcu_fetch/apcu_add only ran when apcuPrefix was non-null, but
Composer never calls setApcuPrefix on the loaders it instantiates
itself; the prefix is only emitted into the generated target-project
autoload_real.php. So the cache branches were unreachable in Shirabe's
execution paths. Remove the apcu shim and the now-dead lookups.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
json_encode/json_encode_ex now return anyhow::Result<String> instead of
Option, so callers no longer need json_last_error() to get the failure
reason.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
|
|
The per-file stub!/encode_stub!/etc. macros generated #[ignore]d test
functions but obscured the individual test bodies. Expanding them inline
removes the macro indirection so future ports can fill in each function
directly.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Fill in the shim functions that have an easy, accurate pure-Rust port:
array (merge/flip/fill_keys/slice/search/is_list), string (substr_count,
strpbrk, raw/urlencode, ucfirst/ucwords, strstr, strcspn, explode limit,
str_replace arrays), mb_* (strlen/substr/str_split), sort callbacks
(uasort/uasort_map/uksort), levenshtein, intdiv, ceil, ctype_digit,
json_encode, count_mixed and the PhpMixed/to_* boolean casts.
Runtime- or crate-dependent and hard-to-port-accurately stubs (sprintf,
version_compare, natural sort, hashing, etc.) are left as todo!().
|
|
Port PHP setUp/tearDown across the ported integration tests using
same-named set_up()/tear_down() functions and a TearDown struct whose
Drop runs tear_down(). Fixture-init setUp returns its fixtures;
tmpdir-style setUp/tearDown carry state in TearDown fields. Parts that
depend on unported infrastructure (PHPUnit mocks, Config::merge, the PHP
error handler) stay todo!() and are only wired into ignored stubs to
avoid breaking live tests.
Also fix shirabe-php-shim putenv to handle the no-'=' form (PHP unsets
the variable), which Platform::clear_env relies on for the env-clearing
tearDowns.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
All ignored: Composer/Filesystem/Platform/Vcs repositories and the
AuthHelper/Bitbucket/Git/Perforce/RemoteFilesystem/Svn utils mock
IO/Config/HttpDownloader(curl)/ProcessExecutor or use reflection;
Filesystem/ProcessExecutor/StreamContextFactory/ProxyManager need on-disk
fixtures or proxy env. setUp/tearDown not ported.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
All ignored: ArrayLoader/ValidatingArrayLoader/VersionSelector parse
constraints via a look-around regex; ArchiveManager uses PharData (todo!());
ArchivableFilesFinder/VersionGuesser/Locker mock git/process/IO; the plugin API
is not implemented (TODO(plugin)). Wires up the plugin test target.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|