From 507c75a7d2d25ad81ff813456531afa2acdcb469 Mon Sep 17 00:00:00 2001 From: Bruce Wells Date: Thu, 17 Aug 2023 16:01:53 -0400 Subject: [PATCH 1/2] PHPCSFIxer: update to V3.23 --- PhpCsFixer.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PhpCsFixer.php b/PhpCsFixer.php index e50688ed..a9a19cc9 100644 --- a/PhpCsFixer.php +++ b/PhpCsFixer.php @@ -70,7 +70,7 @@ // Replace core functions calls returning constants with the constants. 'function_to_constant' => true, // Ensure single space between function's argument and its typehint. - 'function_typehint_space' => true, + 'type_declaration_spaces' => true, // Renames PHPDoc tags. 'general_phpdoc_tag_rename' => true, // Function `implode` must be called with 2 arguments in the documented order. @@ -149,8 +149,6 @@ 'no_short_bool_cast' => true, // When making a method or function call, there MUST NOT be a space between the method or function name and the opening parenthesis. 'no_spaces_after_function_name' => true, - // There MUST NOT be a space after the opening parenthesis. There MUST NOT be a space before the closing parenthesis. - 'no_spaces_inside_parenthesis' => true, // Removes `@param`, `@return` and `@var` tags that don't provide any useful information. 'no_superfluous_phpdoc_tags' => true, // Remove trailing whitespace at the end of non-blank lines. @@ -230,7 +228,7 @@ // A PHP file without end tag must always end with a single empty line feed. 'single_blank_line_at_eof' => true, // There should be exactly one blank line before a namespace declaration. - 'single_blank_line_before_namespace' => true, + 'blank_lines_before_namespace' => ['max_line_breaks' => 2, 'min_line_breaks' => 2], // There MUST NOT be more than one property or constant declared per statement. 'single_class_element_per_statement' => true, // There MUST be one use keyword per declaration. @@ -243,6 +241,8 @@ 'single_quote' => true, // Each trait `use` must be done as single statement. 'single_trait_insert_per_statement' => true, + // There MUST NOT be a space after the opening parenthesis. There MUST NOT be a space before the closing parenthesis. + 'spaces_inside_parentheses' => true, // Replace all `<>` with `!=`. 'standardize_not_equals' => true, // Lambdas not (indirect) referencing `$this` must be declared `static`. From d640cdeebf908e67c72f9e578d6d07d83e643fce Mon Sep 17 00:00:00 2001 From: Bruce Wells Date: Thu, 17 Aug 2023 16:08:00 -0400 Subject: [PATCH 2/2] Run PHPCSFixer --- src/Message/IMimePart.php | 1 - src/Message/PartHeaderContainer.php | 6 ------ .../MailMimeParser/Header/Consumer/ReceivedConsumerTest.php | 2 +- .../MailMimeParser/IntegrationTests/EmailFunctionalTest.php | 4 ++-- tests/MailMimeParser/Parser/MimeParserTest.php | 2 +- 5 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/Message/IMimePart.php b/src/Message/IMimePart.php index 6642878e..ce5fdc49 100644 --- a/src/Message/IMimePart.php +++ b/src/Message/IMimePart.php @@ -90,7 +90,6 @@ public function getHeader($name, $offset = 0); * @see IMimePart::getRawHeaderIterator() to retrieve an iterator traversing * a two-dimensional string[] array of raw headers. * @param string $name The name of the header to retrieve. - * @param * @param int $offset Optional offset if there are multiple headers with the * given name. * @return ?IHeader the header object diff --git a/src/Message/PartHeaderContainer.php b/src/Message/PartHeaderContainer.php index d9173890..41ad93ed 100644 --- a/src/Message/PartHeaderContainer.php +++ b/src/Message/PartHeaderContainer.php @@ -117,8 +117,6 @@ private function getAllWithOriginalHeaderNameIfSet(string $name) : ?array * * Note that mime headers aren't case sensitive. * - * @param string $name - * @param int $offset * @return \ZBateson\MailMimeParser\Header\IHeader|null */ public function get(string $name, int $offset = 0) @@ -139,9 +137,6 @@ public function get(string $name, int $offset = 0) * * Note that mime headers aren't case sensitive. * - * @param string $name - * @param string $iHeaderClass - * @param int $offset * @return ?IHeader */ public function getAs(string $name, string $iHeaderClass, int $offset = 0) : ?IHeader @@ -196,7 +191,6 @@ private function getByIndex(int $index) * index or null if one doesn't exist, using the passed $iHeaderClass to * construct it. * - * @return \ZBateson\MailMimeParser\Header\IHeader|null */ private function getByIndexAs(int $index, string $iHeaderClass) : ?IHeader { diff --git a/tests/MailMimeParser/Header/Consumer/ReceivedConsumerTest.php b/tests/MailMimeParser/Header/Consumer/ReceivedConsumerTest.php index 06f0165e..9dcd7bee 100644 --- a/tests/MailMimeParser/Header/Consumer/ReceivedConsumerTest.php +++ b/tests/MailMimeParser/Header/Consumer/ReceivedConsumerTest.php @@ -188,7 +188,7 @@ public function testExampleFullLine2() : void { $value = "from xcv.gurbuzsrc.com ([69.69.69.69])\nby mail.yetiforce.com with esmtp (Exim 4.94)\n" . "(envelope-from )\nid 1kfCyx-0002Zp-BY\n" - . "for vbc@yetiforce.com; Wed, 18 Nov 2020 03:14:03 +0100"; + . 'for vbc@yetiforce.com; Wed, 18 Nov 2020 03:14:03 +0100'; $ret = $this->receivedConsumer->__invoke($value); $this->assertNotEmpty($ret); diff --git a/tests/MailMimeParser/IntegrationTests/EmailFunctionalTest.php b/tests/MailMimeParser/IntegrationTests/EmailFunctionalTest.php index b4c7a437..c1a66a76 100644 --- a/tests/MailMimeParser/IntegrationTests/EmailFunctionalTest.php +++ b/tests/MailMimeParser/IntegrationTests/EmailFunctionalTest.php @@ -241,7 +241,7 @@ private function getSignatureForContent($signableContent) : string \proc_close($proc); return \preg_replace('/\r|\n/', '', $signature); } - + return \md5($signableContent); } @@ -2722,7 +2722,7 @@ public function testCreateSignedPartm4009() : void \file_put_contents(\dirname(__DIR__, 2) . '/' . TEST_OUTPUT_DIR . '/sigpart_m4009', $signableContent); // $signature = $this->getSignatureForContent($signableContent); - $signature = md5($signableContent); + $signature = \md5($signableContent); $this->assertEquals('10fd4349160a214f3d1f7dfd1aa4ca05', $signature); $message->setSignature($signature); diff --git a/tests/MailMimeParser/Parser/MimeParserTest.php b/tests/MailMimeParser/Parser/MimeParserTest.php index 26e9e021..4bc19009 100644 --- a/tests/MailMimeParser/Parser/MimeParserTest.php +++ b/tests/MailMimeParser/Parser/MimeParserTest.php @@ -232,7 +232,7 @@ public function testParseContentLinesWithBoundary() : void public function testParseEmptyContentWithBoundaryAndStartingLineEndingLength() : void { - $str = "--boundary"; + $str = '--boundary'; $handle = StreamWrapper::getResource(Utils::streamFor($str)); $this->parserPartProxy->expects($this->once()) ->method('getMessageResourceHandlePos')