1010
1111namespace Minishlink \WebPush ;
1212
13+ /**
14+ * @phpstan-consistent-constructor
15+ * @psalm-consistent-constructor
16+ */
1317class Subscription implements SubscriptionInterface
1418{
1519 public const defaultContentEncoding = ContentEncoding::aesgcm; // Default for legacy input. The next major will use "aes128gcm" as defined to rfc8291.
@@ -47,10 +51,10 @@ public function __construct(
4751 * @param array $associativeArray (with keys endpoint, publicKey, authToken, contentEncoding)
4852 * @throws \ErrorException
4953 */
50- public static function create (array $ associativeArray ): self
54+ public static function create (array $ associativeArray ): static
5155 {
5256 if (array_key_exists ('keys ' , $ associativeArray ) && is_array ($ associativeArray ['keys ' ])) {
53- return new self (
57+ return new static (
5458 $ associativeArray ['endpoint ' ],
5559 $ associativeArray ['keys ' ]['p256dh ' ] ?? null ,
5660 $ associativeArray ['keys ' ]['auth ' ] ?? null ,
@@ -59,15 +63,15 @@ public static function create(array $associativeArray): self
5963 }
6064
6165 if (array_key_exists ('publicKey ' , $ associativeArray ) || array_key_exists ('authToken ' , $ associativeArray ) || array_key_exists ('contentEncoding ' , $ associativeArray )) {
62- return new self (
66+ return new static (
6367 $ associativeArray ['endpoint ' ],
6468 $ associativeArray ['publicKey ' ] ?? null ,
6569 $ associativeArray ['authToken ' ] ?? null ,
6670 $ associativeArray ['contentEncoding ' ] ?? ContentEncoding::aesgcm,
6771 );
6872 }
6973
70- return new self (
74+ return new static (
7175 $ associativeArray ['endpoint ' ]
7276 );
7377 }
0 commit comments