Skip to content

Commit

Permalink
Add PHP8.1 support
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst committed May 23, 2022
1 parent 28d6109 commit b2d3c89
Show file tree
Hide file tree
Showing 27 changed files with 109 additions and 56 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
41 changes: 29 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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/[email protected]
if: ${{ always() && matrix.nextcloud-versions == 'master' }}
if: ${{ always() && matrix.php-versions == '8.0' }}
with:
file: ./nextcloud/apps/mail/tests/clover.unit.xml
flags: unittests
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions lib/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\Security\ICrypto;
use ReturnTypeWillChange;

class Account implements JsonSerializable {

Expand Down Expand Up @@ -189,9 +190,7 @@ public function getMailbox($folderId) {
);
}

/**
* @return array
*/
#[ReturnTypeWillChange]
public function jsonSerialize() {
return $this->account->toJson();
}
Expand Down
7 changes: 3 additions & 4 deletions lib/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

use Horde_Mail_Rfc822_Address;
use JsonSerializable;
use ReturnTypeWillChange;

/**
* @psalm-immutable
Expand Down Expand Up @@ -99,10 +100,8 @@ public function toHorde(): Horde_Mail_Rfc822_Address {
return $this->wrapped;
}

/**
* @return array
*/
public function jsonSerialize(): array {
#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'label' => $this->getLabel(),
'email' => $this->getEmail(),
Expand Down
5 changes: 2 additions & 3 deletions lib/AddressList.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use Horde_Mail_Rfc822_List;
use Horde_Mail_Rfc822_Object;
use JsonSerializable;
use ReturnTypeWillChange;

/**
* @psalm-immutable
Expand Down Expand Up @@ -95,9 +96,7 @@ public function first() {
return $this->addresses[0];
}

/**
* @return array
*/
#[ReturnTypeWillChange]
public function jsonSerialize() {
return array_map(function (Address $address) {
return $address->jsonSerialize();
Expand Down
4 changes: 3 additions & 1 deletion lib/Db/Alias.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

use JsonSerializable;
use OCP\AppFramework\Db\Entity;
use ReturnTypeWillChange;

/**
* @method void setAccountId(int $accountId)
Expand Down Expand Up @@ -66,7 +67,8 @@ public function isProvisioned(): bool {
return $this->getProvisioningId() !== null;
}

public function jsonSerialize(): array {
#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'id' => $this->getId(),
'name' => $this->getName(),
Expand Down
2 changes: 2 additions & 0 deletions lib/Db/LocalAttachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

use JsonSerializable;
use OCP\AppFramework\Db\Entity;
use ReturnTypeWillChange;

/**
* @method string getUserId()
Expand Down Expand Up @@ -56,6 +57,7 @@ class LocalAttachment extends Entity implements JsonSerializable {
/** @var int|null */
protected $localMessageId;

#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'id' => $this->id,
Expand Down
5 changes: 2 additions & 3 deletions lib/Db/LocalMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

use JsonSerializable;
use OCP\AppFramework\Db\Entity;
use ReturnTypeWillChange;
use function array_filter;

/**
Expand Down Expand Up @@ -92,9 +93,7 @@ public function __construct() {
$this->addType('html', 'boolean');
}

/**
* @return array
*/
#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'id' => $this->getId(),
Expand Down
2 changes: 2 additions & 0 deletions lib/Db/Mailbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
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;
Expand Down Expand Up @@ -146,6 +147,7 @@ public function getStats(): MailboxStats {
return new MailboxStats($this->getMessages(), $this->getUnseen());
}

#[ReturnTypeWillChange]
public function jsonSerialize() {
$specialUse = $this->getSpecialUseParsed();
return [
Expand Down
2 changes: 2 additions & 0 deletions lib/Db/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
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;
Expand Down Expand Up @@ -274,6 +275,7 @@ public function setFlag(string $flag, bool $value = true) {
}
}

#[ReturnTypeWillChange]
public function jsonSerialize() {
$tags = $this->getTags();
$indexed = array_combine(
Expand Down
5 changes: 2 additions & 3 deletions lib/Db/Provisioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use JsonSerializable;
use OCP\AppFramework\Db\Entity;
use OCP\IUser;
use ReturnTypeWillChange;

/**
* @method string getProvisioningDomain()
Expand Down Expand Up @@ -97,9 +98,7 @@ public function __construct() {
$this->addType('ldapAliasesProvisioning', 'boolean');
}

/**
* @return array
*/
#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'id' => $this->getId(),
Expand Down
4 changes: 3 additions & 1 deletion lib/Db/Recipient.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

use JsonSerializable;
use OCP\AppFramework\Db\Entity;
use ReturnTypeWillChange;

/**
* @method int|null getMessageId()
Expand Down Expand Up @@ -72,7 +73,8 @@ public function __construct() {
$this->addType('mailboxType', 'integer');
}

public function jsonSerialize(): array {
#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'id' => $this->getId(),
'messageId' => $this->getMessageId(),
Expand Down
6 changes: 3 additions & 3 deletions lib/Db/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

use JsonSerializable;
use OCP\AppFramework\Db\Entity;
use ReturnTypeWillChange;

/**
* @method string getUserId()
Expand Down Expand Up @@ -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(),
Expand Down
2 changes: 2 additions & 0 deletions lib/Db/TrustedSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

use JsonSerializable;
use OCP\AppFramework\Db\Entity;
use ReturnTypeWillChange;

/**
* @method setEmail(string $email): void
Expand All @@ -47,6 +48,7 @@ class TrustedSender extends Entity implements JsonSerializable {
/** @var string */
protected $type;

#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'id' => $this->id,
Expand Down
2 changes: 2 additions & 0 deletions lib/IMAP/MailboxStats.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
namespace OCA\Mail\IMAP;

use JsonSerializable;
use ReturnTypeWillChange;

class MailboxStats implements JsonSerializable {

Expand Down Expand Up @@ -55,6 +56,7 @@ public function getUnread(): int {
return $this->unread;
}

#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'total' => $this->total,
Expand Down
Loading

0 comments on commit b2d3c89

Please sign in to comment.