Skip to content

refactor: make PublicKeyCredentialSource extend CredentialRecord#804

Merged
Spomky merged 1 commit into5.3.xfrom
feature/pkcs-extends-credential-record
Feb 3, 2026
Merged

refactor: make PublicKeyCredentialSource extend CredentialRecord#804
Spomky merged 1 commit into5.3.xfrom
feature/pkcs-extends-credential-record

Conversation

@Spomky
Copy link
Copy Markdown
Contributor

@Spomky Spomky commented Jan 23, 2026

Summary

This PR improves backward compatibility by making PublicKeyCredentialSource extend CredentialRecord instead of using union types throughout the codebase.

Key changes:

  • PublicKeyCredentialSource is now an empty class extending CredentialRecord (still deprecated)
  • Repository interfaces use CredentialRecord instead of union types (CredentialRecord|PublicKeyCredentialSource)
  • Deprecated interfaces (PublicKeyCredentialSourceRepositoryInterface, CanSaveCredentialSource) now extend their new counterparts
  • All ceremony steps and validators updated to use CredentialRecord only
  • CredentialRecordConverter utility updated to handle inheritance

Motivation

This resolves the concern raised in discussion #803 by @jasonvarga. With this change, downstream packages can simply type-hint CredentialRecord and it will automatically accept both CredentialRecord and PublicKeyCredentialSource instances thanks to inheritance.

Before: Code needed union types CredentialRecord|PublicKeyCredentialSource to support both types.

After: Code can use CredentialRecord and PHP's inheritance handles the rest.

Test plan

  • All 265 PHPUnit tests pass
  • PHPStan analysis passes
  • ECS coding standards pass
  • Rector checks pass

This change improves backward compatibility by using inheritance instead
of union types. PublicKeyCredentialSource now extends CredentialRecord,
allowing code that type-hints CredentialRecord to automatically accept
both types.

Key changes:
- PublicKeyCredentialSource is now an empty class extending CredentialRecord
- Repository interfaces use CredentialRecord instead of union types
- Deprecated interfaces (PublicKeyCredentialSourceRepositoryInterface,
  CanSaveCredentialSource) now extend their new counterparts
- All ceremony steps and validators updated to use CredentialRecord only
- CredentialRecordConverter utility updated to handle inheritance

This resolves the concern raised in discussion #803 where downstream
packages needed union types to support both v5.2 and v5.3.
@Spomky Spomky self-assigned this Jan 23, 2026
@Spomky Spomky added enhancement New feature or request DX Developer Experience labels Jan 23, 2026
@Spomky Spomky added this to the 5.3.0 milestone Jan 23, 2026
@Spomky Spomky merged commit 4c1883e into 5.3.x Feb 3, 2026
17 checks passed
@Spomky Spomky deleted the feature/pkcs-extends-credential-record branch February 3, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DX Developer Experience enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant