diff options
-rw-r--r-- | .github/workflows/lint.yml | 4 | ||||
-rw-r--r-- | .github/workflows/test.yml | 41 | ||||
-rw-r--r-- | appinfo/info.xml | 2 | ||||
-rw-r--r-- | composer.json | 2 | ||||
-rw-r--r-- | composer.lock | 12 | ||||
-rw-r--r-- | lib/Account.php | 5 | ||||
-rw-r--r-- | lib/Address.php | 7 | ||||
-rw-r--r-- | lib/AddressList.php | 5 | ||||
-rw-r--r-- | lib/Db/Alias.php | 4 | ||||
-rw-r--r-- | lib/Db/LocalAttachment.php | 2 | ||||
-rw-r--r-- | lib/Db/LocalMessage.php | 5 | ||||
-rw-r--r-- | lib/Db/Mailbox.php | 2 | ||||
-rw-r--r-- | lib/Db/Message.php | 2 | ||||
-rw-r--r-- | lib/Db/Provisioning.php | 5 | ||||
-rw-r--r-- | lib/Db/Recipient.php | 4 | ||||
-rw-r--r-- | lib/Db/Tag.php | 6 | ||||
-rw-r--r-- | lib/Db/TrustedSender.php | 2 | ||||
-rw-r--r-- | lib/IMAP/MailboxStats.php | 2 | ||||
-rw-r--r-- | lib/IMAP/Sync/Response.php | 4 | ||||
-rw-r--r-- | lib/IMAP/Threading/DatabaseMessage.php | 4 | ||||
-rw-r--r-- | lib/IMAP/Threading/Message.php | 4 | ||||
-rw-r--r-- | lib/Model/IMAPMessage.php | 7 | ||||
-rw-r--r-- | lib/Service/Avatar/Avatar.php | 7 | ||||
-rw-r--r-- | lib/Service/Quota.php | 2 | ||||
-rw-r--r-- | tests/phpunit.integration.xml | 12 | ||||
-rw-r--r-- | tests/phpunit.unit.xml | 12 |
26 files changed, 108 insertions, 56 deletions
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 91c309969..287a93430 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: [7.4, 8.0] + php-versions: ['7.4', '8.0', '8.1'] name: php${{ matrix.php-versions }} lint steps: - name: Checkout @@ -41,7 +41,7 @@ jobs: - name: Set up php uses: shivammathur/setup-php@master with: - php-version: 7.4 + php-version: '8.0' coverage: none - name: Install dependencies run: composer i diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 59051d6c3..e2b7d9738 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,16 +12,12 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: [7.4] + php-versions: ['8.0'] nextcloud-versions: ['stable22', 'stable23'] include: - php-versions: 7.4 nextcloud-versions: stable24 - - php-versions: 8.0 - nextcloud-versions: stable24 - - php-versions: 7.4 - nextcloud-versions: master - - php-versions: 8.0 + - php-versions: 8.1 nextcloud-versions: master name: Nextcloud ${{ matrix.nextcloud-versions }} php${{ matrix.php-versions }} unit tests steps: @@ -49,11 +45,18 @@ jobs: - name: Run tests working-directory: nextcloud/apps/mail run: composer run test:unit + if: ${{ matrix.php-versions == '8.0' }} env: XDEBUG_MODE: coverage + - name: Run tests + working-directory: nextcloud/apps/mail + run: composer run test:unit + if: ${{ matrix.php-versions != '8.0' }} + env: + XDEBUG_MODE: off - name: Report coverage uses: codecov/codecov-action@v3.1.0 - if: ${{ always() && matrix.nextcloud-versions == 'master' }} + if: ${{ always() && matrix.php-versions == '8.0' }} with: file: ./nextcloud/apps/mail/tests/clover.unit.xml flags: unittests @@ -63,9 +66,19 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: [7.4, 8.0] + php-versions: ['8.0'] nextcloud-versions: ['master'] db: ['sqlite', 'mysql', 'pgsql'] + include: + - php-versions: 7.4 + nextcloud-versions: stable22 + db: 'mysql' + - php-versions: 8.0 + nextcloud-versions: stable23 + db: 'mysql' + - php-versions: 8.1 + nextcloud-versions: stable24 + db: 'pgsql' name: php${{ matrix.php-versions }}-${{ matrix.db }} integration tests services: mail-service: @@ -138,12 +151,16 @@ jobs: echo "SET GLOBAL log_output = 'table';" | mysql -h 127.0.0.1 -u root -pmy-secret-pw - name: Run tests working-directory: nextcloud/apps/mail - run: | - ss -tunlp - true | openssl s_client -crlf -connect 127.0.0.1:993 - composer run test:integration + if: ${{ matrix.db == 'mysql' }} + run: composer run test:integration env: XDEBUG_MODE: coverage + - name: Run tests + working-directory: nextcloud/apps/mail + if: ${{ matrix.db != 'mysql' }} + run: composer run test:integration + env: + XDEBUG_MODE: off - name: Read slow queries if: ${{ always() }} run: echo "SELECT * FROM mysql.slow_log WHERE sql_text LIKE '%oc_mail%' AND sql_text NOT LIKE '%information_schema%'" | mysql -h 127.0.0.1 -u root -pmy-secret-pw diff --git a/appinfo/info.xml b/appinfo/info.xml index 7ff678d6a..45d5eec8d 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -29,7 +29,7 @@ <repository type="git">https://github.com/nextcloud/mail.git</repository> <screenshot>https://user-images.githubusercontent.com/1374172/79554966-278e1600-809f-11ea-82ea-7a0d72a2704f.png</screenshot> <dependencies> - <php min-version="7.4" max-version="8.0" /> + <php min-version="7.4" max-version="8.1" /> <nextcloud min-version="22" max-version="25" /> </dependencies> <background-jobs> diff --git a/composer.json b/composer.json index 673406446..ecb1a7898 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } }, "require": { - "php": ">=7.4", + "php": ">=7.4 <=8.1", "arthurhoaro/favicon": "^1.2", "bamarni/composer-bin-plugin": "^1.4", "bytestream/horde-exception": "^2.1", diff --git a/composer.lock b/composer.lock index ef2286086..605893992 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b1c307444d66ee5ad260eb0d712b61dc", + "content-hash": "bf60d7f2e2448119556c1841143408d3", "packages": [ { "name": "amphp/amp", @@ -367,12 +367,12 @@ }, "type": "library", "autoload": { - "files": [ - "src/functions.php" - ], "psr-4": { "Amp\\Serialization\\": "src" - } + }, + "files": [ + "src/functions.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3101,7 +3101,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.4" + "php": ">=7.4 <=8.1" }, "platform-dev": [], "platform-overrides": { diff --git a/lib/Account.php b/lib/Account.php index c6c3bb2f4..0d285331f 100644 --- a/lib/Account.php +++ b/lib/Account.php @@ -50,6 +50,7 @@ use OCA\Mail\Model\Message; use OCP\ICacheFactory; use OCP\IConfig; use OCP\Security\ICrypto; +use ReturnTypeWillChange; class Account implements JsonSerializable { @@ -189,9 +190,7 @@ class Account implements JsonSerializable { ); } - /** - * @return array - */ + #[ReturnTypeWillChange] public function jsonSerialize() { return $this->account->toJson(); } diff --git a/lib/Address.php b/lib/Address.php index 119659b27..abc93d75c 100644 --- a/lib/Address.php +++ b/lib/Address.php @@ -28,6 +28,7 @@ namespace OCA\Mail; use Horde_Mail_Rfc822_Address; use JsonSerializable; +use ReturnTypeWillChange; /** * @psalm-immutable @@ -99,10 +100,8 @@ class Address implements JsonSerializable { return $this->wrapped; } - /** - * @return array - */ - public function jsonSerialize(): array { + #[ReturnTypeWillChange] + public function jsonSerialize() { return [ 'label' => $this->getLabel(), 'email' => $this->getEmail(), diff --git a/lib/AddressList.php b/lib/AddressList.php index 389395eca..bb06242db 100644 --- a/lib/AddressList.php +++ b/lib/AddressList.php @@ -31,6 +31,7 @@ use Horde_Mail_Rfc822_Address; use Horde_Mail_Rfc822_List; use Horde_Mail_Rfc822_Object; use JsonSerializable; +use ReturnTypeWillChange; /** * @psalm-immutable @@ -95,9 +96,7 @@ class AddressList implements Countable, JsonSerializable { return $this->addresses[0]; } - /** - * @return array - */ + #[ReturnTypeWillChange] public function jsonSerialize() { return array_map(function (Address $address) { return $address->jsonSerialize(); diff --git a/lib/Db/Alias.php b/lib/Db/Alias.php index 812682678..76ff18aa6 100644 --- a/lib/Db/Alias.php +++ b/lib/Db/Alias.php @@ -25,6 +25,7 @@ namespace OCA\Mail\Db; use JsonSerializable; use OCP\AppFramework\Db\Entity; +use ReturnTypeWillChange; /** * @method void setAccountId(int $accountId) @@ -66,7 +67,8 @@ class Alias extends Entity implements JsonSerializable { return $this->getProvisioningId() !== null; } - public function jsonSerialize(): array { + #[ReturnTypeWillChange] + public function jsonSerialize() { return [ 'id' => $this->getId(), 'name' => $this->getName(), diff --git a/lib/Db/LocalAttachment.php b/lib/Db/LocalAttachment.php index 9b64bf855..20771cde1 100644 --- a/lib/Db/LocalAttachment.php +++ b/lib/Db/LocalAttachment.php @@ -26,6 +26,7 @@ namespace OCA\Mail\Db; use JsonSerializable; use OCP\AppFramework\Db\Entity; +use ReturnTypeWillChange; /** * @method string getUserId() @@ -56,6 +57,7 @@ class LocalAttachment extends Entity implements JsonSerializable { /** @var int|null */ protected $localMessageId; + #[ReturnTypeWillChange] public function jsonSerialize() { return [ 'id' => $this->id, diff --git a/lib/Db/LocalMessage.php b/lib/Db/LocalMessage.php index 5adf551a0..b555b890d 100644 --- a/lib/Db/LocalMessage.php +++ b/lib/Db/LocalMessage.php @@ -27,6 +27,7 @@ namespace OCA\Mail\Db; use JsonSerializable; use OCP\AppFramework\Db\Entity; +use ReturnTypeWillChange; use function array_filter; /** @@ -92,9 +93,7 @@ class LocalMessage extends Entity implements JsonSerializable { $this->addType('html', 'boolean'); } - /** - * @return array - */ + #[ReturnTypeWillChange] public function jsonSerialize() { return [ 'id' => $this->getId(), diff --git a/lib/Db/Mailbox.php b/lib/Db/Mailbox.php index 1df1c86a3..a0b78e2e9 100644 --- a/lib/Db/Mailbox.php +++ b/lib/Db/Mailbox.php @@ -28,6 +28,7 @@ namespace OCA\Mail\Db; use JsonSerializable; use OCA\Mail\IMAP\MailboxStats; use OCP\AppFramework\Db\Entity; +use ReturnTypeWillChange; use function base64_encode; use function in_array; use function json_decode; @@ -146,6 +147,7 @@ class Mailbox extends Entity implements JsonSerializable { return new MailboxStats($this->getMessages(), $this->getUnseen()); } + #[ReturnTypeWillChange] public function jsonSerialize() { $specialUse = $this->getSpecialUseParsed(); return [ diff --git a/lib/Db/Message.php b/lib/Db/Message.php index e989f21f1..5eb1c5141 100644 --- a/lib/Db/Message.php +++ b/lib/Db/Message.php @@ -29,6 +29,7 @@ use Horde_Mail_Rfc822_Identification; use JsonSerializable; use OCA\Mail\AddressList; use OCP\AppFramework\Db\Entity; +use ReturnTypeWillChange; use function in_array; use function json_decode; use function json_encode; @@ -274,6 +275,7 @@ class Message extends Entity implements JsonSerializable { } } + #[ReturnTypeWillChange] public function jsonSerialize() { $tags = $this->getTags(); $indexed = array_combine( diff --git a/lib/Db/Provisioning.php b/lib/Db/Provisioning.php index b29afa91c..20eec71c5 100644 --- a/lib/Db/Provisioning.php +++ b/lib/Db/Provisioning.php @@ -28,6 +28,7 @@ namespace OCA\Mail\Db; use JsonSerializable; use OCP\AppFramework\Db\Entity; use OCP\IUser; +use ReturnTypeWillChange; /** * @method string getProvisioningDomain() @@ -97,9 +98,7 @@ class Provisioning extends Entity implements JsonSerializable { $this->addType('ldapAliasesProvisioning', 'boolean'); } - /** - * @return array - */ + #[ReturnTypeWillChange] public function jsonSerialize() { return [ 'id' => $this->getId(), diff --git a/lib/Db/Recipient.php b/lib/Db/Recipient.php index 5bfb276f8..14d46462e 100644 --- a/lib/Db/Recipient.php +++ b/lib/Db/Recipient.php @@ -28,6 +28,7 @@ namespace OCA\Mail\Db; use JsonSerializable; use OCP\AppFramework\Db\Entity; +use ReturnTypeWillChange; /** * @method int|null getMessageId() @@ -72,7 +73,8 @@ class Recipient extends Entity implements JsonSerializable { $this->addType('mailboxType', 'integer'); } - public function jsonSerialize(): array { + #[ReturnTypeWillChange] + public function jsonSerialize() { return [ 'id' => $this->getId(), 'messageId' => $this->getMessageId(), diff --git a/lib/Db/Tag.php b/lib/Db/Tag.php index fd32160f4..5a064d1a7 100644 --- a/lib/Db/Tag.php +++ b/lib/Db/Tag.php @@ -27,6 +27,7 @@ namespace OCA\Mail\Db; use JsonSerializable; use OCP\AppFramework\Db\Entity; +use ReturnTypeWillChange; /** * @method string getUserId() @@ -56,9 +57,8 @@ class Tag extends Entity implements JsonSerializable { public function __construct() { $this->addType('isDefaultTag', 'boolean'); } - /** - * @return array - */ + + #[ReturnTypeWillChange] public function jsonSerialize() { return [ 'id' => $this->getId(), diff --git a/lib/Db/TrustedSender.php b/lib/Db/TrustedSender.php index 3425c056a..3816b3fa0 100644 --- a/lib/Db/TrustedSender.php +++ b/lib/Db/TrustedSender.php @@ -27,6 +27,7 @@ namespace OCA\Mail\Db; use JsonSerializable; use OCP\AppFramework\Db\Entity; +use ReturnTypeWillChange; /** * @method setEmail(string $email): void @@ -47,6 +48,7 @@ class TrustedSender extends Entity implements JsonSerializable { /** @var string */ protected $type; + #[ReturnTypeWillChange] public function jsonSerialize() { return [ 'id' => $this->id, diff --git a/lib/IMAP/MailboxStats.php b/lib/IMAP/MailboxStats.php index 9af3c0452..0f66e2b48 100644 --- a/lib/IMAP/MailboxStats.php +++ b/lib/IMAP/MailboxStats.php @@ -27,6 +27,7 @@ declare(strict_types=1); namespace OCA\Mail\IMAP; use JsonSerializable; +use ReturnTypeWillChange; class MailboxStats implements JsonSerializable { @@ -55,6 +56,7 @@ class MailboxStats implements JsonSerializable { return $this->unread; } + #[ReturnTypeWillChange] public function jsonSerialize() { return [ 'total' => $this->total, diff --git a/lib/IMAP/Sync/Response.php b/lib/IMAP/Sync/Response.php index a1e47675b..271d81395 100644 --- a/lib/IMAP/Sync/Response.php +++ b/lib/IMAP/Sync/Response.php @@ -25,6 +25,7 @@ namespace OCA\Mail\IMAP\Sync; use JsonSerializable; use OCA\Mail\IMAP\MailboxStats; +use ReturnTypeWillChange; /** * @psalm-template T @@ -87,7 +88,8 @@ class Response implements JsonSerializable { return $this->stats; } - public function jsonSerialize(): array { + #[ReturnTypeWillChange] + public function jsonSerialize() { return [ 'newMessages' => $this->newMessages, 'changedMessages' => $this->changedMessages, diff --git a/lib/IMAP/Threading/DatabaseMessage.php b/lib/IMAP/Threading/DatabaseMessage.php index da79522ce..e158ac7cc 100644 --- a/lib/IMAP/Threading/DatabaseMessage.php +++ b/lib/IMAP/Threading/DatabaseMessage.php @@ -26,6 +26,7 @@ declare(strict_types=1); namespace OCA\Mail\IMAP\Threading; use JsonSerializable; +use ReturnTypeWillChange; use function array_map; use function array_merge; use function json_decode; @@ -104,7 +105,8 @@ class DatabaseMessage extends Message implements JsonSerializable { ); } - public function jsonSerialize(): array { + #[ReturnTypeWillChange] + public function jsonSerialize() { return array_merge( parent::jsonSerialize(), [ diff --git a/lib/IMAP/Threading/Message.php b/lib/IMAP/Threading/Message.php index 8fd7170ae..896606932 100644 --- a/lib/IMAP/Threading/Message.php +++ b/lib/IMAP/Threading/Message.php @@ -26,6 +26,7 @@ declare(strict_types=1); namespace OCA\Mail\IMAP\Threading; use JsonSerializable; +use ReturnTypeWillChange; use function str_replace; use function strpos; @@ -74,7 +75,8 @@ class Message implements JsonSerializable { return $this->references; } - public function jsonSerialize(): array { + #[ReturnTypeWillChange] + public function jsonSerialize() { return [ 'subject' => $this->subject, 'id' => $this->id, diff --git a/lib/Model/IMAPMessage.php b/lib/Model/IMAPMessage.php index 67dac0237..bc229c124 100644 --- a/lib/Model/IMAPMessage.php +++ b/lib/Model/IMAPMessage.php @@ -52,6 +52,7 @@ use OCA\Mail\Service\Html; use OCP\AppFramework\Db\DoesNotExistException; use OCP\Files\File; use OCP\Files\SimpleFS\ISimpleFile; +use ReturnTypeWillChange; use function fclose; use function in_array; use function mb_convert_encoding; @@ -494,10 +495,8 @@ class IMAPMessage implements IMessage, JsonSerializable { return $data; } - /** - * @return array - */ - public function jsonSerialize(): array { + #[ReturnTypeWillChange] + public function jsonSerialize() { return [ 'uid' => $this->getUid(), 'messageId' => $this->getMessageId(), diff --git a/lib/Service/Avatar/Avatar.php b/lib/Service/Avatar/Avatar.php index c8e11ff00..fafcbcc26 100644 --- a/lib/Service/Avatar/Avatar.php +++ b/lib/Service/Avatar/Avatar.php @@ -27,6 +27,7 @@ declare(strict_types=1); namespace OCA\Mail\Service\Avatar; use JsonSerializable; +use ReturnTypeWillChange; /** * @psalm-immutable @@ -76,10 +77,8 @@ class Avatar implements JsonSerializable { return $this->isExternal; } - /** - * @return array - */ - public function jsonSerialize(): array { + #[ReturnTypeWillChange] + public function jsonSerialize() { return [ 'isExternal' => $this->isExternal, 'mime' => $this->mime, diff --git a/lib/Service/Quota.php b/lib/Service/Quota.php index 2f23aa750..130cf6a85 100644 --- a/lib/Service/Quota.php +++ b/lib/Service/Quota.php @@ -26,6 +26,7 @@ declare(strict_types=1); namespace OCA\Mail\Service; use JsonSerializable; +use ReturnTypeWillChange; class Quota implements JsonSerializable { @@ -49,6 +50,7 @@ class Quota implements JsonSerializable { return $this->limit; } + #[ReturnTypeWillChange] public function jsonSerialize() { return [ 'usage' => $this->getUsage(), diff --git a/tests/phpunit.integration.xml b/tests/phpunit.integration.xml index 507e2e936..8fead6170 100644 --- a/tests/phpunit.integration.xml +++ b/tests/phpunit.integration.xml @@ -19,7 +19,17 @@ ~ You should have received a copy of the GNU Affero General Public License ~ along with this program. If not, see <http://www.gnu.org/licenses/>. --> -<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="bootstrap.php" verbose="true" timeoutForSmallTests="900" timeoutForMediumTests="900" timeoutForLargeTests="900" cacheResult="true" convertDeprecationsToExceptions="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> +<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + bootstrap="bootstrap.php" + verbose="true" + timeoutForSmallTests="900" + timeoutForMediumTests="900" + timeoutForLargeTests="900" + convertErrorsToExceptions="true" + convertNoticesToExceptions="true" + convertWarningsToExceptions="true" + cacheResult="true" + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> <coverage> <include> <directory suffix=".php">../lib</directory> diff --git a/tests/phpunit.unit.xml b/tests/phpunit.unit.xml index a35b99f33..a8ad8445f 100644 --- a/tests/phpunit.unit.xml +++ b/tests/phpunit.unit.xml @@ -1,5 +1,15 @@ <?xml version="1.0" encoding="utf-8"?> -<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="bootstrap.php" verbose="true" timeoutForSmallTests="900" timeoutForMediumTests="900" timeoutForLargeTests="900" cacheResult="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> +<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + bootstrap="bootstrap.php" + verbose="true" + timeoutForSmallTests="900" + timeoutForMediumTests="900" + timeoutForLargeTests="900" + convertErrorsToExceptions="true" + convertNoticesToExceptions="true" + convertWarningsToExceptions="true" + cacheResult="true" + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> <coverage> <include> <directory suffix=".php">../lib</directory> |