Skip to content

Commit ab837ba

Browse files
Spomkyclaude
andcommitted
fix: add backward compatibility for event properties to prevent breaking changes
Add deprecated properties and getters for backward compatibility in events: - BackupStatusChangedEvent: Add deprecated $publicKeyCredentialSource property - BackupEligibilityChangedEvent: Add deprecated $publicKeyCredentialSource property - AuthenticatorAssertionResponseValidationFailedEvent: Add deprecated $credentialSource property These events had their properties renamed from $publicKeyCredentialSource (or $credentialSource) to $credentialRecord in version 5.3. To maintain backward compatibility and prevent breaking changes for users accessing these public properties, we add virtual properties using PHP 8.4's property hooks that delegate to the new $credentialRecord property. This ensures existing code continues to work while encouraging migration to the new property name. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 65f5523 commit ab837ba

File tree

3 files changed

+98
-19
lines changed

3 files changed

+98
-19
lines changed

src/webauthn/src/Event/AuthenticatorAssertionResponseValidationFailedEvent.php

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,35 @@ public function __construct(
2525
/**
2626
* @deprecated since 5.3, use credentialRecord instead. Will be removed in 6.0.
2727
*/
28-
public function getPublicKeyCredentialSource(): PublicKeyCredentialSource
29-
{
30-
if ($this->credentialRecord instanceof PublicKeyCredentialSource) {
31-
return $this->credentialRecord;
28+
public PublicKeyCredentialSource $credentialSource {
29+
get {
30+
if ($this->credentialRecord instanceof PublicKeyCredentialSource) {
31+
return $this->credentialRecord;
32+
}
33+
34+
return PublicKeyCredentialSource::create(
35+
$this->credentialRecord->publicKeyCredentialId,
36+
$this->credentialRecord->type,
37+
$this->credentialRecord->transports,
38+
$this->credentialRecord->attestationType,
39+
$this->credentialRecord->trustPath,
40+
$this->credentialRecord->aaguid,
41+
$this->credentialRecord->credentialPublicKey,
42+
$this->credentialRecord->userHandle,
43+
$this->credentialRecord->counter,
44+
$this->credentialRecord->otherUI,
45+
$this->credentialRecord->backupEligible,
46+
$this->credentialRecord->backupStatus,
47+
$this->credentialRecord->uvInitialized,
48+
);
3249
}
50+
}
3351

34-
return PublicKeyCredentialSource::create(
35-
$this->credentialRecord->publicKeyCredentialId,
36-
$this->credentialRecord->type,
37-
$this->credentialRecord->transports,
38-
$this->credentialRecord->attestationType,
39-
$this->credentialRecord->trustPath,
40-
$this->credentialRecord->aaguid,
41-
$this->credentialRecord->credentialPublicKey,
42-
$this->credentialRecord->userHandle,
43-
$this->credentialRecord->counter,
44-
$this->credentialRecord->otherUI,
45-
$this->credentialRecord->backupEligible,
46-
$this->credentialRecord->backupStatus,
47-
$this->credentialRecord->uvInitialized,
48-
);
52+
/**
53+
* @deprecated since 5.3, use credentialRecord instead. Will be removed in 6.0.
54+
*/
55+
public function getPublicKeyCredentialSource(): PublicKeyCredentialSource
56+
{
57+
return $this->credentialSource;
4958
}
5059
}

src/webauthn/src/Event/BackupEligibilityChangedEvent.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,39 @@ public function __construct(
2121
public ?bool $newValue
2222
) {
2323
}
24+
25+
/**
26+
* @deprecated since 5.3, use credentialRecord instead. Will be removed in 6.0.
27+
*/
28+
public PublicKeyCredentialSource $publicKeyCredentialSource {
29+
get {
30+
if ($this->credentialRecord instanceof PublicKeyCredentialSource) {
31+
return $this->credentialRecord;
32+
}
33+
34+
return PublicKeyCredentialSource::create(
35+
$this->credentialRecord->publicKeyCredentialId,
36+
$this->credentialRecord->type,
37+
$this->credentialRecord->transports,
38+
$this->credentialRecord->attestationType,
39+
$this->credentialRecord->trustPath,
40+
$this->credentialRecord->aaguid,
41+
$this->credentialRecord->credentialPublicKey,
42+
$this->credentialRecord->userHandle,
43+
$this->credentialRecord->counter,
44+
$this->credentialRecord->otherUI,
45+
$this->credentialRecord->backupEligible,
46+
$this->credentialRecord->backupStatus,
47+
$this->credentialRecord->uvInitialized,
48+
);
49+
}
50+
}
51+
52+
/**
53+
* @deprecated since 5.3, use credentialRecord instead. Will be removed in 6.0.
54+
*/
55+
public function getPublicKeyCredentialSource(): PublicKeyCredentialSource
56+
{
57+
return $this->publicKeyCredentialSource;
58+
}
2459
}

src/webauthn/src/Event/BackupStatusChangedEvent.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,39 @@ public function __construct(
2222
public ?bool $newValue
2323
) {
2424
}
25+
26+
/**
27+
* @deprecated since 5.3, use credentialRecord instead. Will be removed in 6.0.
28+
*/
29+
public PublicKeyCredentialSource $publicKeyCredentialSource {
30+
get {
31+
if ($this->credentialRecord instanceof PublicKeyCredentialSource) {
32+
return $this->credentialRecord;
33+
}
34+
35+
return PublicKeyCredentialSource::create(
36+
$this->credentialRecord->publicKeyCredentialId,
37+
$this->credentialRecord->type,
38+
$this->credentialRecord->transports,
39+
$this->credentialRecord->attestationType,
40+
$this->credentialRecord->trustPath,
41+
$this->credentialRecord->aaguid,
42+
$this->credentialRecord->credentialPublicKey,
43+
$this->credentialRecord->userHandle,
44+
$this->credentialRecord->counter,
45+
$this->credentialRecord->otherUI,
46+
$this->credentialRecord->backupEligible,
47+
$this->credentialRecord->backupStatus,
48+
$this->credentialRecord->uvInitialized,
49+
);
50+
}
51+
}
52+
53+
/**
54+
* @deprecated since 5.3, use credentialRecord instead. Will be removed in 6.0.
55+
*/
56+
public function getPublicKeyCredentialSource(): PublicKeyCredentialSource
57+
{
58+
return $this->publicKeyCredentialSource;
59+
}
2560
}

0 commit comments

Comments
 (0)