From 7c2e9009d68f5868afbed806a0481b7eb298d1d1 Mon Sep 17 00:00:00 2001 From: Frederik Bosch Date: Thu, 5 Nov 2020 23:22:01 +0100 Subject: [PATCH] upgrade phpstan --- composer.json | 4 ++-- src/Firebase/CloudMessaging.php | 4 ++-- src/Firebase/Notification.php | 6 +++--- src/Message.php | 4 ++-- test/Integration/CloudMessagingTest.php | 4 ++-- test/Unit/BodyTest.php | 2 +- test/Unit/GatewayTest.php | 4 ++-- test/Unit/MessageTest.php | 10 +++++----- test/Unit/Recipient/AndroidDeviceRecipientTest.php | 4 ++-- test/Unit/Recipient/AppleDeviceRecipientTest.php | 4 ++-- test/Unit/Recipient/FirebaseRecipientTest.php | 4 ++-- test/Unit/Sender/AppleApnSenderTest.php | 6 +++--- test/Unit/Sender/FirebaseSenderTest.php | 4 ++-- test/Unit/TitleTest.php | 2 +- 14 files changed, 31 insertions(+), 31 deletions(-) diff --git a/composer.json b/composer.json index 685f1a9..b9fce44 100644 --- a/composer.json +++ b/composer.json @@ -10,8 +10,8 @@ }, "require-dev" : { "phpunit/phpunit": "^8", - "phpstan/phpstan": "^0.11", - "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", "friendsofphp/php-cs-fixer": "^2.9" }, "autoload" : { diff --git a/src/Firebase/CloudMessaging.php b/src/Firebase/CloudMessaging.php index 38915ae..29cf4cd 100644 --- a/src/Firebase/CloudMessaging.php +++ b/src/Firebase/CloudMessaging.php @@ -99,8 +99,8 @@ public function send(string $projectId, string $token, Notification $notificatio } /** - * @param array $data - * @return array + * @param array $data + * @return array */ private function convertDataToStrings(array $data): array { diff --git a/src/Firebase/Notification.php b/src/Firebase/Notification.php index 14b1d90..3783b8c 100644 --- a/src/Firebase/Notification.php +++ b/src/Firebase/Notification.php @@ -16,14 +16,14 @@ final class Notification private $title; /** - * @var array + * @var array */ private $data; /** * @param string $body * @param string $title - * @param array $data + * @param array $data */ public function __construct(string $body, string $title, array $data = []) { @@ -49,7 +49,7 @@ public function getTitle(): string } /** - * @return array + * @return array */ public function getData(): array { diff --git a/src/Message.php b/src/Message.php index f0806a5..82e63be 100644 --- a/src/Message.php +++ b/src/Message.php @@ -16,7 +16,7 @@ final class Message private $title; /** - * @var array + * @var array */ private $extra = []; @@ -46,7 +46,7 @@ public function getTitle(): Title } /** - * @return array + * @return array */ public function getExtra(): array { diff --git a/test/Integration/CloudMessagingTest.php b/test/Integration/CloudMessagingTest.php index 59b1a8f..74e86ea 100644 --- a/test/Integration/CloudMessagingTest.php +++ b/test/Integration/CloudMessagingTest.php @@ -15,7 +15,7 @@ final class CloudMessagingTest extends AbstractTestCase { - public function testDataIsString() + public function testDataIsString(): void { $provider = $this->createMock(AuthorizationHeaderProviderInterface::class); $provider @@ -53,7 +53,7 @@ function (Request $request) { $cloudMessaging->send('project-xyz', 'token', $notification); } - public function testForbidden() + public function testForbidden(): void { $this->expectException(ForbiddenToSendMessageException::class); diff --git a/test/Unit/BodyTest.php b/test/Unit/BodyTest.php index 6ec9991..6a56e13 100644 --- a/test/Unit/BodyTest.php +++ b/test/Unit/BodyTest.php @@ -8,7 +8,7 @@ final class BodyTest extends AbstractTestCase { - public function testToString() + public function testToString(): void { $message = new Body('test'); $this->assertEquals('test', (string)$message); diff --git a/test/Unit/GatewayTest.php b/test/Unit/GatewayTest.php index df379f0..8ddf3e3 100644 --- a/test/Unit/GatewayTest.php +++ b/test/Unit/GatewayTest.php @@ -13,7 +13,7 @@ final class GatewayTest extends AbstractTestCase { - public function testSend() + public function testSend(): void { $message = new Message(new Body('test')); $recipient = new AndroidDeviceRecipient('token'); @@ -26,7 +26,7 @@ public function testSend() $gateway->send($message, $recipient); } - public function testExceptionUnsupportedSender() + public function testExceptionUnsupportedSender(): void { $this->expectException(UnsupportedMessageRecipient::class); diff --git a/test/Unit/MessageTest.php b/test/Unit/MessageTest.php index 5c5106e..162f33b 100644 --- a/test/Unit/MessageTest.php +++ b/test/Unit/MessageTest.php @@ -10,20 +10,20 @@ final class MessageTest extends AbstractTestCase { - public function testImmutability() + public function testImmutability(): void { $message = new Message(new Body('test')); $this->assertNotSame($message, $message->withTitle(new Title('test'))); } - public function testBody() + public function testBody(): void { $body = new Body('test'); $message = new Message($body); $this->assertSame('test', (string)$message->getBody()); } - public function testTitle() + public function testTitle(): void { $title1 = new Title('test'); $title2 = new Title('new test'); @@ -37,7 +37,7 @@ public function testTitle() $this->assertSame($title2, $message2->getTitle()); } - public function testExtra() + public function testExtra(): void { $message = new Message(new Body('test')); $message1 = $message->withExtra('localId', 1); @@ -50,7 +50,7 @@ public function testExtra() $this->assertCount(2, $message3->getExtra()); } - public function testNoTitle() + public function testNoTitle(): void { $message = new Message(new Body('test')); $this->assertEquals('', (string)$message->getTitle()); diff --git a/test/Unit/Recipient/AndroidDeviceRecipientTest.php b/test/Unit/Recipient/AndroidDeviceRecipientTest.php index 6edab33..596c748 100644 --- a/test/Unit/Recipient/AndroidDeviceRecipientTest.php +++ b/test/Unit/Recipient/AndroidDeviceRecipientTest.php @@ -8,13 +8,13 @@ final class AndroidDeviceRecipientTest extends AbstractTestCase { - public function testToken() + public function testToken(): void { $recipient = new AndroidDeviceRecipient('test'); $this->assertEquals('test', $recipient->getToken()); } - public function testFromString() + public function testFromString(): void { $recipient = AndroidDeviceRecipient::fromString('test'); $this->assertInstanceOf(AndroidDeviceRecipient::class, $recipient); diff --git a/test/Unit/Recipient/AppleDeviceRecipientTest.php b/test/Unit/Recipient/AppleDeviceRecipientTest.php index ad761a6..5080f50 100644 --- a/test/Unit/Recipient/AppleDeviceRecipientTest.php +++ b/test/Unit/Recipient/AppleDeviceRecipientTest.php @@ -8,13 +8,13 @@ final class AppleDeviceRecipientTest extends AbstractTestCase { - public function testToken() + public function testToken(): void { $recipient = new AppleDeviceRecipient('test'); $this->assertEquals('test', $recipient->getToken()); } - public function testFromString() + public function testFromString(): void { $recipient = AppleDeviceRecipient::fromString('test'); $this->assertInstanceOf(AppleDeviceRecipient::class, $recipient); diff --git a/test/Unit/Recipient/FirebaseRecipientTest.php b/test/Unit/Recipient/FirebaseRecipientTest.php index 3ac1f23..aef6208 100644 --- a/test/Unit/Recipient/FirebaseRecipientTest.php +++ b/test/Unit/Recipient/FirebaseRecipientTest.php @@ -8,13 +8,13 @@ final class FirebaseRecipientTest extends AbstractTestCase { - public function testToken() + public function testToken(): void { $recipient = new FirebaseRecipient('test'); $this->assertEquals('test', $recipient->getToken()); } - public function testFromString() + public function testFromString(): void { $recipient = FirebaseRecipient::fromString('test'); $this->assertInstanceOf(FirebaseRecipient::class, $recipient); diff --git a/test/Unit/Sender/AppleApnSenderTest.php b/test/Unit/Sender/AppleApnSenderTest.php index 81a39df..f69defb 100644 --- a/test/Unit/Sender/AppleApnSenderTest.php +++ b/test/Unit/Sender/AppleApnSenderTest.php @@ -12,7 +12,7 @@ final class AppleApnSenderTest extends AbstractTestCase { - public function testSupports() + public function testSupports(): void { $message = new Message(new Body('test')); $recipient = new AppleDeviceRecipient('token'); @@ -21,7 +21,7 @@ public function testSupports() $this->assertTrue($sender->supports($message, $recipient)); } - public function testToken() + public function testToken(): void { $message = new Message(new Body('test')); $recipient = new AppleDeviceRecipient('token'); @@ -30,7 +30,7 @@ public function testToken() $this->assertTrue($sender->supports($message, $recipient)); } - public function testNotSupports() + public function testNotSupports(): void { $message = new Message(new Body('test')); $recipient = new AndroidDeviceRecipient('token'); diff --git a/test/Unit/Sender/FirebaseSenderTest.php b/test/Unit/Sender/FirebaseSenderTest.php index f9f4282..1bae083 100644 --- a/test/Unit/Sender/FirebaseSenderTest.php +++ b/test/Unit/Sender/FirebaseSenderTest.php @@ -15,7 +15,7 @@ final class FirebaseSenderTest extends AbstractTestCase { - public function testSupports() + public function testSupports(): void { $message = new Message(new Body('test')); $recipient = new FirebaseRecipient('token'); @@ -27,7 +27,7 @@ public function testSupports() $this->assertTrue($sender->supports($message, $recipient)); } - public function testNotSupports() + public function testNotSupports(): void { $message = new Message(new Body('test')); $recipient = new AndroidDeviceRecipient('token'); diff --git a/test/Unit/TitleTest.php b/test/Unit/TitleTest.php index 4ff0e1b..a8a4395 100644 --- a/test/Unit/TitleTest.php +++ b/test/Unit/TitleTest.php @@ -8,7 +8,7 @@ final class TitleTest extends AbstractTestCase { - public function testToString() + public function testToString(): void { $message = new Title('test'); $this->assertEquals('test', (string)$message);