diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c444903c..910b7846 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,7 +16,7 @@ jobs: strategy: matrix: php-version: - - "8.2" + - "8.3" steps: - uses: "actions/checkout@v4" @@ -39,11 +39,11 @@ jobs: strategy: matrix: php-version: - - "8.3" + - "8.4" code-coverage: - "none" include: - - php-version: "8.2" + - php-version: "8.3" code-coverage: "pcov" env: @@ -62,6 +62,8 @@ jobs: ini-values: "${{ env.INI_VALUES }}" extensions: "imap" - uses: "ramsey/composer-install@v3" + with: + composer-options: "--ignore-platform-req=php" - run: "sh .github/dovecot_install.sh" @@ -89,7 +91,7 @@ jobs: strategy: matrix: php-version: - - "8.2" + - "8.3" steps: - uses: "actions/checkout@v4" @@ -108,7 +110,7 @@ jobs: strategy: matrix: php-version: - - "8.2" + - "8.3" steps: - uses: "actions/checkout@v4" diff --git a/Makefile b/Makefile index a1f3eac4..7dda65a6 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PHP_DOCKER_VERSION := thecodingmachine/php:8.2-v4-cli +PHP_DOCKER_VERSION := thecodingmachine/php:8.3-v4-cli PHP_BIN := docker run -it --rm \ --network=ddeboer_imap_network \ --env IMAP_SERVER_NAME=ddeboer_imap_server \ diff --git a/README.md b/README.md index 8fea9782..123eaefe 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ A PHP IMAP library to read and process e-mails over IMAP protocol, built with robust Object-Oriented architecture. -This library requires PHP >= 8.2 with [IMAP](https://www.php.net/manual/en/book.imap.php), +This library requires PHP >= 8.3 with [IMAP](https://www.php.net/manual/en/book.imap.php), [iconv](https://www.php.net/manual/en/book.iconv.php) and [Multibyte String](https://www.php.net/manual/en/book.mbstring.php) extensions installed. diff --git a/composer.json b/composer.json index bb7e900c..595db751 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ } ], "require": { - "php": "~8.2.0 || ~8.3.0", + "php": "~8.3.0 || ~8.4.0", "ext-dom": "*", "ext-iconv": "*", "ext-imap": "*", @@ -30,12 +30,12 @@ "ext-mbstring": "*" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.50.0", + "friendsofphp/php-cs-fixer": "^3.64.0", "laminas/laminas-mail": "^2.25.1", - "phpstan/phpstan": "^1.10.59", - "phpstan/phpstan-phpunit": "^1.3.16", - "phpstan/phpstan-strict-rules": "^1.5.2", - "phpunit/phpunit": "^11.0.3" + "phpstan/phpstan": "^1.12.4", + "phpstan/phpstan-phpunit": "^1.4.0", + "phpstan/phpstan-strict-rules": "^1.6.1", + "phpunit/phpunit": "^11.3.6" }, "autoload": { "psr-4": { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index e6615747..730e3706 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -119,3 +119,13 @@ parameters: message: "#^Cannot access property \\$parts on mixed\\.$#" count: 2 path: tests/MessageTest.php + + - + message: "#^Parameter \\#2 \\$array of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertArrayHasKey\\(\\) expects array\\|ArrayAccess\\<\\(int\\|string\\), mixed\\>, Ddeboer\\\\Imap\\\\Message\\\\Headers given\\.$#" + count: 3 + path: tests/MessageTest.php + + - + message: "#^Parameter \\#2 \\$array of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertArrayNotHasKey\\(\\) expects array\\|ArrayAccess\\<\\(int\\|string\\), mixed\\>, Ddeboer\\\\Imap\\\\Message\\\\Headers given\\.$#" + count: 2 + path: tests/MessageTest.php diff --git a/src/Exception/MessageDeleteException.php b/src/Exception/MessageDeleteException.php deleted file mode 100644 index 38d88ff9..00000000 --- a/src/Exception/MessageDeleteException.php +++ /dev/null @@ -1,9 +0,0 @@ -clearHeaders(); - if (!\imap_delete($this->resource->getStream(), (string) $this->getNumber(), \FT_UID)) { - throw new MessageDeleteException(\sprintf('Message "%s" cannot be deleted', $this->getNumber())); - } + \imap_delete($this->resource->getStream(), (string) $this->getNumber(), \FT_UID); } public function undelete(): void { // 'deleted' header changed, force to reload headers, would be better to set deleted flag to false on header $this->clearHeaders(); - if (!\imap_undelete($this->resource->getStream(), (string) $this->getNumber(), \FT_UID)) { - throw new MessageUndeleteException(\sprintf('Message "%s" cannot be undeleted', $this->getNumber())); - } + + \imap_undelete($this->resource->getStream(), (string) $this->getNumber(), \FT_UID); } public function setFlag(string $flag): bool diff --git a/src/Message/AbstractPart.php b/src/Message/AbstractPart.php index 3adba507..703f88b2 100644 --- a/src/Message/AbstractPart.php +++ b/src/Message/AbstractPart.php @@ -74,7 +74,7 @@ public function __construct( ImapResourceInterface $resource, int $messageNumber, string $partNumber, - \stdClass $structure + \stdClass $structure, ) { $this->resource = $resource; $this->messageNumber = $messageNumber; diff --git a/src/MessageInterface.php b/src/MessageInterface.php index e8fe5f76..bae1b17f 100644 --- a/src/MessageInterface.php +++ b/src/MessageInterface.php @@ -5,9 +5,7 @@ namespace Ddeboer\Imap; use Ddeboer\Imap\Exception\MessageCopyException; -use Ddeboer\Imap\Exception\MessageDeleteException; use Ddeboer\Imap\Exception\MessageMoveException; -use Ddeboer\Imap\Exception\MessageUndeleteException; /** * An IMAP message (e-mail). @@ -82,15 +80,11 @@ public function move(MailboxInterface $mailbox): void; /** * Delete message. - * - * @throws MessageDeleteException */ public function delete(): void; /** * Undelete message. - * - * @throws MessageUndeleteException */ public function undelete(): void; diff --git a/src/Server.php b/src/Server.php index 8a5a1b8f..29d5d600 100644 --- a/src/Server.php +++ b/src/Server.php @@ -39,7 +39,7 @@ public function __construct( string $flags = '/imap/ssl/validate-cert', array $parameters = [], int $options = 0, - int $retries = 1 + int $retries = 1, ) { if (!\function_exists('imap_open')) { throw new \RuntimeException('IMAP extension must be enabled'); diff --git a/tests/AbstractTestCase.php b/tests/AbstractTestCase.php index 074c7643..3bc73086 100644 --- a/tests/AbstractTestCase.php +++ b/tests/AbstractTestCase.php @@ -52,7 +52,7 @@ final protected function createTestMessage( ?string $contents = null, ?string $encoding = null, ?string $charset = null, - ?string $overwriteCharset = null + ?string $overwriteCharset = null, ): void { $bodyPart = new Mime\Part($contents ?? \uniqid($subject)); $bodyPart->setType(Mime\Mime::TYPE_TEXT);