Skip to content

Make resolve() variadic-aware and add ParameterResolver interface#30

Merged
alganet merged 1 commit into
mainfrom
resolve-variadics-and-interface
Jun 25, 2026
Merged

Make resolve() variadic-aware and add ParameterResolver interface#30
alganet merged 1 commit into
mainfrom
resolve-variadics-and-interface

Conversation

@alganet

@alganet alganet commented Jun 25, 2026

Copy link
Copy Markdown
Member

resolve() now returns an ordered, ready-to-splat list (in parameter order) instead of a name-keyed array, and expands a trailing variadic parameter into all remaining positional arguments. It also accepts named arguments directly (keyed by parameter name, taking precedence over the container), so a single algorithm handles positional, named, and variadic resolution.

Add a ParameterResolver interface exposing just resolve(), so consumers can depend on the contract rather than the concrete Resolver. Resolver implements it.

Deprecate resolveNamed() as a thin alias of resolve(); update the README for the new return shape, precedence, variadics, and interface.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the parameter resolution API to return an ordered, “ready-to-splat” argument list (instead of a name-keyed array), adds support for expanding trailing variadic parameters, and introduces a ParameterResolver interface so consumers can depend on the contract rather than the concrete Resolver.

Changes:

  • Changed Resolver::resolve() to accept mixed positional/named inputs and return an ordered list<mixed> suitable for ...$args / newInstanceArgs().
  • Added ParameterResolver interface and made Resolver implement it; deprecated resolveNamed() as an alias of resolve().
  • Updated tests and README to reflect the new return shape, precedence rules, and variadic behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Resolver.php Reworks resolution algorithm to produce ordered arguments and expand variadics; keeps resolveNamed() as deprecated alias.
src/ParameterResolver.php Introduces the ParameterResolver interface exposing resolve().
tests/unit/ResolverTest.php Updates expectations for ordered return shape; adds coverage for variadics and interface implementation.
tests/fixtures/VariadicConsumer.php Adds a variadic constructor fixture to exercise variadic argument expansion.
README.md Documents new resolution precedence, ordered return list, variadic behavior, and interface usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Resolver.php
Comment thread tests/unit/ResolverTest.php
resolve() now returns an ordered, ready-to-splat list (in parameter order)
instead of a name-keyed array, and expands a trailing variadic parameter into
all remaining positional arguments. It also accepts named arguments directly
(keyed by parameter name, taking precedence over the container), so a single
algorithm handles positional, named, and variadic resolution.

Add a ParameterResolver interface exposing just resolve(), so consumers can
depend on the contract rather than the concrete Resolver. Resolver implements
it.

Deprecate resolveNamed() as a thin alias of resolve(); update the README for
the new return shape, precedence, variadics, and interface.
@alganet alganet force-pushed the resolve-variadics-and-interface branch from 4555624 to cc53d0a Compare June 25, 2026 10:49
@alganet alganet merged commit e8b5025 into main Jun 25, 2026
4 checks passed
@alganet alganet deleted the resolve-variadics-and-interface branch June 25, 2026 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants