diff --git a/Account/Account.php b/Account/Account.php index a3a729587..1c63a24fd 100644 --- a/Account/Account.php +++ b/Account/Account.php @@ -87,10 +87,10 @@ class Account implements ArrayableInterface, \JsonSerializable /** * Login. * - * @var string + * @var string|null * @since 1.0.0 */ - protected $login = ''; + protected $login = null; /** * Last activity. @@ -352,7 +352,7 @@ class Account implements ArrayableInterface, \JsonSerializable * * @since 1.0.0 */ - public function getName() : string + public function getName() : ?string { return $this->login; } diff --git a/Module/ModuleAbstract.php b/Module/ModuleAbstract.php index 9e3ffbe9b..643e2a505 100644 --- a/Module/ModuleAbstract.php +++ b/Module/ModuleAbstract.php @@ -325,7 +325,7 @@ abstract class ModuleAbstract */ protected function createModelRelation(RequestAbstract $request, $rel1, $rel2, string $mapper, string $field, string $trigger) : void { - $this->app->eventManager->trigger('PRE:Module:' . self::MODULE_NAME . '-' . $trigger . '-relation', '', $$rel1); + $this->app->eventManager->trigger('PRE:Module:' . self::MODULE_NAME . '-' . $trigger . '-relation', '', $rel1); $mapper::createRelation($field, $rel1, $rel2); $this->app->eventManager->trigger('POST:Module:' . self::MODULE_NAME . '-' . $trigger . '-relation', '', [ $request->getHEader()->getAccount(), diff --git a/tests/Account/AccountTest.php b/tests/Account/AccountTest.php index 3ff584642..30b4bade0 100644 --- a/tests/Account/AccountTest.php +++ b/tests/Account/AccountTest.php @@ -69,8 +69,7 @@ class AccountTest extends \PHPUnit\Framework\TestCase self::assertEquals([], $account->getGroups()); - self::assertTrue(\is_string($account->getName())); - self::assertEquals('', $account->getName()); + self::assertEquals(null, $account->getName()); self::assertTrue(\is_string($account->getName1())); self::assertEquals('', $account->getName1());