note 51367 added to language.oop5
| From: | php-general at lists dot php dot net | Date: | Mon, 28 Mar 2005 23:21:56 +0000 |
| Subject: | note 51367 added to language.oop5 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-87114@lists.php.net to get a copy of this message | ||
There are 3 simple, and utterly annoying problems with your classes (not because of how you want
them to work, but because how the Zend II engine handles them):
1) You cannot type hint string or int/integer in a method signature. This is incredibly annoying
that the Zend II engine doesn't support it, but there are workarounds.
2) Supplying null in a method signature for a default value means that you will not accept any null
value for that parameter. (therefore the method doesn't need to check if the parameters are
null anyway).
3) Sadly, overriding methods is only possible with the Zend II engine via Inheritance or
Polymorphism, ( and __construct() can only be defined within a class). If you want to override a
method in the same class, my suggestion is to provide the method signature with a $flag = null
variable, which you call a SWITCH on to pick what the data should do.
==============================================
Other than the afformentioned, the Zend II engine works very similarly to Java, which has made PHP
much more versatile and robust in version 5. Thank you again Zend!
----
Manual Page -- http://www.php.net/manual/en/language.oop5.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51367
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51367&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51367&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51367&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51367&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51367&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51367&report=yes
Search -- http://master.php.net/manage/user-notes.php