Update to PHP 7.4

This commit is contained in:
Lexi / Zoe 2021-09-12 21:33:35 +02:00
parent 36b8cfe8b1
commit 87928dbbc9
Signed by: binaryDiv
GPG Key ID: F8D4956E224DA232
16 changed files with 99 additions and 147 deletions

View File

@ -15,7 +15,7 @@ steps:
- composer install --no-progress --no-interaction - composer install --no-progress --no-interaction
- name: run unit tests - name: run unit tests
image: php:7.3 image: php:7.4
commands: commands:
- vendor/bin/phpunit -c phpunit.xml - vendor/bin/phpunit -c phpunit.xml

View File

@ -1,4 +1,4 @@
FROM php:7.3-apache AS base FROM php:7.4-apache AS base
WORKDIR /var/www WORKDIR /var/www

View File

@ -12,7 +12,7 @@
"optimize-autoloader": true "optimize-autoloader": true
}, },
"require": { "require": {
"php": "^7.3", "php": "^7.4",
"ext-pdo": "*", "ext-pdo": "*",
"slim/slim": "^4.8", "slim/slim": "^4.8",
"slim/psr7": "^1.3", "slim/psr7": "^1.3",

100
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "7ca706ba3c651a07e10e76b10597de60", "content-hash": "7f17e8a8ee73f9262b6c16738ada898d",
"packages": [ "packages": [
{ {
"name": "fig/http-message-util", "name": "fig/http-message-util",
@ -179,21 +179,21 @@
}, },
{ {
"name": "php-di/invoker", "name": "php-di/invoker",
"version": "2.3.0", "version": "2.3.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHP-DI/Invoker.git", "url": "https://github.com/PHP-DI/Invoker.git",
"reference": "992fec6c56f2d1ad1ad5fee28267867c85bfb8f9" "reference": "5214cbe5aad066022cd845dbf313f0e47aed928f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHP-DI/Invoker/zipball/992fec6c56f2d1ad1ad5fee28267867c85bfb8f9", "url": "https://api.github.com/repos/PHP-DI/Invoker/zipball/5214cbe5aad066022cd845dbf313f0e47aed928f",
"reference": "992fec6c56f2d1ad1ad5fee28267867c85bfb8f9", "reference": "5214cbe5aad066022cd845dbf313f0e47aed928f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.3", "php": ">=7.3",
"psr/container": "~1.0" "psr/container": "^1.0|^2.0"
}, },
"require-dev": { "require-dev": {
"athletic/athletic": "~0.1.8", "athletic/athletic": "~0.1.8",
@ -222,7 +222,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/PHP-DI/Invoker/issues", "issues": "https://github.com/PHP-DI/Invoker/issues",
"source": "https://github.com/PHP-DI/Invoker/tree/2.3.0" "source": "https://github.com/PHP-DI/Invoker/tree/2.3.2"
}, },
"funding": [ "funding": [
{ {
@ -230,20 +230,20 @@
"type": "github" "type": "github"
} }
], ],
"time": "2021-01-15T10:25:40+00:00" "time": "2021-07-30T15:05:32+00:00"
}, },
{ {
"name": "php-di/php-di", "name": "php-di/php-di",
"version": "6.3.4", "version": "6.3.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHP-DI/PHP-DI.git", "url": "https://github.com/PHP-DI/PHP-DI.git",
"reference": "f53bcba06ab31b18e911b77c039377f4ccd1f7a5" "reference": "b8126d066ce144765300ee0ab040c1ed6c9ef588"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/f53bcba06ab31b18e911b77c039377f4ccd1f7a5", "url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/b8126d066ce144765300ee0ab040c1ed6c9ef588",
"reference": "f53bcba06ab31b18e911b77c039377f4ccd1f7a5", "reference": "b8126d066ce144765300ee0ab040c1ed6c9ef588",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -294,7 +294,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/PHP-DI/PHP-DI/issues", "issues": "https://github.com/PHP-DI/PHP-DI/issues",
"source": "https://github.com/PHP-DI/PHP-DI/tree/6.3.4" "source": "https://github.com/PHP-DI/PHP-DI/tree/6.3.5"
}, },
"funding": [ "funding": [
{ {
@ -306,7 +306,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-06-10T08:04:48+00:00" "time": "2021-09-02T09:49:58+00:00"
}, },
{ {
"name": "php-di/phpdoc-reader", "name": "php-di/phpdoc-reader",
@ -1054,16 +1054,16 @@
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
"version": "v1.23.0", "version": "v1.23.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "2df51500adbaebdc4c38dea4c89a2e131c45c8a1" "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2df51500adbaebdc4c38dea4c89a2e131c45c8a1", "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6",
"reference": "2df51500adbaebdc4c38dea4c89a2e131c45c8a1", "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1114,7 +1114,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.0" "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1"
}, },
"funding": [ "funding": [
{ {
@ -1130,20 +1130,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-05-27T09:27:20+00:00" "time": "2021-05-27T12:26:48+00:00"
}, },
{ {
"name": "symfony/polyfill-php80", "name": "symfony/polyfill-php80",
"version": "v1.23.0", "version": "v1.23.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-php80.git", "url": "https://github.com/symfony/polyfill-php80.git",
"reference": "eca0bf41ed421bed1b57c4958bab16aa86b757d0" "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/eca0bf41ed421bed1b57c4958bab16aa86b757d0", "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be",
"reference": "eca0bf41ed421bed1b57c4958bab16aa86b757d0", "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1197,7 +1197,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.23.0" "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1"
}, },
"funding": [ "funding": [
{ {
@ -1213,7 +1213,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-02-19T12:13:01+00:00" "time": "2021-07-28T13:41:28+00:00"
}, },
{ {
"name": "twig/twig", "name": "twig/twig",
@ -1747,33 +1747,33 @@
}, },
{ {
"name": "phpspec/prophecy", "name": "phpspec/prophecy",
"version": "1.13.0", "version": "1.14.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpspec/prophecy.git", "url": "https://github.com/phpspec/prophecy.git",
"reference": "be1996ed8adc35c3fd795488a653f4b518be70ea" "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea", "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e",
"reference": "be1996ed8adc35c3fd795488a653f4b518be70ea", "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"doctrine/instantiator": "^1.2", "doctrine/instantiator": "^1.2",
"php": "^7.2 || ~8.0, <8.1", "php": "^7.2 || ~8.0, <8.2",
"phpdocumentor/reflection-docblock": "^5.2", "phpdocumentor/reflection-docblock": "^5.2",
"sebastian/comparator": "^3.0 || ^4.0", "sebastian/comparator": "^3.0 || ^4.0",
"sebastian/recursion-context": "^3.0 || ^4.0" "sebastian/recursion-context": "^3.0 || ^4.0"
}, },
"require-dev": { "require-dev": {
"phpspec/phpspec": "^6.0", "phpspec/phpspec": "^6.0 || ^7.0",
"phpunit/phpunit": "^8.0 || ^9.0" "phpunit/phpunit": "^8.0 || ^9.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.11.x-dev" "dev-master": "1.x-dev"
} }
}, },
"autoload": { "autoload": {
@ -1808,9 +1808,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/phpspec/prophecy/issues", "issues": "https://github.com/phpspec/prophecy/issues",
"source": "https://github.com/phpspec/prophecy/tree/1.13.0" "source": "https://github.com/phpspec/prophecy/tree/1.14.0"
}, },
"time": "2021-03-17T13:42:18+00:00" "time": "2021-09-10T09:02:12+00:00"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
@ -2132,16 +2132,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "9.5.7", "version": "9.5.9",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "d0dc8b6999c937616df4fb046792004b33fd31c5" "reference": "ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0dc8b6999c937616df4fb046792004b33fd31c5", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b",
"reference": "d0dc8b6999c937616df4fb046792004b33fd31c5", "reference": "ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2153,7 +2153,7 @@
"ext-xml": "*", "ext-xml": "*",
"ext-xmlwriter": "*", "ext-xmlwriter": "*",
"myclabs/deep-copy": "^1.10.1", "myclabs/deep-copy": "^1.10.1",
"phar-io/manifest": "^2.0.1", "phar-io/manifest": "^2.0.3",
"phar-io/version": "^3.0.2", "phar-io/version": "^3.0.2",
"php": ">=7.3", "php": ">=7.3",
"phpspec/prophecy": "^1.12.1", "phpspec/prophecy": "^1.12.1",
@ -2219,7 +2219,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues", "issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.7" "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.9"
}, },
"funding": [ "funding": [
{ {
@ -2231,7 +2231,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2021-07-19T06:14:47+00:00" "time": "2021-08-31T06:47:40+00:00"
}, },
{ {
"name": "sebastian/cli-parser", "name": "sebastian/cli-parser",
@ -3200,16 +3200,16 @@
}, },
{ {
"name": "theseer/tokenizer", "name": "theseer/tokenizer",
"version": "1.2.0", "version": "1.2.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/theseer/tokenizer.git", "url": "https://github.com/theseer/tokenizer.git",
"reference": "75a63c33a8577608444246075ea0af0d052e452a" "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e",
"reference": "75a63c33a8577608444246075ea0af0d052e452a", "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3238,7 +3238,7 @@
"description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
"support": { "support": {
"issues": "https://github.com/theseer/tokenizer/issues", "issues": "https://github.com/theseer/tokenizer/issues",
"source": "https://github.com/theseer/tokenizer/tree/master" "source": "https://github.com/theseer/tokenizer/tree/1.2.1"
}, },
"funding": [ "funding": [
{ {
@ -3246,7 +3246,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2020-07-12T23:59:07+00:00" "time": "2021-07-28T10:34:58+00:00"
}, },
{ {
"name": "webmozart/assert", "name": "webmozart/assert",
@ -3313,9 +3313,9 @@
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": { "platform": {
"php": "^7.3", "php": "^7.4",
"ext-pdo": "*" "ext-pdo": "*"
}, },
"platform-dev": [], "platform-dev": [],
"plugin-api-version": "2.0.0" "plugin-api-version": "2.1.0"
} }

View File

@ -8,12 +8,9 @@ class ActionResult
private const STATUS_SUCCESS = 'success'; private const STATUS_SUCCESS = 'success';
private const STATUS_ERROR = 'error'; private const STATUS_ERROR = 'error';
/** @var string */ private string $status;
private $status; private string $message;
/** @var string */ private ?array $inputData;
private $message;
/** @var null|array */
private $inputData;
private function __construct(string $status, string $message, ?array $inputData = null) private function __construct(string $status, string $message, ?array $inputData = null)
{ {

View File

@ -9,10 +9,8 @@ use MailAccountAdmin\Repositories\AdminUserRepository;
class UserHelper class UserHelper
{ {
/** @var SessionHelper */ private SessionHelper $sessionHelper;
private $sessionHelper; private AdminUserRepository $adminUserRepository;
/** @var AdminUserRepository */
private $adminUserRepository;
public function __construct(SessionHelper $sessionHelper, AdminUserRepository $adminUserRepository) public function __construct(SessionHelper $sessionHelper, AdminUserRepository $adminUserRepository)
{ {

View File

@ -16,12 +16,9 @@ use Slim\Views\Twig;
class AccountController extends BaseController class AccountController extends BaseController
{ {
/** @var AccountHandler */ private AccountHandler $accountHandler;
private $accountHandler; private AccountRepository $accountRepository;
/** @var AccountRepository */ private AliasRepository $aliasRepository;
private $accountRepository;
/** @var AliasRepository */
private $aliasRepository;
public function __construct(Twig $view, SessionHelper $sessionHelper, UserHelper $userHelper, AccountHandler $accountHandler, AccountRepository $accountRepository, AliasRepository $aliasRepository) public function __construct(Twig $view, SessionHelper $sessionHelper, UserHelper $userHelper, AccountHandler $accountHandler, AccountRepository $accountRepository, AliasRepository $aliasRepository)
{ {

View File

@ -7,20 +7,13 @@ use MailAccountAdmin\Exceptions\InputValidationError;
class AccountEditData class AccountEditData
{ {
/** @var null|string */ private ?string $username;
private $username; private bool $usernameCreateAlias;
/** @var bool */ private bool $usernameReplaceAlias;
private $usernameCreateAlias; private ?string $password;
/** @var bool */ private bool $active;
private $usernameReplaceAlias; private ?string $homeDir;
/** @var null|string */ private ?string $memo;
private $password;
/** @var bool */
private $active;
/** @var null|string */
private $homeDir;
/** @var null|string */
private $memo;
private function __construct(?string $username, bool $usernameCreateAlias, bool $usernameReplaceAlias, ?string $password, bool $active, private function __construct(?string $username, bool $usernameCreateAlias, bool $usernameReplaceAlias, ?string $password, bool $active,
?string $homeDir, ?string $memo) ?string $homeDir, ?string $memo)

View File

@ -11,12 +11,9 @@ use MailAccountAdmin\Repositories\AliasRepository;
class AccountHandler class AccountHandler
{ {
/** @var AccountRepository */ private AccountRepository $accountRepository;
private $accountRepository; private AliasRepository $aliasRepository;
/** @var AliasRepository */ private PasswordHelper $passwordHelper;
private $aliasRepository;
/** @var PasswordHelper */
private $passwordHelper;
public function __construct(AccountRepository $accountRepository, AliasRepository $aliasRepository, PasswordHelper $passwordHelper) public function __construct(AccountRepository $accountRepository, AliasRepository $aliasRepository, PasswordHelper $passwordHelper)
{ {

View File

@ -9,12 +9,9 @@ use Slim\Views\Twig;
class BaseController class BaseController
{ {
/** @var Twig */ protected Twig $view;
protected $view; protected SessionHelper $sessionHelper;
/** @var SessionHelper */ protected UserHelper $userHelper;
protected $sessionHelper;
/** @var UserHelper */
protected $userHelper;
public function __construct(Twig $view, SessionHelper $sessionHelper, UserHelper $userHelper) public function __construct(Twig $view, SessionHelper $sessionHelper, UserHelper $userHelper)
{ {

View File

@ -13,8 +13,7 @@ use Slim\Views\Twig;
class DomainController extends BaseController class DomainController extends BaseController
{ {
/** @var DomainRepository */ private DomainRepository $domainRepository;
private $domainRepository;
public function __construct(Twig $view, SessionHelper $sessionHelper, UserHelper $userHelper, DomainRepository $domainRepository) public function __construct(Twig $view, SessionHelper $sessionHelper, UserHelper $userHelper, DomainRepository $domainRepository)
{ {

View File

@ -15,10 +15,8 @@ use Slim\Views\Twig;
class LoginController extends BaseController class LoginController extends BaseController
{ {
/** @var AdminUserRepository */ private AdminUserRepository $adminUserRepository;
private $adminUserRepository; private PasswordHelper $passwordHelper;
/** @var PasswordHelper */
private $passwordHelper;
public function __construct(Twig $view, SessionHelper $sessionHelper, UserHelper $userHelper, AdminUserRepository $adminUserRepository, public function __construct(Twig $view, SessionHelper $sessionHelper, UserHelper $userHelper, AdminUserRepository $adminUserRepository,
PasswordHelper $passwordHelper) PasswordHelper $passwordHelper)

View File

@ -8,32 +8,20 @@ use MailAccountAdmin\Exceptions\InformationUnknownException;
class Account class Account
{ {
/** @var int */ private int $id;
private $id; private string $username;
/** @var string */ private string $passwordHash;
private $username; private bool $active;
/** @var string */ private string $homeDir;
private $passwordHash; private string $memo;
/** @var bool */ private DateTimeImmutable $createdAt;
private $active; private DateTimeImmutable $modifiedAt;
/** @var string */
private $homeDir;
/** @var string */
private $memo;
/** @var DateTimeImmutable */
private $createdAt;
/** @var DateTimeImmutable */
private $modifiedAt;
// Extra data that is not part of the data model
// Domain (extracted from username) // Domain (extracted from username)
/** @var string */ private string $domain;
private $domain;
// Number of aliases (not always available) // Number of aliases (not always available)
/** @var int|null */ private ?int $aliasCount;
private $aliasCount;
private function __construct(int $id, string $username, string $passwordHash, bool $active, string $homeDir, string $memo, private function __construct(int $id, string $username, string $passwordHash, bool $active, string $homeDir, string $memo,
DateTimeImmutable $createdAt, DateTimeImmutable $modifiedAt) DateTimeImmutable $createdAt, DateTimeImmutable $modifiedAt)

View File

@ -7,18 +7,12 @@ use DateTimeImmutable;
class AdminUser class AdminUser
{ {
/** @var int */ private int $id;
private $id; private string $username;
/** @var string */ private string $passwordHash;
private $username; private bool $active;
/** @var string */ private DateTimeImmutable $createdAt;
private $passwordHash; private DateTimeImmutable $modifiedAt;
/** @var bool */
private $active;
/** @var DateTimeImmutable */
private $createdAt;
/** @var DateTimeImmutable */
private $modifiedAt;
private function __construct(int $id, string $username, string $passwordHash, bool $isActive, private function __construct(int $id, string $username, string $passwordHash, bool $isActive,
DateTimeImmutable $createdAt, DateTimeImmutable $modifiedAt) DateTimeImmutable $createdAt, DateTimeImmutable $modifiedAt)

View File

@ -7,16 +7,11 @@ use DateTimeImmutable;
class Alias class Alias
{ {
/** @var int */ private int $id;
private $id; private int $userId;
/** @var int */ private string $mailAddress;
private $userId; private DateTimeImmutable $createdAt;
/** @var string */ private DateTimeImmutable $modifiedAt;
private $mailAddress;
/** @var DateTimeImmutable */
private $createdAt;
/** @var DateTimeImmutable */
private $modifiedAt;
private function __construct(int $id, int $userId, string $mailAddress, DateTimeImmutable $createdAt, DateTimeImmutable $modifiedAt) private function __construct(int $id, int $userId, string $mailAddress, DateTimeImmutable $createdAt, DateTimeImmutable $modifiedAt)
{ {

View File

@ -7,8 +7,7 @@ use PDO;
class BaseRepository class BaseRepository
{ {
/** @var PDO */ protected PDO $pdo;
protected $pdo;
public function __construct(PDO $pdo) public function __construct(PDO $pdo)
{ {