| Age | Commit message (Collapse) | Author |
|
Add a minimal shirabe-php-rpc crate that spawns the system PHP as a
child process and asks it for runtime information over a Unix domain
socket, then use it to fill the `--version` PHP line with the real
\PHP_VERSION and \PHP_BINARY instead of fixed placeholder values.
See docs/dev/php-rpc.md for the design and scope.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Add a no_banned_use linter that forbids importing anyhow::Result, and
update all call sites to reference it via its fully-qualified path so
it is never confused with std::result::Result.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
|
|
Add __base_application accessor on ApplicationHandle so the test can
build an ApplicationDescription the way console commands do.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Composer/PartialComposer exposed its RepositoryManager, InstallationManager,
EventDispatcher, Locker, DownloadManager, AutoloadGenerator and ArchiveManager
as concrete types, but Composer's public setters (setDownloadManager() etc.)
let plugins swap in subclasses. Introduce a *Interface trait per manager and
store each as Rc<RefCell<dyn ...Interface>> so a replacement is honored.
Only Composer's slots and the sinks fed from its accessors become trait
objects; managers injected concretely at construction keep their concrete
references, matching PHP semantics. Fluent setters on the affected classes now
return () and Locker::update_hash is de-generified to a boxed FnOnce so the
traits stay object-safe.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
The compiler confirms none of the call sites invoke a &mut self method
on the returned Composer, so the exclusive RefMut borrow was never
needed and only risked borrow check conflict. Switch every site to the
shared composer_full borrow and drop the now-dead composer_full_mut
helper.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
|
|
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Rework the environment shim around getenv/putenv on the real environment
and $_ENV/$_SERVER as startup snapshots, all over OsString. Migrate every
caller off the old server()/server_argv() helpers and force the snapshots
in main() before any putenv() runs. Document the porting rules in
docs/dev/env-vars-porting.md.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
|
|
The Command trait and Composer's BaseCommand took &mut self, so dispatch
held a borrow_mut on the command's RefCell for the whole call. A command
re-entering itself (e.g. the help command describing itself) then panicked
with "RefCell already borrowed".
All Command/BaseCommand methods now take &self and the command state is
interior-mutable (Cell/RefCell). Shared borrows coexist, so re-entrant
describe paths no longer conflict. Getters that returned references now
return Ref guards; the descriptor describe_* methods take &dyn Command;
mixin accessors return Ref/RefMut.
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>
|
|
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.
|
|
Drop the get_as_float parameter; the Rust shim always returns f64.
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>
|
|
The execute() proxy was left as todo!(); wire it to the shared
Application handle so `outdated` re-enters the run flow as `show -l`,
matching PHP's $this->getApplication()->run(). Add Application::shared()
to expose the new_shared self-reference and un-ignore run_outdated.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Port Symfony's Application::doRenderThrowable so command failures render
the error box instead of hitting todo!(). This unblocks six CLI no-panic
tests (config, depends, global, prohibits, remove, repository), whose
ignore attributes are now removed.
Also fill in the php-shim functions on the render path that were still
todo!(): php_exception_get_code, intval, str_pad, str_split,
mb_detect_encoding, mb_convert_encoding, mb_strwidth, mb_convert_variables.
PHP file/line and the verbose getTrace() block have no faithful Rust
equivalent; file/line use PHP's own 'n/a' fallback and the trace block is
intentionally omitted.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
The List and Array variants of PhpMixed boxed their elements
unnecessarily. Store PhpMixed values directly and update all callers
accordingly.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Composer's Application::getComposer() calls exit(1) when a required
Composer instance fails to build under areExceptionsCaught(). Replace the
deep std::process::exit with a php-shim ExitException that mirrors PHP's
`exit` construct: it bypasses parent::doRun()'s catch and Symfony's
renderThrowable (excluded at both broad catches), so the already-written
plain error message is not re-rendered and the process exits with code 1.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
|
|
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>
|
|
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 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>
|
|
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>
|
|
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>
|
|
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>
|
|
Resolve category F phase-b TODOs (class-string, instanceof, get_class,
method_exists, __FILE__, Reflection API, downcast).
- VcsRepository: dispatch drivers through a VcsDriverKind enum
(instantiate/supports/php_class_name) and add constructors to the
concrete VCS drivers
- repository downcasts via RepositoryInterfaceHandle::downcast_rc and
as_any (init/show commands, vcs ValidatingArrayLoader)
- BaseCommand::is_self_update_command override replaces an instanceof
- Factory::create narrows PartialComposer to ComposerHandle via as_full
- InstalledVersions gains set_self_dir/set_installed_is_local_dir,
replacing Reflection-based static property mutation
- ClassLoader::as_array_iter ports the PHP (array) cast
- drop the unnecessary __FILE__ phar branch in self-update
application get_class(command) reclassified TODO(plugin); buffer_io
StreamableInputInterface downcast and the ValidatingArrayLoader trait
redesign left as tracked TODOs.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
PHP mutator methods that the Phase B port could not call because only
&self / &dyn / Rc access was available. Resolved by the interior-mutation
APIs that already exist: handle &self setters (set_dist/source_reference,
set_requires/dev/references/stability_flags), Rc<RefCell<dyn InputInterface>>
.borrow_mut(), and get_installation_manager().borrow_mut() (build_package_map
passes an empty/canonical package list per upstream). composer.get_package()
returns &RootPackageInterfaceHandle, so the "&dyn" Phase B note was wrong.
factory's set_config_source/set_auth_config_source were already live code;
their stale TODOs are removed.
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>
|
|
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>
|
|
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
|
PHP packages have reference semantics, so introduce shared-ownership
handles over an AnyPackage enum (PackageInterfaceHandle and friends)
and replace Box<dyn PackageInterface> throughout.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
|
Model PHP's `Composer extends PartialComposer` as a PartialOrFullComposer
enum and merge partial_composer.rs into composer.rs. Introduce
ComposerHandle / PartialComposerHandle (plus their Weak variants) so the
graph can be shared, and build it at once with Rc::new_cyclic in the
factory to resolve the back-reference cycles.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|