diff --git a/phpstan-default-baseline.neon b/phpstan-default-baseline.neon index 10299e7..364905f 100644 --- a/phpstan-default-baseline.neon +++ b/phpstan-default-baseline.neon @@ -1,6 +1,2 @@ parameters: ignoreErrors: - - - message: "#^Strict comparison using \\=\\=\\= between null and Serhiy\\\\Pushover\\\\Recipient will always evaluate to false\\.$#" - count: 1 - path: src/Api/Glances/Glance.php diff --git a/src/Api/Glances/Glance.php b/src/Api/Glances/Glance.php index 7c15bab..235d58b 100644 --- a/src/Api/Glances/Glance.php +++ b/src/Api/Glances/Glance.php @@ -41,7 +41,7 @@ class Glance /** * Pushover user. */ - private Recipient $recipient; + private ?Recipient $recipient = null; private GlanceDataFields $glanceDataFields; public function __construct(Application $application, GlanceDataFields $glanceDataFields) @@ -82,10 +82,12 @@ public function setGlanceDataFields(GlanceDataFields $glanceDataFields): void public function hasAtLeastOneField(): bool { - if (null === $this->getGlanceDataFields()->getTitle() - && null === $this->getGlanceDataFields()->getSubtext() - && null === $this->getGlanceDataFields()->getCount() - && null === $this->getGlanceDataFields()->getPercent() + $glanceDataFields = $this->getGlanceDataFields(); + + if (null === $glanceDataFields->getTitle() + && null === $glanceDataFields->getSubtext() + && null === $glanceDataFields->getCount() + && null === $glanceDataFields->getPercent() ) { return false; } @@ -102,9 +104,6 @@ public function hasRecipient(): bool return true; } - /** - * Push glance. - */ public function push(): GlancesResponse { $client = new GlancesClient();