Skip to content

refactor!: consolidate optional send*/handle* parameters into ContextList - #13

Merged
william-suppo merged 1 commit into
4.xfrom
feat/context-list
Jul 7, 2026
Merged

refactor!: consolidate optional send*/handle* parameters into ContextList#13
william-suppo merged 1 commit into
4.xfrom
feat/context-list

Conversation

@william-suppo

Copy link
Copy Markdown
Contributor

Summary

  • Closes Consolidate optional send*/handle* parameters into a typed ContextList #12. send*/handle* methods on IdentityProviderWrapper and ServiceProviderWrapper had accumulated one optional parameter per protocol detail (relayState, sessionIndex, nameIdPolicyFormat, nameId), plus bool $validate / ?Entity $issuer duplicated across 8 call sites.
  • Introduces Litesaml\Models\Messages\Context\{Context, ContextList} — a marker interface and an immutable, variadic, class-keyed collection (all(), first(), required()) — and collapses every optional parameter into a single trailing ContextList $context = new ContextList().
  • New context value objects: RelayState, SessionIndex, NameIdPolicyFormat, Validate(Entity $issuer).
  • Validate merges the old bool $validate + ?Entity $issuer pair. Since $issuer is a required constructor argument, "validate without an issuer" is no longer representable, so that runtime exception path (and its tests) is removed.
  • NameId and Attribute move from Litesaml\Models\Messages to Litesaml\Models\Messages\Context and now implement Context.

Breaking changes

  • NameId/Attribute namespace change — update use statements.
  • All send*/handle* signatures collapse to (..., ContextList $context = new ContextList()); existing positional/named-argument call sites break.
  • sendLogoutRequest()'s NameId is no longer statically required — a ContextList missing one now throws SamlException at call time (ContextList::required()) instead of failing at the type level.
  • bool $validate / ?Entity $issuer parameters removed in favor of new Validate($issuer).

Test plan

  • composer test (68 tests, 175 assertions)
  • composer phpstan — no errors

…#12)

send*/handle* methods on both wrapper classes had accumulated one
positional/named optional parameter per protocol detail (relayState,
sessionIndex, nameIdPolicyFormat, nameId, plus bool $validate /
?Entity $issuer duplicated across 8 call sites). Replace all of it
with a single ContextList $context parameter: a typed, variadic
collection of Context value objects (RelayState, SessionIndex,
NameIdPolicyFormat, Validate, NameId, Attribute).

Validate(Entity $issuer) merges the old validate/issuer pair; since
$issuer is a required constructor argument, "validate without an
issuer" is no longer representable, so that runtime exception path
is removed along with its tests.

NameId and Attribute move from Litesaml\Models\Messages to
Litesaml\Models\Messages\Context and now implement Context.
sendLogoutRequest()'s NameId is no longer statically required; a
missing one now throws SamlException at call time via
ContextList::required().

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@william-suppo william-suppo changed the title feat!: consolidate optional send*/handle* parameters into ContextList refactor!: consolidate optional send*/handle* parameters into ContextList Jul 7, 2026
@william-suppo
william-suppo merged commit cfb2d96 into 4.x Jul 7, 2026
3 checks passed
@william-suppo
william-suppo deleted the feat/context-list branch July 7, 2026 13:33
william-suppo added a commit that referenced this pull request Jul 7, 2026
…#13)

send*/handle* methods on both wrapper classes had accumulated one
positional/named optional parameter per protocol detail (relayState,
sessionIndex, nameIdPolicyFormat, nameId, plus bool $validate /
?Entity $issuer duplicated across 8 call sites). Replace all of it
with a single ContextList $context parameter: a typed, variadic
collection of Context value objects (RelayState, SessionIndex,
NameIdPolicyFormat, Validate, NameId, Attribute).

Validate(Entity $issuer) merges the old validate/issuer pair; since
$issuer is a required constructor argument, "validate without an
issuer" is no longer representable, so that runtime exception path
is removed along with its tests.

NameId and Attribute move from Litesaml\Models\Messages to
Litesaml\Models\Messages\Context and now implement Context.
sendLogoutRequest()'s NameId is no longer statically required; a
missing one now throws SamlException at call time via
ContextList::required().

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
william-suppo added a commit that referenced this pull request Jul 7, 2026
…List (#13)

send*/handle* methods on both wrapper classes had accumulated one
positional/named optional parameter per protocol detail (relayState,
sessionIndex, nameIdPolicyFormat, nameId, plus bool $validate /
?Entity $issuer duplicated across 8 call sites). Replace all of it
with a single ContextList $context parameter: a typed, variadic
collection of Context value objects (RelayState, SessionIndex,
NameIdPolicyFormat, Validate, NameId, Attribute).

Validate(Entity $issuer) merges the old validate/issuer pair; since
$issuer is a required constructor argument, "validate without an
issuer" is no longer representable, so that runtime exception path
is removed along with its tests.

NameId and Attribute move from Litesaml\Models\Messages to
Litesaml\Models\Messages\Context and now implement Context.
sendLogoutRequest()'s NameId is no longer statically required; a
missing one now throws SamlException at call time via
ContextList::required().

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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.

Consolidate optional send*/handle* parameters into a typed ContextList

1 participant