php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29728 Reflection API Feature: Default parameter value.
Submitted: 2004-08-18 12:05 UTC Modified: 2004-08-19 09:42 UTC
From: wb at pro-net dot co dot uk Assigned: helly
Status: Closed Package: Scripting Engine problem
PHP Version: 5.1.0-dev OS: *
Private report: No CVE-ID:
 [2004-08-18 12:05 UTC] wb at pro-net dot co dot uk
Description:
------------
This is not strictly a bug and more of a feature request (if there is a better place for feature requests then please let me know).

At the moment there is no way to find out if a parameter for a method has a default value or not.

It would be nice is the ReflectionParameter class had something like the the following methods.

<boolean> ReflectionParameter->isRequired()

Returns TRUE if the parameter is required or FALSE if it is not required (and therefore has a default value).

<mixed> ReflectionParameter->getDefault()

Returns the default value for the parameter. This could throw an Exception if no default value is set as it could be possiable for the default value to be FALSE :)



Reproduce code:
---------------
n/a

Expected result:
----------------
n/a

Actual result:
--------------
n/a

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-19 01:08 UTC] helly@php.net
The first is ReflectionParameter::isOptional()

 [2004-08-19 09:42 UTC] helly@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 18:01:58 2014 UTC