From 7750862230af32c456c7c71b7e3e0261fdd831b6 Mon Sep 17 00:00:00 2001 From: Alex Plekhanov Date: Fri, 17 Dec 2021 18:58:36 +0100 Subject: [PATCH 1/5] chore: Bumped php version to minimum 7.4 --- .github/workflows/tests.yml | 7 +++++-- CHANGELOG.md | 4 ++++ composer.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9e6b9be..b1c94b9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,7 +10,10 @@ jobs: strategy: fail-fast: true matrix: - php: [7.3, 7.4, 8.0, 8.1] + php: + - 7.4 + - 8.0 + - 8.1 dependencies: - lowest - highest @@ -29,7 +32,7 @@ jobs: coverage: none - name: Composer install - uses: "ramsey/composer-install@v1" + uses: ramsey/composer-install@v1 with: dependency-versions: "${{ matrix.dependencies }}" diff --git a/CHANGELOG.md b/CHANGELOG.md index 185db77..56476fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to `laravel-notification-channels/pushbullet` will be documented in this file +## 1.4.0 - Unreleased +### Changed +- Bumped PHP requirement to 7.4 + ## 1.3.1 - 2021-12-17 ### Changed - Minor CI improvements diff --git a/composer.json b/composer.json index 3962dc7..cece36d 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ } ], "require": { - "php": "^7.3 || ~8.0.0 || ~8.1.0", + "php": "^7.4 || ~8.0.0 || ~8.1.0", "guzzlehttp/guzzle": "^6.2 || ^7.0", "illuminate/notifications": "~5.5 || ~6.0 || ~7.0 || ~8.0", "illuminate/support": "~5.5 || ~6.0 || ~7.0 || ~8.0" From a275d9516dbab88b51e66b860bda3556fcefbb1d Mon Sep 17 00:00:00 2001 From: Alex Plekhanov Date: Fri, 17 Dec 2021 19:10:56 +0100 Subject: [PATCH 2/5] refactor: Used typed properties where possible --- src/Pushbullet.php | 17 +++-------------- src/PushbulletChannel.php | 10 ++-------- src/PushbulletMessage.php | 7 +------ src/Targets/Channel.php | 11 ++--------- src/Targets/Device.php | 11 ++--------- src/Targets/Email.php | 9 ++------- 6 files changed, 12 insertions(+), 53 deletions(-) diff --git a/src/Pushbullet.php b/src/Pushbullet.php index 5f2ac09..4d3c7fa 100644 --- a/src/Pushbullet.php +++ b/src/Pushbullet.php @@ -12,18 +12,10 @@ class Pushbullet { - /** @var string */ - private $token; + private string $token; - /** @var \GuzzleHttp\Client */ - private $httpClient; + private HttpClient $httpClient; - /** - * Create small Pushbullet client. - * - * @param string $token - * @param \GuzzleHttp\Client $httpClient - */ public function __construct(string $token, HttpClient $httpClient) { $this->token = $token; @@ -32,8 +24,6 @@ public function __construct(string $token, HttpClient $httpClient) /** * Get url to send to Pushbullet API? - * - * @return string */ private function getPushbulletUrl(): string { @@ -43,7 +33,7 @@ private function getPushbulletUrl(): string /** * Get headers for API calls. * - * @return array + * @return array */ private function getHeaders(): array { @@ -56,7 +46,6 @@ private function getHeaders(): array * Send request to Pushbullet API. * * @param array $params - * @return \Psr\Http\Message\ResponseInterface */ public function send($params): ResponseInterface { diff --git a/src/PushbulletChannel.php b/src/PushbulletChannel.php index d9bfd66..5298999 100644 --- a/src/PushbulletChannel.php +++ b/src/PushbulletChannel.php @@ -11,12 +11,8 @@ class PushbulletChannel { - /** @var \NotificationChannels\Pushbullet\Pushbullet */ - private $pushbullet; + private Pushbullet $pushbullet; - /** - * @param \NotificationChannels\Pushbullet\Pushbullet $pushbullet - */ public function __construct(Pushbullet $pushbullet) { $this->pushbullet = $pushbullet; @@ -26,7 +22,6 @@ public function __construct(Pushbullet $pushbullet) * Send the given notification. * * @param mixed $notifiable - * @param \Illuminate\Notifications\Notification $notification * * @throws \NotificationChannels\Pushbullet\Exceptions\CouldNotSendNotification */ @@ -43,8 +38,7 @@ public function send($notifiable, Notification $notification): void } /** - * @param $notifiable - * @return \NotificationChannels\Pushbullet\Targets\Targetable|void + * @param Targetable|string $notifiable */ private function getTarget($notifiable): ?Targetable { diff --git a/src/PushbulletMessage.php b/src/PushbulletMessage.php index 9db6b26..2af345d 100644 --- a/src/PushbulletMessage.php +++ b/src/PushbulletMessage.php @@ -18,8 +18,7 @@ class PushbulletMessage */ public $type = 'note'; - /** @var \NotificationChannels\Pushbullet\Targets\Targetable */ - protected $target; + protected Targetable $target; /** * Notification title. @@ -60,7 +59,6 @@ public function __construct($message) } /** - * @param \NotificationChannels\Pushbullet\Targets\Targetable $targetable * @return $this */ public function target(Targetable $targetable): self @@ -153,9 +151,6 @@ public function toArray(): array ); } - /** - * @return bool - */ private function isLink(): bool { return $this->type === self::TYPE_LINK; diff --git a/src/Targets/Channel.php b/src/Targets/Channel.php index 37afbd5..5e68bb2 100644 --- a/src/Targets/Channel.php +++ b/src/Targets/Channel.php @@ -6,21 +6,14 @@ class Channel implements Targetable { - /** - * PushBullet channel tag. - * - * @var string - */ - private $channelTag; + private string $channelTag; /** - * Set channel tag. - * * @param string $channelTag */ public function __construct($channelTag) { - $this->channelTag = $channelTag; + $this->channelTag = (string)$channelTag; } /** diff --git a/src/Targets/Device.php b/src/Targets/Device.php index 8d589f0..e36811f 100644 --- a/src/Targets/Device.php +++ b/src/Targets/Device.php @@ -6,21 +6,14 @@ class Device implements Targetable { - /** - * Recipient device id. - * - * @var string - */ - private $deviceId; + private string $deviceId; /** - * Set recipient device id. - * * @param string $device */ public function __construct($device) { - $this->deviceId = $device; + $this->deviceId = (string)$device; } /** diff --git a/src/Targets/Email.php b/src/Targets/Email.php index 085352a..6e9dabc 100644 --- a/src/Targets/Email.php +++ b/src/Targets/Email.php @@ -8,12 +8,7 @@ class Email implements Targetable { - /** - * Recipient email. - * - * @var string - */ - private $email; + private string $email; /** * Set recipient email. @@ -26,7 +21,7 @@ public function __construct($email) throw CouldNotSendNotification::providedEmailIsInvalid($email); } - $this->email = $email; + $this->email = (string)$email; } /** From 2553f97c6928acfc22c4977a501c75d9b8a5b1c4 Mon Sep 17 00:00:00 2001 From: Alex Plekhanov Date: Fri, 17 Dec 2021 18:11:09 +0000 Subject: [PATCH 3/5] Apply fixes from StyleCI [ci skip] [skip ci] --- src/PushbulletChannel.php | 2 +- src/Targets/Channel.php | 2 +- src/Targets/Device.php | 2 +- src/Targets/Email.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/PushbulletChannel.php b/src/PushbulletChannel.php index 5298999..8445e72 100644 --- a/src/PushbulletChannel.php +++ b/src/PushbulletChannel.php @@ -38,7 +38,7 @@ public function send($notifiable, Notification $notification): void } /** - * @param Targetable|string $notifiable + * @param Targetable|string $notifiable */ private function getTarget($notifiable): ?Targetable { diff --git a/src/Targets/Channel.php b/src/Targets/Channel.php index 5e68bb2..04b69ae 100644 --- a/src/Targets/Channel.php +++ b/src/Targets/Channel.php @@ -13,7 +13,7 @@ class Channel implements Targetable */ public function __construct($channelTag) { - $this->channelTag = (string)$channelTag; + $this->channelTag = (string) $channelTag; } /** diff --git a/src/Targets/Device.php b/src/Targets/Device.php index e36811f..8225761 100644 --- a/src/Targets/Device.php +++ b/src/Targets/Device.php @@ -13,7 +13,7 @@ class Device implements Targetable */ public function __construct($device) { - $this->deviceId = (string)$device; + $this->deviceId = (string) $device; } /** diff --git a/src/Targets/Email.php b/src/Targets/Email.php index 6e9dabc..c8cb066 100644 --- a/src/Targets/Email.php +++ b/src/Targets/Email.php @@ -21,7 +21,7 @@ public function __construct($email) throw CouldNotSendNotification::providedEmailIsInvalid($email); } - $this->email = (string)$email; + $this->email = (string) $email; } /** From 5f03b980712a9a2cffb4bb9d02203c2a250e7f85 Mon Sep 17 00:00:00 2001 From: Alex Plekhanov Date: Fri, 17 Dec 2021 19:23:05 +0100 Subject: [PATCH 4/5] chore: removed unused mockery from dev dependencies --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index cece36d..ce6df7c 100644 --- a/composer.json +++ b/composer.json @@ -18,8 +18,7 @@ "illuminate/support": "~5.5 || ~6.0 || ~7.0 || ~8.0" }, "require-dev": { - "mockery/mockery": "^1.2.0", - "phpunit/phpunit": "^8.5.21 || ^9.0" + "phpunit/phpunit": "^9.0" }, "autoload": { "psr-4": { From ae030031ed5f735c1e3c2115ff1f121a990667f7 Mon Sep 17 00:00:00 2001 From: Alex Plekhanov Date: Fri, 17 Dec 2021 20:00:15 +0100 Subject: [PATCH 5/5] chore: migrated phpunit configuration --- phpunit.xml.dist | 45 ++++++++++++++++----------------------------- 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 7c9cf9e..f1b35db 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,31 +1,18 @@ - - - - tests - - - - - - src - - - - - - - - - - + + + + + + + + + + + tests + + + + +