diff --git a/.drone.yml b/.drone.yml index ecdb0b6..5243887 100644 --- a/.drone.yml +++ b/.drone.yml @@ -15,7 +15,7 @@ steps: - composer install --no-progress --no-interaction - name: run unit tests - image: php:7.3 + image: php:7.4 commands: - vendor/bin/phpunit -c phpunit.xml diff --git a/Dockerfile b/Dockerfile index 4e28eda..eae1737 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM php:7.3-apache AS base +FROM php:7.4-apache AS base WORKDIR /var/www diff --git a/composer.json b/composer.json index 4e8f2c1..93dcd53 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "optimize-autoloader": true }, "require": { - "php": "^7.3", + "php": "^7.4", "ext-pdo": "*", "slim/slim": "^4.8", "slim/psr7": "^1.3", diff --git a/composer.lock b/composer.lock index b68bc5a..183fdc2 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": "7ca706ba3c651a07e10e76b10597de60", + "content-hash": "7f17e8a8ee73f9262b6c16738ada898d", "packages": [ { "name": "fig/http-message-util", @@ -179,21 +179,21 @@ }, { "name": "php-di/invoker", - "version": "2.3.0", + "version": "2.3.2", "source": { "type": "git", "url": "https://github.com/PHP-DI/Invoker.git", - "reference": "992fec6c56f2d1ad1ad5fee28267867c85bfb8f9" + "reference": "5214cbe5aad066022cd845dbf313f0e47aed928f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-DI/Invoker/zipball/992fec6c56f2d1ad1ad5fee28267867c85bfb8f9", - "reference": "992fec6c56f2d1ad1ad5fee28267867c85bfb8f9", + "url": "https://api.github.com/repos/PHP-DI/Invoker/zipball/5214cbe5aad066022cd845dbf313f0e47aed928f", + "reference": "5214cbe5aad066022cd845dbf313f0e47aed928f", "shasum": "" }, "require": { "php": ">=7.3", - "psr/container": "~1.0" + "psr/container": "^1.0|^2.0" }, "require-dev": { "athletic/athletic": "~0.1.8", @@ -222,7 +222,7 @@ ], "support": { "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": [ { @@ -230,20 +230,20 @@ "type": "github" } ], - "time": "2021-01-15T10:25:40+00:00" + "time": "2021-07-30T15:05:32+00:00" }, { "name": "php-di/php-di", - "version": "6.3.4", + "version": "6.3.5", "source": { "type": "git", "url": "https://github.com/PHP-DI/PHP-DI.git", - "reference": "f53bcba06ab31b18e911b77c039377f4ccd1f7a5" + "reference": "b8126d066ce144765300ee0ab040c1ed6c9ef588" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/f53bcba06ab31b18e911b77c039377f4ccd1f7a5", - "reference": "f53bcba06ab31b18e911b77c039377f4ccd1f7a5", + "url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/b8126d066ce144765300ee0ab040c1ed6c9ef588", + "reference": "b8126d066ce144765300ee0ab040c1ed6c9ef588", "shasum": "" }, "require": { @@ -294,7 +294,7 @@ ], "support": { "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": [ { @@ -306,7 +306,7 @@ "type": "tidelift" } ], - "time": "2021-06-10T08:04:48+00:00" + "time": "2021-09-02T09:49:58+00:00" }, { "name": "php-di/phpdoc-reader", @@ -1054,16 +1054,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.23.0", + "version": "v1.23.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "2df51500adbaebdc4c38dea4c89a2e131c45c8a1" + "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2df51500adbaebdc4c38dea4c89a2e131c45c8a1", - "reference": "2df51500adbaebdc4c38dea4c89a2e131c45c8a1", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", + "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", "shasum": "" }, "require": { @@ -1114,7 +1114,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1" }, "funding": [ { @@ -1130,20 +1130,20 @@ "type": "tidelift" } ], - "time": "2021-05-27T09:27:20+00:00" + "time": "2021-05-27T12:26:48+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.23.0", + "version": "v1.23.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "eca0bf41ed421bed1b57c4958bab16aa86b757d0" + "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/eca0bf41ed421bed1b57c4958bab16aa86b757d0", - "reference": "eca0bf41ed421bed1b57c4958bab16aa86b757d0", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be", + "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be", "shasum": "" }, "require": { @@ -1197,7 +1197,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1" }, "funding": [ { @@ -1213,7 +1213,7 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-07-28T13:41:28+00:00" }, { "name": "twig/twig", @@ -1747,33 +1747,33 @@ }, { "name": "phpspec/prophecy", - "version": "1.13.0", + "version": "1.14.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea" + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.1", + "php": "^7.2 || ~8.0, <8.2", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^6.0", + "phpspec/phpspec": "^6.0 || ^7.0", "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -1808,9 +1808,9 @@ ], "support": { "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", @@ -2132,16 +2132,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.7", + "version": "9.5.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "d0dc8b6999c937616df4fb046792004b33fd31c5" + "reference": "ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0dc8b6999c937616df4fb046792004b33fd31c5", - "reference": "d0dc8b6999c937616df4fb046792004b33fd31c5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b", + "reference": "ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b", "shasum": "" }, "require": { @@ -2153,7 +2153,7 @@ "ext-xml": "*", "ext-xmlwriter": "*", "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.1", + "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.12.1", @@ -2219,7 +2219,7 @@ ], "support": { "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": [ { @@ -2231,7 +2231,7 @@ "type": "github" } ], - "time": "2021-07-19T06:14:47+00:00" + "time": "2021-08-31T06:47:40+00:00" }, { "name": "sebastian/cli-parser", @@ -3200,16 +3200,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "75a63c33a8577608444246075ea0af0d052e452a" + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", - "reference": "75a63c33a8577608444246075ea0af0d052e452a", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", "shasum": "" }, "require": { @@ -3238,7 +3238,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "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": [ { @@ -3246,7 +3246,7 @@ "type": "github" } ], - "time": "2020-07-12T23:59:07+00:00" + "time": "2021-07-28T10:34:58+00:00" }, { "name": "webmozart/assert", @@ -3313,9 +3313,9 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.3", + "php": "^7.4", "ext-pdo": "*" }, "platform-dev": [], - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.1.0" } diff --git a/src/Common/ActionResult.php b/src/Common/ActionResult.php index 1db2315..924c489 100644 --- a/src/Common/ActionResult.php +++ b/src/Common/ActionResult.php @@ -8,12 +8,9 @@ class ActionResult private const STATUS_SUCCESS = 'success'; private const STATUS_ERROR = 'error'; - /** @var string */ - private $status; - /** @var string */ - private $message; - /** @var null|array */ - private $inputData; + private string $status; + private string $message; + private ?array $inputData; private function __construct(string $status, string $message, ?array $inputData = null) { diff --git a/src/Common/UserHelper.php b/src/Common/UserHelper.php index 38ba0ec..f156459 100644 --- a/src/Common/UserHelper.php +++ b/src/Common/UserHelper.php @@ -9,10 +9,8 @@ use MailAccountAdmin\Repositories\AdminUserRepository; class UserHelper { - /** @var SessionHelper */ - private $sessionHelper; - /** @var AdminUserRepository */ - private $adminUserRepository; + private SessionHelper $sessionHelper; + private AdminUserRepository $adminUserRepository; public function __construct(SessionHelper $sessionHelper, AdminUserRepository $adminUserRepository) { diff --git a/src/Frontend/Accounts/AccountController.php b/src/Frontend/Accounts/AccountController.php index b5c403d..0617e56 100644 --- a/src/Frontend/Accounts/AccountController.php +++ b/src/Frontend/Accounts/AccountController.php @@ -16,12 +16,9 @@ use Slim\Views\Twig; class AccountController extends BaseController { - /** @var AccountHandler */ - private $accountHandler; - /** @var AccountRepository */ - private $accountRepository; - /** @var AliasRepository */ - private $aliasRepository; + private AccountHandler $accountHandler; + private AccountRepository $accountRepository; + private AliasRepository $aliasRepository; public function __construct(Twig $view, SessionHelper $sessionHelper, UserHelper $userHelper, AccountHandler $accountHandler, AccountRepository $accountRepository, AliasRepository $aliasRepository) { diff --git a/src/Frontend/Accounts/AccountEditData.php b/src/Frontend/Accounts/AccountEditData.php index 1422c34..f32553e 100644 --- a/src/Frontend/Accounts/AccountEditData.php +++ b/src/Frontend/Accounts/AccountEditData.php @@ -7,20 +7,13 @@ use MailAccountAdmin\Exceptions\InputValidationError; class AccountEditData { - /** @var null|string */ - private $username; - /** @var bool */ - private $usernameCreateAlias; - /** @var bool */ - private $usernameReplaceAlias; - /** @var null|string */ - private $password; - /** @var bool */ - private $active; - /** @var null|string */ - private $homeDir; - /** @var null|string */ - private $memo; + private ?string $username; + private bool $usernameCreateAlias; + private bool $usernameReplaceAlias; + private ?string $password; + private bool $active; + private ?string $homeDir; + private ?string $memo; private function __construct(?string $username, bool $usernameCreateAlias, bool $usernameReplaceAlias, ?string $password, bool $active, ?string $homeDir, ?string $memo) diff --git a/src/Frontend/Accounts/AccountHandler.php b/src/Frontend/Accounts/AccountHandler.php index 62e6c3b..26de4fd 100644 --- a/src/Frontend/Accounts/AccountHandler.php +++ b/src/Frontend/Accounts/AccountHandler.php @@ -11,12 +11,9 @@ use MailAccountAdmin\Repositories\AliasRepository; class AccountHandler { - /** @var AccountRepository */ - private $accountRepository; - /** @var AliasRepository */ - private $aliasRepository; - /** @var PasswordHelper */ - private $passwordHelper; + private AccountRepository $accountRepository; + private AliasRepository $aliasRepository; + private PasswordHelper $passwordHelper; public function __construct(AccountRepository $accountRepository, AliasRepository $aliasRepository, PasswordHelper $passwordHelper) { diff --git a/src/Frontend/BaseController.php b/src/Frontend/BaseController.php index f460fe4..278fb2e 100644 --- a/src/Frontend/BaseController.php +++ b/src/Frontend/BaseController.php @@ -9,12 +9,9 @@ use Slim\Views\Twig; class BaseController { - /** @var Twig */ - protected $view; - /** @var SessionHelper */ - protected $sessionHelper; - /** @var UserHelper */ - protected $userHelper; + protected Twig $view; + protected SessionHelper $sessionHelper; + protected UserHelper $userHelper; public function __construct(Twig $view, SessionHelper $sessionHelper, UserHelper $userHelper) { diff --git a/src/Frontend/Domains/DomainController.php b/src/Frontend/Domains/DomainController.php index b1929be..5a9f5db 100644 --- a/src/Frontend/Domains/DomainController.php +++ b/src/Frontend/Domains/DomainController.php @@ -13,8 +13,7 @@ use Slim\Views\Twig; class DomainController extends BaseController { - /** @var DomainRepository */ - private $domainRepository; + private DomainRepository $domainRepository; public function __construct(Twig $view, SessionHelper $sessionHelper, UserHelper $userHelper, DomainRepository $domainRepository) { diff --git a/src/Frontend/Login/LoginController.php b/src/Frontend/Login/LoginController.php index 3e0f875..1d0e530 100644 --- a/src/Frontend/Login/LoginController.php +++ b/src/Frontend/Login/LoginController.php @@ -15,10 +15,8 @@ use Slim\Views\Twig; class LoginController extends BaseController { - /** @var AdminUserRepository */ - private $adminUserRepository; - /** @var PasswordHelper */ - private $passwordHelper; + private AdminUserRepository $adminUserRepository; + private PasswordHelper $passwordHelper; public function __construct(Twig $view, SessionHelper $sessionHelper, UserHelper $userHelper, AdminUserRepository $adminUserRepository, PasswordHelper $passwordHelper) diff --git a/src/Models/Account.php b/src/Models/Account.php index 472e576..2f67d47 100644 --- a/src/Models/Account.php +++ b/src/Models/Account.php @@ -8,32 +8,20 @@ use MailAccountAdmin\Exceptions\InformationUnknownException; class Account { - /** @var int */ - private $id; - /** @var string */ - private $username; - /** @var string */ - private $passwordHash; - /** @var bool */ - private $active; - /** @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 + private int $id; + private string $username; + private string $passwordHash; + private bool $active; + private string $homeDir; + private string $memo; + private DateTimeImmutable $createdAt; + private DateTimeImmutable $modifiedAt; // Domain (extracted from username) - /** @var string */ - private $domain; + private string $domain; // Number of aliases (not always available) - /** @var int|null */ - private $aliasCount; + private ?int $aliasCount; private function __construct(int $id, string $username, string $passwordHash, bool $active, string $homeDir, string $memo, DateTimeImmutable $createdAt, DateTimeImmutable $modifiedAt) diff --git a/src/Models/AdminUser.php b/src/Models/AdminUser.php index cef9c7b..ae677ac 100644 --- a/src/Models/AdminUser.php +++ b/src/Models/AdminUser.php @@ -7,18 +7,12 @@ use DateTimeImmutable; class AdminUser { - /** @var int */ - private $id; - /** @var string */ - private $username; - /** @var string */ - private $passwordHash; - /** @var bool */ - private $active; - /** @var DateTimeImmutable */ - private $createdAt; - /** @var DateTimeImmutable */ - private $modifiedAt; + private int $id; + private string $username; + private string $passwordHash; + private bool $active; + private DateTimeImmutable $createdAt; + private DateTimeImmutable $modifiedAt; private function __construct(int $id, string $username, string $passwordHash, bool $isActive, DateTimeImmutable $createdAt, DateTimeImmutable $modifiedAt) diff --git a/src/Models/Alias.php b/src/Models/Alias.php index 94e8052..3fe7413 100644 --- a/src/Models/Alias.php +++ b/src/Models/Alias.php @@ -7,16 +7,11 @@ use DateTimeImmutable; class Alias { - /** @var int */ - private $id; - /** @var int */ - private $userId; - /** @var string */ - private $mailAddress; - /** @var DateTimeImmutable */ - private $createdAt; - /** @var DateTimeImmutable */ - private $modifiedAt; + private int $id; + private int $userId; + private string $mailAddress; + private DateTimeImmutable $createdAt; + private DateTimeImmutable $modifiedAt; private function __construct(int $id, int $userId, string $mailAddress, DateTimeImmutable $createdAt, DateTimeImmutable $modifiedAt) { diff --git a/src/Repositories/BaseRepository.php b/src/Repositories/BaseRepository.php index 158c55d..24715ff 100644 --- a/src/Repositories/BaseRepository.php +++ b/src/Repositories/BaseRepository.php @@ -7,8 +7,7 @@ use PDO; class BaseRepository { - /** @var PDO */ - protected $pdo; + protected PDO $pdo; public function __construct(PDO $pdo) {