Exceptions for XPClass::get*()Scope of ChangeThe following methods in lang.XPClass will throw exceptions instead of returning NULL for the case the respective element is not found:
Rationale
Allow for chaining, be consistent with other APIs (if a hasX method exists,
the getX method will throw an exception) and the getAnnotation() method. Functionality
The following can be written in a more concise way: $m= XPClass::forName('util.cmd.Runner')->getMethod('main'); New: XPClass::forName('util.cmd.Runner')->getMethod('main')->invoke(NULL, array($args));
BC breakThe following will no longer work: if (!($m= $class->getMethod($name))) { ...and must be rewritten to use hasMethod(): if (!$class->hasMethod($name)) {
If the first version is run, the block below the getMethod() call will never
be reached (as it will throw an exception). Security considerations
n/a Speed impact
None. Dependencies
- BC break - increases minor version (at the time of writing, that would
mean the next release would be 5.7.0) Related documents
- http://xp-framework.net/rfc/contrib/rfc0164.diff
Implementing patch Comments
| Table of contents |