Merge pull request #471 from luke-navitas/patch-1

Enhances example of Observer implementation, with actual change. Fixes #470
This commit is contained in:
Dominik Liebler 2021-12-06 14:00:49 +01:00 committed by GitHub
commit 09e46360c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,6 +15,7 @@ use SplObserver;
class User implements SplSubject
{
private SplObjectStorage $observers;
private $email;
public function __construct()
{
@ -33,6 +34,7 @@ class User implements SplSubject
public function changeEmail(string $email)
{
$this->email = $email;
$this->notify();
}