Skip to content

Commit

Permalink
Fix PHPStan new errors (#519)
Browse files Browse the repository at this point in the history
  • Loading branch information
Slamdunk authored Sep 23, 2021
1 parent 1672b70 commit 5f1d8ed
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ csfix: vendor

.PHONY: static-analysis
static-analysis: vendor
vendor/bin/phpstan analyse
$(or ${PHP_BIN},php) vendor/bin/phpstan analyse

wait-for-it:
wget -O wait-for-it "https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh"
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
"ext-mbstring": "*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0.0",
"laminas/laminas-mail": "^2.14.0",
"friendsofphp/php-cs-fixer": "^v3.1.0",
"laminas/laminas-mail": "^2.15.0",
"malukenho/mcbumpface": "^1.1.5",
"phpstan/phpstan": "^0.12.85",
"phpstan/phpstan-phpunit": "^0.12.18",
"phpstan/phpstan-strict-rules": "^0.12.9",
"phpunit/phpunit": "^9.5.4"
"phpstan/phpstan": "^0.12.99",
"phpstan/phpstan-phpunit": "^0.12.22",
"phpstan/phpstan-strict-rules": "^0.12.11",
"phpunit/phpunit": "^9.5.9"
},
"autoload": {
"psr-4": {
Expand Down
15 changes: 15 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,21 @@ parameters:
count: 1
path: tests/ConnectionTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertArrayHasKey\\(\\) with 'date' and \\*NEVER\\* will always evaluate to true\\.$#"
count: 1
path: tests/MessageTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertArrayHasKey\\(\\) with 'from' and Ddeboer\\\\Imap\\\\Message\\\\Headers will always evaluate to false\\.$#"
count: 1
path: tests/MessageTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertArrayHasKey\\(\\) with 'recent' and \\*NEVER\\* will always evaluate to true\\.$#"
count: 1
path: tests/MessageTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Ddeboer\\\\\\\\Imap\\\\\\\\Message\\\\\\\\EmailAddress' and Ddeboer\\\\Imap\\\\Message\\\\EmailAddress will always evaluate to true\\.$#"
count: 2
Expand Down
5 changes: 5 additions & 0 deletions tests/EmbeddedMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public function testEmbeddedMessageWithoutContentDisposition(): void
static::assertSame('file.jpg', $attachment->getFilename());

$attachment = \next($attachments);
static::assertNotFalse($attachment);
static::assertTrue($attachment->isEmbeddedMessage());

$embeddedMessage = $attachment->getEmbeddedMessage();
Expand All @@ -142,18 +143,22 @@ public function testEmbeddedMessageWithoutContentDisposition(): void
static::assertNotEmpty($embeddedMessage->getBodyHtml());

$attachment = \next($attachments);
static::assertNotFalse($attachment);
static::assertNotEmpty($attachment->getContent());
static::assertSame('file1.xlsx', $attachment->getFilename());

$attachment = \next($attachments);
static::assertNotFalse($attachment);
static::assertNotEmpty($attachment->getContent());
static::assertSame('file2.xlsx', $attachment->getFilename());

$attachment = \next($attachments);
static::assertNotFalse($attachment);
static::assertNotEmpty($attachment->getContent());
static::assertSame('file3.xlsx', $attachment->getFilename());

$attachment = \next($attachments);
static::assertNotFalse($attachment);
static::assertNotEmpty($attachment->getContent());
static::assertSame('file4.zip', $attachment->getFilename());
}
Expand Down

0 comments on commit 5f1d8ed

Please sign in to comment.