|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-08-27 10:24 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 12 18:00:01 2025 UTC |
Description: ------------ Considering a class that implements an interface and has methods that require many arguments. You may expect to make your life easier derivating this class and providing simpler methods. Reproduce code: --------------- <?php interface i_foo { function fooize($str, $n); } class c_foo implements i_foo { /* painful ($class->fooize($str, $n)) */ function fooize($str, $n) { echo "$str $n\n"; } } class c_bar extends c_foo { function fooize($str) { /* simple ($class->fooize($str)) */ $n = strlen($str); parent::fooize($str, $n); } } ?> Expected result: ---------------- This should not pose any kind of problem. Actual result: -------------- Fatal error: Declaration of c_bar::fooize() must be compatible with that of i_foo::fooize()