Update User.php

php8.1 test error handle
This commit is contained in:
hawk 2021-12-15 08:39:35 +08:00 committed by GitHub
parent 548d20b9c2
commit 491e07fbf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,23 +22,23 @@ class User implements SplSubject
$this->observers = new SplObjectStorage();
}
public function attach(SplObserver $observer)
public function attach(SplObserver $observer): void
{
$this->observers->attach($observer);
}
public function detach(SplObserver $observer)
public function detach(SplObserver $observer): void
{
$this->observers->detach($observer);
}
public function changeEmail(string $email)
public function changeEmail(string $email): void
{
$this->email = $email;
$this->notify();
}
public function notify()
public function notify(): void
{
/** @var SplObserver $observer */
foreach ($this->observers as $observer) {