Annotation of embedaddon/php/Zend/tests/indirect_method_call_002.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Indirect method call with chaining
! 3: --FILE--
! 4: <?php
! 5:
! 6: class foo {
! 7: public $x = 'testing';
! 8:
! 9: public function bar() {
! 10: return "foo";
! 11: }
! 12: public function baz() {
! 13: return new self;
! 14: }
! 15: static function xyz() {
! 16: }
! 17: }
! 18:
! 19: var_dump((new foo())->bar()); // string(3) "foo"
! 20: var_dump((new foo())->baz()->x); // string(7) "testing"
! 21: var_dump((new foo())->baz()->baz()->bar()); // string(3) "foo"
! 22: var_dump((new foo())->xyz()); // NULL
! 23: (new foo())->www();
! 24:
! 25: ?>
! 26: --EXPECTF--
! 27: string(3) "foo"
! 28: string(7) "testing"
! 29: string(3) "foo"
! 30: NULL
! 31:
! 32: Fatal error: Call to undefined method foo::www() in %s on line %d
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>