Annotation of embedaddon/php/tests/classes/method_override_optional_arg_001.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Method override allows optional default argument
! 3: --SKIPIF--
! 4: <?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
! 5: --FILE--
! 6: <?php
! 7:
! 8: class A {
! 9: function foo($arg1 = 1) {
! 10: }
! 11: }
! 12:
! 13: class B extends A {
! 14: function foo($arg1 = 2, $arg2 = 3) {
! 15: var_dump($arg1);
! 16: var_dump($arg2);
! 17: }
! 18: }
! 19:
! 20: class C extends A {
! 21: function foo() {
! 22: }
! 23: }
! 24:
! 25: $b = new B();
! 26:
! 27: $b->foo(1);
! 28:
! 29: ?>
! 30: --EXPECTF--
! 31: Strict Standards: Declaration of C::foo() should be compatible with that of A::foo() in %s on line %d
! 32: int(1)
! 33: int(3)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>