|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-04-22 11:58 UTC] nikic@php.net
-Status: Open
+Status: Not a bug
[2017-04-22 11:58 UTC] nikic@php.net
[2017-04-22 12:15 UTC] spam2 at rhsoft dot net
[2017-04-22 12:23 UTC] spam2 at rhsoft dot net
[2017-04-22 12:34 UTC] nikic@php.net
-Block user comment: No
+Block user comment: Yes
[2017-04-22 12:35 UTC] nikic@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 22 14:00:01 2025 UTC |
Description: ------------ "Warning: Declaration of * should be compatible with" In the real world abstracted features work this way all the time. This warning is an arbitrary and artificial idea that has no basis in the real world. PHP Warning: Declaration of combinationLock::unlock($combination) should be compatible with abstractLock::unlock() in test.php on line 23 PHP Warning: Declaration of paddleLock::unlock($key) should be compatible with abstractLock::unlock() in test.php on line 32 Test script: --------------- <?php class abstractLock { private $locked = true; public function unlock() { $this->locked=false; } public function lockStatus() { if($this->locked) return "Locked\n"; else return "Unlocked\n"; } } class combinationLock extends abstractLock { private $combination = '32-10-21'; // combination public function unlock($combination) // unlock WITH combination { if($this->combination == $combination) parent::unlock(); } } class paddleLock extends abstractLock { private $key = '100,70,80,30,50,90,60,40,100'; // ridge heights public function unlock($key) // unlock WITH key { if($this->key == $key) parent::unlock(); } } $lock1 = new paddleLock(); echo "paddleLock is " . $lock1->lockStatus(); $lock1->unlock('100,70,80,30,50,90,60,40,100'); echo "paddleLock is " . $lock1->lockStatus(); $lock2 = new combinationLock(); echo "combinationLock is " . $lock2->lockStatus(); $lock2->unlock('32-10-21'); echo "combinationLock is " . $lock2->lockStatus(); ?> Expected result: ---------------- No warning about things that happen all the time in the real world.