From b95c824a7a6ae2b73f961ef0dd17716665791cc6 Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Wed, 31 Dec 2025 13:05:15 +0100 Subject: [PATCH] chore: add override Use new attribute: https://www.php.net/manual/class.override.php --- composer.json | 1 + phpstan.neon | 2 ++ src/MessageSentReport.php | 1 + src/Subscription.php | 16 ++++------------ tests/PushServiceTest.php | 4 +--- tests/WebPushTest.php | 8 ++------ 6 files changed, 11 insertions(+), 21 deletions(-) diff --git a/composer.json b/composer.json index f12f10b8..0efa797e 100644 --- a/composer.json +++ b/composer.json @@ -35,6 +35,7 @@ "ext-openssl": "*", "guzzlehttp/guzzle": "^7.9.2", "spomky-labs/base64url": "^2.0.4", + "symfony/polyfill-php83": "^1.33", "web-token/jwt-library": "^3.4.9|^4.0.6" }, "suggest": { diff --git a/phpstan.neon b/phpstan.neon index 2e9b252c..e827243b 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -3,6 +3,8 @@ parameters: paths: - src reportUnmatchedIgnoredErrors: false + checkMissingOverrideMethodAttribute: true + tipsOfTheDay: false ignoreErrors: - identifier: missingType.iterableValue strictRules: diff --git a/src/MessageSentReport.php b/src/MessageSentReport.php index 27a69e64..3a94fd60 100644 --- a/src/MessageSentReport.php +++ b/src/MessageSentReport.php @@ -93,6 +93,7 @@ public function getResponseContent(): ?string return $this->response?->getBody()->getContents(); } + #[\Override] public function jsonSerialize(): array { return [ diff --git a/src/Subscription.php b/src/Subscription.php index 3639482f..740145d3 100644 --- a/src/Subscription.php +++ b/src/Subscription.php @@ -72,33 +72,25 @@ public static function create(array $associativeArray): self ); } - /** - * {@inheritDoc} - */ + #[\Override] public function getEndpoint(): string { return $this->endpoint; } - /** - * {@inheritDoc} - */ + #[\Override] public function getPublicKey(): ?string { return $this->publicKey; } - /** - * {@inheritDoc} - */ + #[\Override] public function getAuthToken(): ?string { return $this->authToken; } - /** - * {@inheritDoc} - */ + #[\Override] public function getContentEncoding(): ?string { return $this->contentEncoding?->value; diff --git a/tests/PushServiceTest.php b/tests/PushServiceTest.php index e2a24cb8..bea1a1a5 100644 --- a/tests/PushServiceTest.php +++ b/tests/PushServiceTest.php @@ -34,9 +34,7 @@ final class PushServiceTest extends PHPUnit\Framework\TestCase /** @var WebPush WebPush with correct api keys */ private WebPush $webPush; - /** - * {@inheritdoc} - */ + #[\Override] public static function setUpBeforeClass(): void { self::$testServiceUrl = 'http://localhost:'.self::$portNumber; diff --git a/tests/WebPushTest.php b/tests/WebPushTest.php index b943fdb6..5527a66a 100644 --- a/tests/WebPushTest.php +++ b/tests/WebPushTest.php @@ -25,9 +25,7 @@ final class WebPushTest extends PHPUnit\Framework\TestCase /** @var WebPush WebPush with correct api keys */ private WebPush $webPush; - /** - * {@inheritdoc} - */ + #[\Override] public static function setUpBeforeClass(): void { self::$endpoints = [ @@ -52,9 +50,7 @@ public static function setUpBeforeClass(): void } } - /** - * {@inheritdoc} - */ + #[\Override] public function setUp(): void { if (!getenv('CI')) {