Skip to content

Commit

Permalink
upgrade phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikbosch committed Nov 5, 2020
1 parent 27958e4 commit 7c2e900
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" : {
Expand Down
4 changes: 2 additions & 2 deletions src/Firebase/CloudMessaging.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public function send(string $projectId, string $token, Notification $notificatio
}

/**
* @param array $data
* @return array
* @param array<mixed, mixed> $data
* @return array<string, mixed>
*/
private function convertDataToStrings(array $data): array
{
Expand Down
6 changes: 3 additions & 3 deletions src/Firebase/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ final class Notification
private $title;

/**
* @var array
* @var array<mixed, mixed>
*/
private $data;

/**
* @param string $body
* @param string $title
* @param array $data
* @param array<mixed, mixed> $data
*/
public function __construct(string $body, string $title, array $data = [])
{
Expand All @@ -49,7 +49,7 @@ public function getTitle(): string
}

/**
* @return array
* @return array<mixed, mixed>
*/
public function getData(): array
{
Expand Down
4 changes: 2 additions & 2 deletions src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class Message
private $title;

/**
* @var array
* @var array<mixed, mixed>
*/
private $extra = [];

Expand Down Expand Up @@ -46,7 +46,7 @@ public function getTitle(): Title
}

/**
* @return array
* @return array<mixed, mixed>
*/
public function getExtra(): array
{
Expand Down
4 changes: 2 additions & 2 deletions test/Integration/CloudMessagingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

final class CloudMessagingTest extends AbstractTestCase
{
public function testDataIsString()
public function testDataIsString(): void
{
$provider = $this->createMock(AuthorizationHeaderProviderInterface::class);
$provider
Expand Down Expand Up @@ -53,7 +53,7 @@ function (Request $request) {
$cloudMessaging->send('project-xyz', 'token', $notification);
}

public function testForbidden()
public function testForbidden(): void
{
$this->expectException(ForbiddenToSendMessageException::class);

Expand Down
2 changes: 1 addition & 1 deletion test/Unit/BodyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions test/Unit/GatewayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -26,7 +26,7 @@ public function testSend()
$gateway->send($message, $recipient);
}

public function testExceptionUnsupportedSender()
public function testExceptionUnsupportedSender(): void
{
$this->expectException(UnsupportedMessageRecipient::class);

Expand Down
10 changes: 5 additions & 5 deletions test/Unit/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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);
Expand All @@ -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());
Expand Down
4 changes: 2 additions & 2 deletions test/Unit/Recipient/AndroidDeviceRecipientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions test/Unit/Recipient/AppleDeviceRecipientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions test/Unit/Recipient/FirebaseRecipientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions test/Unit/Sender/AppleApnSenderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions test/Unit/Sender/FirebaseSenderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion test/Unit/TitleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7c2e900

Please sign in to comment.