From 36233f59187ed7367833eac634ebeed078a959de Mon Sep 17 00:00:00 2001 From: chris Date: Fri, 28 Jul 2023 20:33:18 +0200 Subject: [PATCH] chore: update phpunit 9 = 10 and psalm 4 = 5 (#368) Co-authored-by: Christopher Georg --- composer.json | 4 +-- phpunit.xml.dist | 28 +++++++++++++------ tests/EmailValidator/EmailLexerTest.php | 8 +++--- tests/EmailValidator/EmailParserTest.php | 2 +- .../Validation/DNSCheckValidationTest.php | 4 +-- .../Extra/SpoofCheckValidationTest.php | 2 +- .../Validation/MessageIDValidationTest.php | 4 +-- .../NoRFCWarningsValidationTest.php | 2 +- .../RFCValidationDomainPartTest.php | 10 +++---- .../Validation/RFCValidationTest.php | 8 +++--- 10 files changed, 41 insertions(+), 31 deletions(-) diff --git a/composer.json b/composer.json index fa915246..bf1b3f4c 100644 --- a/composer.json +++ b/composer.json @@ -18,8 +18,8 @@ "symfony/polyfill-intl-idn": "^1.26" }, "require-dev": { - "phpunit/phpunit": "^9.5.27", - "vimeo/psalm": "^4.30" + "phpunit/phpunit": "^10.2", + "vimeo/psalm": "^5.12" }, "suggest": { "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 5ad22cb7..8161237f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,17 +1,27 @@ - - - - ./src/ - - - ./src/Result/Reason - - + + + ./tests/EmailValidator ./vendor/ + + + + ./src/ + + + ./src/Result/Reason + + + diff --git a/tests/EmailValidator/EmailLexerTest.php b/tests/EmailValidator/EmailLexerTest.php index c800e93a..dd50c719 100644 --- a/tests/EmailValidator/EmailLexerTest.php +++ b/tests/EmailValidator/EmailLexerTest.php @@ -51,11 +51,11 @@ public function testLexerParsesInvalidUTF8($char) $this->assertEquals(EmailLexer::INVALID, $lexer->current->type); } - public function invalidUTF8CharsProvider() + public static function invalidUTF8CharsProvider() { $chars = array(); for ($i = 0; $i < 0x100; ++$i) { - $c = $this->utf8Chr($i); + $c = self::utf8Chr($i); if (preg_match('/(?=\p{Cc})(?=[^\t\n\n\r])/u', $c) && !preg_match('/\x{0000}/u', $c)) { $chars[] = array($c); } @@ -64,7 +64,7 @@ public function invalidUTF8CharsProvider() return $chars; } - protected function utf8Chr($code_point) + protected static function utf8Chr($code_point) { if ($code_point < 0 || 0x10FFFF < $code_point || (0xD800 <= $code_point && $code_point <= 0xDFFF)) { @@ -123,7 +123,7 @@ public function testLexerSearchToken() $this->assertTrue($lexer->find(EmailLexer::S_HTAB)); } - public function getTokens() + public static function getTokens() { return array( array("foo", EmailLexer::GENERIC), diff --git a/tests/EmailValidator/EmailParserTest.php b/tests/EmailValidator/EmailParserTest.php index 184093cd..7bfeec3b 100644 --- a/tests/EmailValidator/EmailParserTest.php +++ b/tests/EmailValidator/EmailParserTest.php @@ -8,7 +8,7 @@ class EmailParserTest extends TestCase { - public function emailPartsProvider() + public static function emailPartsProvider() { return [ ['test@foo.com', 'test', 'foo.com'], diff --git a/tests/EmailValidator/Validation/DNSCheckValidationTest.php b/tests/EmailValidator/Validation/DNSCheckValidationTest.php index 610a2957..6f57584e 100644 --- a/tests/EmailValidator/Validation/DNSCheckValidationTest.php +++ b/tests/EmailValidator/Validation/DNSCheckValidationTest.php @@ -16,7 +16,7 @@ class DNSCheckValidationTest extends TestCase { - public function validEmailsProvider() + public static function validEmailsProvider() { return [ // dot-atom @@ -37,7 +37,7 @@ public function validEmailsProvider() ]; } - public function localOrReservedEmailsProvider() + public static function localOrReservedEmailsProvider() { return [ // Reserved Top Level DNS Names diff --git a/tests/EmailValidator/Validation/Extra/SpoofCheckValidationTest.php b/tests/EmailValidator/Validation/Extra/SpoofCheckValidationTest.php index 9d65dfba..6d9d1fc1 100644 --- a/tests/EmailValidator/Validation/Extra/SpoofCheckValidationTest.php +++ b/tests/EmailValidator/Validation/Extra/SpoofCheckValidationTest.php @@ -25,7 +25,7 @@ public function testEmailWithSpoofsIsInvalid() $this->assertFalse($validation->isValid("Кириллица"."latin漢字"."ひらがな"."カタカナ", new EmailLexer())); } - public function validUTF8EmailsProvider() + public static function validUTF8EmailsProvider() { return [ // Cyrillic diff --git a/tests/EmailValidator/Validation/MessageIDValidationTest.php b/tests/EmailValidator/Validation/MessageIDValidationTest.php index 8aafd138..4b58e948 100644 --- a/tests/EmailValidator/Validation/MessageIDValidationTest.php +++ b/tests/EmailValidator/Validation/MessageIDValidationTest.php @@ -19,7 +19,7 @@ public function testValidMessageIDs(string $messageID) $this->assertTrue($validator->isValid($messageID, new EmailLexer())); } - public function validMessageIDs() : array + public static function validMessageIDs() : array { return [ ['a@b.c+&%$.d'], @@ -38,7 +38,7 @@ public function testInvalidMessageIDs(string $messageID) $this->assertFalse($validator->isValid($messageID, new EmailLexer())); } - public function invalidMessageIDs() : array + public static function invalidMessageIDs() : array { return [ ['example'], diff --git a/tests/EmailValidator/Validation/NoRFCWarningsValidationTest.php b/tests/EmailValidator/Validation/NoRFCWarningsValidationTest.php index 3467b227..786711eb 100644 --- a/tests/EmailValidator/Validation/NoRFCWarningsValidationTest.php +++ b/tests/EmailValidator/Validation/NoRFCWarningsValidationTest.php @@ -38,7 +38,7 @@ public function testEmailWithoutWarningsIsValid($email) $this->assertNull($validation->getError()); } - public function getValidEmailsWithoutWarnings() + public static function getValidEmailsWithoutWarnings() { return [ ['example@example.com',], diff --git a/tests/EmailValidator/Validation/RFCValidationDomainPartTest.php b/tests/EmailValidator/Validation/RFCValidationDomainPartTest.php index 9a5f7f75..8f158780 100644 --- a/tests/EmailValidator/Validation/RFCValidationDomainPartTest.php +++ b/tests/EmailValidator/Validation/RFCValidationDomainPartTest.php @@ -62,7 +62,7 @@ public function testValidEmails($email) $this->assertTrue($this->validator->isValid($email, $this->lexer)); } - public function getValidEmails() + public static function getValidEmails() { return array( ['fabien@symfony.com'], @@ -88,7 +88,7 @@ public function testInvalidEmails($email) $this->assertFalse($this->validator->isValid($email, $this->lexer)); } - public function getInvalidEmails() + public static function getInvalidEmails() { return [ ['test@example.com test'], @@ -161,7 +161,7 @@ public function testInvalidEmailsWithErrorsCheck($error, $email) $this->assertEquals($error, $this->validator->getError()); } - public function getInvalidEmailsWithErrors() + public static function getInvalidEmailsWithErrors() { return [ [new InvalidEmail(new NoDomainPart(), ''), 'example@'], @@ -203,7 +203,7 @@ public function testValidEmailsWithWarningsCheck($expectedWarnings, $email) } } - public function getValidEmailsWithWarnings() + public static function getValidEmailsWithWarnings() { return [ //Check if this is actually possible @@ -232,7 +232,7 @@ public function getValidEmailsWithWarnings() ]; } - public function invalidUTF16Chars() + public static function invalidUTF16Chars() { return [ ['example@symƒony.com'], diff --git a/tests/EmailValidator/Validation/RFCValidationTest.php b/tests/EmailValidator/Validation/RFCValidationTest.php index 7277b952..e75aaffc 100644 --- a/tests/EmailValidator/Validation/RFCValidationTest.php +++ b/tests/EmailValidator/Validation/RFCValidationTest.php @@ -54,7 +54,7 @@ public function testValidEmails($email) $this->assertTrue($this->validator->isValid($email, $this->lexer)); } - public function getValidEmails() + public static function getValidEmails() { return array( ['â@iana.org'], @@ -91,7 +91,7 @@ public function testValidEmailsWithWarningsCheck($email, $expectedWarnings) $this->assertEquals($expectedWarnings, $this->validator->getWarnings()); } - public function getValidEmailsWithWarnings() + public static function getValidEmailsWithWarnings() { return [ ['a5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@example.com', [new LocalTooLong()]], @@ -120,7 +120,7 @@ public function testInvalidEmails($email) $this->assertFalse($this->validator->isValid($email, $this->lexer)); } - public function getInvalidEmails() + public static function getInvalidEmails() { return [ ['user name@example.com'], @@ -164,7 +164,7 @@ public function testInvalidDEmailsWithErrorsCheck($error, $email) $this->assertEquals($error, $this->validator->getError()); } - public function getInvalidEmailsWithErrors() + public static function getInvalidEmailsWithErrors() { return [ [new InvalidEmail(new NoLocalPart(), "@"), '@example.co.uk'],