Skip to content

Commit 18666ed

Browse files
Restore #[SensitiveParameter] attributes
Co-Authored-By: Alexander Kravchenko <[email protected]>
1 parent 74d80b8 commit 18666ed

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
'spacing' => 'none',
1818
],
1919
'method_argument_space' => [
20-
'attribute_placement' => 'same_line',
20+
'attribute_placement' => 'standalone', // same_line can break PHP <8.2
2121
],
2222
'no_unused_imports' => true,
2323
'ordered_imports' => [

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ Please read about the future of the Firebase Admin PHP SDK on the
77

88
## [Unreleased]
99

10+
## Added
11+
12+
* Re-added the `#[SensitiveParameter]` attribute because, while it's not supported in PHP 8.1, it can still be used
13+
if placed in a standalone line above the variable or property.
14+
1015
## [7.21.1] - 2025-07-24
1116

1217
### Fixed

src/Firebase/AppCheck/AppCheckTokenGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88
use Firebase\JWT\JWT;
99
use Kreait\Firebase\Exception\AppCheck\InvalidAppCheckTokenOptions;
1010
use Psr\Clock\ClockInterface;
11+
use SensitiveParameter;
1112

1213
/**
1314
* @internal
14-
*
15-
* @todo Add #[SensitiveParameter] attribute to the private key once the minimum required PHP version is >=8.2
1615
*/
1716
final class AppCheckTokenGenerator
1817
{
@@ -26,6 +25,7 @@ final class AppCheckTokenGenerator
2625
*/
2726
public function __construct(
2827
private readonly string $clientEmail,
28+
#[SensitiveParameter]
2929
private readonly string $privateKey,
3030
?ClockInterface $clock = null,
3131
) {

src/Firebase/ServiceAccount.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,48 @@
44

55
namespace Kreait\Firebase;
66

7+
use SensitiveParameter;
8+
79
/**
810
* @internal
9-
*
10-
* @todo Add #[SensitiveParameter] attributes once the minimum required PHP version is >=8.2
1111
*/
1212
final class ServiceAccount
1313
{
1414
public function __construct(
1515
/** @var non-empty-string */
1616
public string $type,
1717
/** @var non-empty-string */
18+
#[SensitiveParameter]
1819
public string $projectId,
1920
/** @var non-empty-string */
21+
#[SensitiveParameter]
2022
public string $clientEmail,
2123
/** @var non-empty-string */
24+
#[SensitiveParameter]
2225
public string $clientId,
2326
/** @var non-empty-string */
27+
#[SensitiveParameter]
2428
public string $privateKey,
2529
/** @var non-empty-string */
30+
#[SensitiveParameter]
2631
public string $privateKeyId,
2732
/** @var non-empty-string */
33+
#[SensitiveParameter]
2834
public string $authUri,
2935
/** @var non-empty-string */
36+
#[SensitiveParameter]
3037
public string $tokenUri,
3138
/** @var non-empty-string */
39+
#[SensitiveParameter]
3240
public string $authProviderX509CertUrl,
3341
/** @var non-empty-string */
42+
#[SensitiveParameter]
3443
public string $clientX509CertUrl,
3544
/** @var non-empty-string|null */
45+
#[SensitiveParameter]
3646
public ?string $quotaProjectId = null,
3747
/** @var non-empty-string|null */
48+
#[SensitiveParameter]
3849
public ?string $universeDomain = null,
3950
) {
4051
}

0 commit comments

Comments
 (0)