| Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
Document the conventions for porting PCRE patterns to the regex crate
(no PCRE crate, panic on compile failure, dropping performance-only
possessive quantifiers, ad-hoc compatibility comments). Apply the rule
to Platform::expand_path by rewriting its conditional subpattern as an
explicit alternation, which the regex crate can compile.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
|
|
|
|
The optional matches output was always passed Some(&mut ...) at every
call site, so the Option wrapper added no value. Take &mut directly and
inline the former internal helpers.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
preg_match2 returns bool and the preg_match_all* helpers return usize
(the match count is never negative), matching how callers use them.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
preg_match can only return 1 or 0 now that compile failure panics, so
return bool and update all call sites accordingly.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
The preg_* shim helpers wrapped their results in Option/Result solely to
signal a regex that failed to compile. Composer never feeds a pattern
that fails at runtime, so such a failure is a programming error: panic
instead and drop the Option/Result wrappers, updating all callers.
preg_replace_callback keeps its Result return type since the callback
itself is fallible. preg_match_groups is removed in favor of preg_match
at its sole call site.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
The preg.rs shim had several near-duplicate functions: simple helpers
re-implementing logic already covered by their full-featured `2`
variants. Delegate or remove the redundant ones while preserving
behavior, and migrate the affected callers:
- preg_replace / preg_split now delegate to preg_replace2 / preg_split2
- preg_match_all_simple removed; its caller uses preg_match_all
- preg_split_chars removed; its caller uses a char-boundary iterator
- preg_match_offset removed; its callers use preg_match2 directly
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
The free preg_* functions, the CaptureKey type, and the PREG_* constants
move from the pcre crate into shirabe-php-shim, where the rest of the
PHP standard-library shims live. Colliding names take a 2 suffix
(preg_match2, preg_split2, etc.) since the shim already exposes
differently-shaped variants. Preg keeps its public API and delegates to
the relocated functions; CaptureKey is re-exported from composer::pcre
so consumers are unaffected.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
The Preg methods panic on PCRE failure (per the file header rationale),
so their anyhow::Result wrappers never carried an Err.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
Replace the todo!() stubs backing the Preg class and the standalone
preg_* shim helpers with regex-crate implementations.
|
|
Composer never feeds a pattern that fails to compile at runtime, so a
preg_*() failure is a programming error rather than a recoverable
condition. Replace the PcreException path with a panic.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
Rust's type system already distinguishes participating from
non-participating capture groups via Option, so the *StrictGroups
methods add no safety here. Remove them and switch callers to the
plain variants.
|
|
Drop the default-argument variants and offset-capture helpers that have
no caller on the Rust side, along with the constants and free functions
they were the sole users of.
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>
|
|
|
|
Replace the todo!() stub with the real Symfony logic: clone the input,
bind it against the application definition (ignoring binding errors), and
read the first argument so the command name is detected even when global
options precede it.
Add a dup() method to InputInterface to model PHP's clone, derive Clone on
the input types, and treat InvalidArgument/InvalidOption/MissingInput as
ignorable ExceptionInterface errors during the pre-binding probe.
|
|
Composer\Console\Application embedded Symfony's Application as an
`inner` field and delegated to it, so polymorphic calls inside the
Symfony base (e.g. doRun -> $this->getLongVersion()) resolved to
Symfony's own methods and never reached Composer's overrides. As a
result `--version` bypassed Composer's getLongVersion()/doRun()
entirely.
Flatten the PHP inheritance chain into the single shirabe Application
struct: take in the Symfony base methods (parent-calling overrides kept
under a `base_` prefix) and drop the `inner` delegation. Replace the
Symfony Application struct in shirabe-external-packages with an
`Application` trait that the merged struct implements, so commands and
descriptors can reference it without a reverse crate dependency.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Convert every sprintf() call with a compile-time literal format string to
format!, implementing Display for PhpMixed (delegating to php_to_string) so
PhpMixed values render with PHP string semantics through {}. Also merge the
format!-wrapped and conditional-literal dynamic sites into single format!
calls. Genuinely runtime format strings (table styles, configurable error
messages, command synopsis, progress-bar modifiers, regex-built messages)
still go through sprintf.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Replace todo!() stubs reached on the `composer --version` path so the
command runs without panicking and exits cleanly:
- introspection (function_exists, class_exists, extension_loaded,
defined) via white-lists modeling a standard Linux PHP CLI
- type casts: php_to_string/strval, php_truthy/boolval, substr,
byte_at, explode, strtr_array
- config/env: error_reporting, ini_get, date_default_timezone_*,
server_get/server_contains_key, php_uname("s")
- IO: turn PhpResource into an enum (Stdin/Stdout/Stderr/File) and
implement fwrite/fflush/stream_isatty/php_fopen resource helpers
- shutdown/exit: register_shutdown_function + run_shutdown_functions,
exit, error_get_last
- preg_match_all_offset_capture via the regex crate; the formatter
pattern drops PCRE possessive quantifiers (original kept in a
comment with a TODO)
proc_open reports unavailable for now (TODO(phase-c)); terminal-size
and tty detection fall back to defaults. sprintf calls on this path
are rewritten with format!(). OutputFormatterStyleInterface gains
clone_box to return shared styles.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
The Compiler.php is PHP-tooling only (bin/compile) with no Rust
equivalent, so it is not ported. Remove the compiler module along with
the symbols used solely by it.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
Wire up ConsoleIO with HelperSet/QuestionHelper, register the
ErrorHandler with the IO instance, and fall back to a default output
in run(). Replace resolved phase-b TODOs across the console, command,
io, factory, installer, dependency_resolver, and util modules; reclassify
the remaining blockers (typed Symfony command registry, stdin resource
caching) as phase-c.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
* Catch specific exception types instead of broad/placeholder handling.
* Drop the shim Countable trait.
|
|
Port Config::process() to the real Preg::replace_callback, whose closure
borrows &self/flags and calls get_with_flags; surface get() errors via a
captured cell so process now returns Result. Switch the replace_callback
shim bounds to FnMut to allow the error-capturing closure.
Wire CreateProjectCommand suggestion collection through the
Rc<RefCell> reporter's interior mutation.
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>
|
|
Implement MetadataMinifier::expand with the PHP list-of-arrays signature
(Vec<IndexMap>) and wire it into ComposerRepository so composer/2.0
minified package metadata is expanded, resolving the phase-b TODO.
minify() is left unported as it is not used in Composer itself.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Convert InputInterface and OutputInterface parameters from &dyn/&mut dyn
references to Rc<RefCell<dyn ...>> shared ownership across the command,
console, and IO layers, matching the Phase C shared-ownership approach
already used for IOInterface.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Migrate ArchivableFilesFinder off Symfony's SplFileInfo onto Path/PathBuf,
resolving the phar_archiver TODO(phase-b) that required a .map() adapter to
bridge SplFileInfo -> PathBuf.
- ArchivableFilesFinder now yields PathBuf; accept() takes &Path; the exclude
closure receives &Path and uses Path::canonicalize / is_symlink. The
SplFileInfo -> PathBuf conversion happens once at the symfony get_iterator
boundary (get_iterator stays SplFileInfo for cache.rs).
- symfony Finder::filter callback changed to FnMut(&Path) (sole caller is the
finder).
- PharArchiver passes the finder straight into ArchivableFilesFilter, mirroring
PHP's new ArchivableFilesFilter($files).
- ZipArchiver consumes PathBuf items, computing the relative path via
strip_prefix(sources) in place of SplFileInfo::getRelativePathname.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
- Add Display for SplFileInfo (PHP (string) cast -> getPathname) and use it
in clean_backups instead of a debug-format placeholder.
- Generalize iterator_to_array's signature to preserve the element type so
get_last_backup_version collects real SplFileInfo and returns the last
basename, instead of mapping every entry to PhpMixed::Null.
- Drop the stale builder-restructure TODO in get_old_installation_finder.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
Add a Finder::filter(Box<dyn FnMut(&SplFileInfo) -> bool>) stub method and
route the exclude closure through it, matching PHP's ->in()->filter() chain.
FnMut faithfully represents PHP's stateful \Closure.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
Resolve TODO(phase-b): mirror PHP's parent::__construct(true, $styles)
by extending the base OutputFormatter::new to accept a style map.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
Replace the Phase B stub that discarded ParsingException details with a
dedicated ParsingExceptionDetails struct (text/token/line/loc/expected),
modeling the PHP string|int token union as a ParsingExceptionToken enum.
Wire JsonFile::validate_syntax to forward the source details and let
Application read the error line from the typed accessor.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Introduce the cross-cutting downcast base for PHP `instanceof` checks on
io/output trait objects: `IOInterface::as_any` (ConsoleIO/NullIO/BufferIO)
and `OutputInterface::as_console_output_interface` (promoting ConsoleOutput
to a proper ConsoleOutputInterface). Wire the resolved downcasts in
ConsoleIO error output, Auditor table format, and the event dispatcher.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
|
Replace the dyn ConstraintInterface trait objects with an AnyConstraint
enum closing over its four implementors (Simple, Multi, MatchAll,
MatchNone), mirroring the earlier Rule enum conversion. Rename
constraint.rs to simple_constraint.rs to match the renamed Constraint
type.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
|
|
|
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
Symfony Command was a struct but used as dyn Trait (Box<dyn Command>)
in console/application.rs. Convert it to a trait with CommandBase as
the concrete stub, and add impl Command for all Composer commands.
|
|
|
|
class-map-generator compile errors
- Add CaptureKey enum to Preg stub for typed capture access (by index or name)
- Expand Preg stub with complete method set matching the PHP Composer\Pcre\Preg API
- Update class-map-generator, php-file-cleaner, and php-file-parser to use new API
- Add Display impls for exception types in shirabe-php-shim
- Add follow_links/exclude stubs to Finder and new/get_pathname stubs to SplFileInfo
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
|
|
|