PluginProbe
Authorizer / 3.5.0
Authorizer v3.5.0
3.16.0 3.15.3 3.15.2 3.15.1 3.15.0 3.14.3 3.14.4 3.14.2 3.14.1 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.9.0 2.9.1 2.9.10 2.9.11 2.9.12 2.9.13 2.9.2 2.9.3 All 127 releases
← All changes | vendor/firebase/php-jwt/src/Key.php +15 -5 3.14.2 → 3.5.0 View file →
@@ -8,22 +8,28 @@
8 8 use TypeError;
9 9
10 10 class Key
11 11 {
12 + /** @var string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate */
13 + private $keyMaterial;
14 + /** @var string */
15 + private $algorithm;
16 +
12 17 /**
13 - * @param string|OpenSSLAsymmetricKey|OpenSSLCertificate $keyMaterial
18 + * @param string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate $keyMaterial
14 19 * @param string $algorithm
15 20 */
16 21 public function __construct(
17 - #[\SensitiveParameter] private $keyMaterial,
18 - private string $algorithm
22 + $keyMaterial,
23 + string $algorithm
19 24 ) {
20 25 if (
21 26 !\is_string($keyMaterial)
22 27 && !$keyMaterial instanceof OpenSSLAsymmetricKey
23 28 && !$keyMaterial instanceof OpenSSLCertificate
29 + && !\is_resource($keyMaterial)
24 30 ) {
25 - throw new TypeError('Key material must be a string, OpenSSLCertificate, or OpenSSLAsymmetricKey');
31 + throw new TypeError('Key material must be a string, resource, or OpenSSLAsymmetricKey');
26 32 }
27 33
28 34 if (empty($keyMaterial)) {
29 35 throw new InvalidArgumentException('Key material must not be empty');
@@ -31,8 +37,12 @@
31 37
32 38 if (empty($algorithm)) {
33 39 throw new InvalidArgumentException('Algorithm must not be empty');
34 40 }
41 +
42 + // TODO: Remove in PHP 8.0 in favor of class constructor property promotion
43 + $this->keyMaterial = $keyMaterial;
44 + $this->algorithm = $algorithm;
35 45 }
36 46
37 47 /**
38 48 * Return the algorithm valid for this key
@@ -44,9 +54,9 @@
44 54 return $this->algorithm;
45 55 }
46 56
47 57 /**
48 - * @return string|OpenSSLAsymmetricKey|OpenSSLCertificate
58 + * @return string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate
49 59 */
50 60 public function getKeyMaterial()
51 61 {
52 62 return $this->keyMaterial;