Laruence | 22 Jun 2012 18:25
Picon
Gravatar

[PHP-DEV] Add parameter user_only to get_declared_classes(interfaces/traits)

Hi internalers:

      there comes a FR, #62343 https://bugs.php.net/bug.php?id=62343

      the bug self is about class alias,  but it also metioned a new
parameter $user_only to get_declared_classes.

      the FR makes sense to me,  for now,  get_defined_functions 's
return will points which functions are internal, and which is user
defined.

      but get_declared_classes etc doesn't.

      so I made a patch
https://bugs.php.net/patch-display.php?bug_id=62343&patch=bug62343.phpt&revision=latest

      yes, the patch have some room for improving,  like promote the
condition (ce->type == ZEND_USER_CLASS) out of the iterating :)

      for now, I just what to see what do you think about this idea?
:)  (hope I made my point clear)

thanks

-- 
Laruence  Xinchen Hui
http://www.laruence.com/

--

-- 
PHP Internals - PHP Runtime Development Mailing List
(Continue reading)

jpauli | 22 Jun 2012 21:04
Picon
Gravatar

Re: [PHP-DEV] Add parameter user_only to get_declared_classes(interfaces/traits)

On Fri, Jun 22, 2012 at 6:25 PM, Laruence <laruence <at> php.net> wrote:
> Hi internalers:
>
>      there comes a FR, #62343 https://bugs.php.net/bug.php?id=62343
>
>      the bug self is about class alias,  but it also metioned a new
> parameter $user_only to get_declared_classes.
>
>      the FR makes sense to me,  for now,  get_defined_functions 's
> return will points which functions are internal, and which is user
> defined.
>
>      but get_declared_classes etc doesn't.
>
>      so I made a patch
> https://bugs.php.net/patch-display.php?bug_id=62343&patch=bug62343.phpt&revision=latest
>
>      yes, the patch have some room for improving,  like promote the
> condition (ce->type == ZEND_USER_CLASS) out of the iterating :)
>
>      for now, I just what to see what do you think about this idea?
> :)  (hope I made my point clear)
>

Why not use something like get_defined_functions()'s return : a double
array of [internal] => array, [user] => array ?
It would just make the get_defined_functions()'s API more consistent IMO.
We could embrace the [ bool $categorize = false ] API from
get_defined_constants() as well , the goal would be to take this bug
as an entry point to standardize those functions' API without BBC
(Continue reading)


Gmane