mirror of
https://github.com/php/php-src.git
synced 2024-12-17 22:09:12 +08:00
6d805ed275
Closes GH-7235
30 lines
477 B
PHP
30 lines
477 B
PHP
--TEST--
|
|
054: namespace and interfaces
|
|
--FILE--
|
|
<?php
|
|
namespace test\ns1;
|
|
|
|
class Foo implements \SplObserver {
|
|
function update(\SplSubject $x): void {
|
|
echo "ok\n";
|
|
}
|
|
}
|
|
|
|
class Bar implements \SplSubject {
|
|
function attach(\SplObserver $x): void {
|
|
echo "ok\n";
|
|
}
|
|
function notify(): void {
|
|
}
|
|
function detach(\SplObserver $x): void {
|
|
}
|
|
}
|
|
$foo = new Foo();
|
|
$bar = new Bar();
|
|
$bar->attach($foo);
|
|
$foo->update($bar);
|
|
?>
|
|
--EXPECT--
|
|
ok
|
|
ok
|