Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » [PHP-DEV] Reflection API idea [RSS Feed]

#1 Nov. 23, 2005 04:17:45

Bob S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Reflection API idea


Here's an idea for the maintainer of the Reflection API, to be able to view
the class a method is defined in (if not overridden).


class Vehicle {
function go() {}
function crash() {}
}

class Car extends Vehicle {
function crash() {}
function collectInsurance() {}
}

class Ford extends Car {
function fixOrRepairDaily() {}
}

Reflection::export(new ReflectionClass(Car));


Class {

- Methods {
Method {
}

Method {
}

Method {
}

Method {
}
}

I am developing on a Windows machine so a Unified Patch isn't easily
attainable (with the tools I have at least).

Psuedo Patch:
Modify _function_string in zend_reflection_api.c to take a zend_class_entry
of the reflecting class or NULL if not used in a class context.
Then add the "inherited from" section as below (or however you'd like to
implement).

string_printf(str, "%s", fptr->common.function_name);
if (fptr->common.scope && memcmp(fptr->common.scope->name, ce->name)) {
string_printf(str, " inherited from %s", fptr->common.scope->name);
}
string_printf(str, " ] {\n");


Not sure if this works in all situations, I'll leave that for you guys to
determine if you think this is useful functionality.

Bob Silva

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#2 Nov. 23, 2005 07:57:21

Bob S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Reflection API idea


Whoops, that memcmp should be a strcmp.

> -----Original Message-----
> From: Bob Silva
> Sent: Tuesday, November 22, 2005 8:19 PM
> To: 'internals'
> Subject: Reflection API idea
>
> Here's an idea for the maintainer of the Reflection API, to be able to
> view
> the class a method is defined in (if not overridden).
>
>
> class Vehicle {
> function go() {}
> function crash() {}
> }
>
> class Car extends Vehicle {
> function crash() {}
> function collectInsurance() {}
> }
>
> class Ford extends Car {
> function fixOrRepairDaily() {}
> }
>
> Reflection::export(new ReflectionClass(Car));
>
>
> Class {
>
> - Methods {
> Method {
> }
>
> Method {
> }
>
> Method {
> }
>
> Method {
> }
> }
>
> I am developing on a Windows machine so a Unified Patch isn't easily
> attainable (with the tools I have at least).
>
> Psuedo Patch:
> Modify _function_string in zend_reflection_api.c to take a
> zend_class_entry
> of the reflecting class or NULL if not used in a class context.
> Then add the "inherited from" section as below (or however you'd like to
> implement).
>
> string_printf(str, "%s", fptr->common.function_name);
> if (fptr->common.scope && memcmp(fptr->common.scope->name, ce->name)) {
> string_printf(str, " inherited from %s", fptr->common.scope->name);
> }
> string_printf(str, " ] {\n");
>
>
> Not sure if this works in all situations, I'll leave that for you guys to
> determine if you think this is useful functionality.
>
> Bob Silva
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit:http://www.php.net/unsub.php--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#3 Nov. 23, 2005 08:41:14

Marcus B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Reflection API idea


Hello Bob,

have you looked at head output of Reflection lately? I guess that contains
all you want, right?

marcus

Wednesday, November 23, 2005, 5:19:10 AM, you wrote:

> Here's an idea for the maintainer of the Reflection API, to be able to view
> the class a method is defined in (if not overridden).


> class Vehicle {
> function go() {}
> function crash() {}
> }

> class Car extends Vehicle {
> function crash() {}
> function collectInsurance() {}
> }

> class Ford extends Car {
> function fixOrRepairDaily() {}
> }

> Reflection::export(new ReflectionClass(Car));


> Class {
>
> - Methods {
> Method {
> }

> Method {
> }

> Method {
> }

> Method {
> }
> }

> I am developing on a Windows machine so a Unified Patch isn't easily
> attainable (with the tools I have at least).

> Psuedo Patch:
> Modify _function_string in zend_reflection_api.c to take a zend_class_entry
> of the reflecting class or NULL if not used in a class context.
> Then add the "inherited from" section as below (or however you'd like to
> implement).

> string_printf(str, "%s", fptr->common.function_name);
> if (fptr->common.scope && memcmp(fptr->common.scope->name, ce->name)) {
> string_printf(str, " inherited from %s", fptr->common.scope->name);
> }
> string_printf(str, " ] {\n");


> Not sure if this works in all situations, I'll leave that for you guys to
> determine if you think this is useful functionality.

> Bob Silva




Best regards,
Marcus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#4 Nov. 23, 2005 08:42:30

Bob S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Reflection API idea


Nope, sorry, I'll do my homework next time.

Bob

> -----Original Message-----
> From: Marcus Boerger
> Sent: Wednesday, November 23, 2005 12:39 AM
> To: Bob Silva
> Cc: 'internals'
> Subject: Re: Reflection API idea
>
> Hello Bob,
>
> have you looked at head output of Reflection lately? I guess that
> contains
> all you want, right?
>
> marcus
>
> Wednesday, November 23, 2005, 5:19:10 AM, you wrote:
>
> > Here's an idea for the maintainer of the Reflection API, to be able to
> view
> > the class a method is defined in (if not overridden).
>
>
> > class Vehicle {
> > function go() {}
> > function crash() {}
> > }
>
> > class Car extends Vehicle {
> > function crash() {}
> > function collectInsurance() {}
> > }
>
> > class Ford extends Car {
> > function fixOrRepairDaily() {}
> > }
>
> > Reflection::export(new ReflectionClass(Car));
>
>
> > Class {
> >
> > - Methods {
> > Method {
> > }
>
> > Method {
> > }
>
> > Method
> {
> > }
>
> > Method {
> > }
> > }
>
> > I am developing on a Windows machine so a Unified Patch isn't easily
> > attainable (with the tools I have at least).
>
> > Psuedo Patch:
> > Modify _function_string in zend_reflection_api.c to take a
> zend_class_entry
> > of the reflecting class or NULL if not used in a class context.
> > Then add the "inherited from" section as below (or however you'd like to
> > implement).
>
> > string_printf(str, "%s", fptr->common.function_name);
> > if (fptr->common.scope && memcmp(fptr->common.scope->name, ce->name)) {
> > string_printf(str, " inherited from %s", fptr->common.scope->name);
> > }
> > string_printf(str, " ] {\n");
>
>
> > Not sure if this works in all situations, I'll leave that for you guys
> to
> > determine if you think this is useful functionality.
>
> > Bob Silva
>
>
>
>
> Best regards,
> Marcus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#5 Nov. 23, 2005 11:50:25

Jared W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Reflection API idea


Hi,
This has been do-able in PHP5 for somewhile, (wrote a reflection
browser while ago to show such things)http://www.ren.dotgeek.org/classbrowser/?class=DOMCdataSectionJared

> Here's an idea for the maintainer of the Reflection API, to
> be able to view the class a method is defined in (if not overridden).
>
>
> class Vehicle {
> function go() {}
> function crash() {}
> }
>
> class Car extends Vehicle {
> function crash() {}
> function collectInsurance() {}
> }
>
> class Ford extends Car {
> function fixOrRepairDaily() {}
> }
>
> Reflection::export(new ReflectionClass(Car));
>
>
> Class {
>
> - Methods {
> Method {
> }
>
> Method {
> }
>
> Method {
> }
>
> Method {
> }
> }
>
> I am developing on a Windows machine so a Unified Patch isn't
> easily attainable (with the tools I have at least).
>
> Psuedo Patch:
> Modify _function_string in zend_reflection_api.c to take a
> zend_class_entry of the reflecting class or NULL if not used
> in a class context.
> Then add the "inherited from" section as below (or however
> you'd like to implement).
>
> string_printf(str, "%s", fptr->common.function_name); if
> (fptr->common.scope && memcmp(fptr->common.scope->name, ce->name)) {
> string_printf(str, " inherited from %s",
> fptr->common.scope->name); } string_printf(str, " ] {\n");
>
>
> Not sure if this works in all situations, I'll leave that for
> you guys to determine if you think this is useful functionality.
>
> Bob Silva
>
> --
> PHP Internals - PHP Runtime Development Mailing List To
> unsubscribe, visit:http://www.php.net/unsub.php>

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#6 Nov. 23, 2005 20:15:38

Marcus B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Reflection API idea


Hello Jared,

hey cool stuff! Any chance you could publish this or make it a PEAR class
or put it into the newly created Reflection extension as example?

best regards
marcus

Wednesday, November 23, 2005, 12:50:25 PM, you wrote:

> Hi,
> This has been do-able in PHP5 for somewhile, (wrote a reflection
> browser while ago to show such things)
>http://www.ren.dotgeek.org/classbrowser/?class=DOMCdataSection> Jared
>
>> Here's an idea for the maintainer of the Reflection API, to
>> be able to view the class a method is defined in (if not overridden).
>>
>>
>> class Vehicle {
>> function go() {}
>> function crash() {}
>> }
>>
>> class Car extends Vehicle {
>> function crash() {}
>> function collectInsurance() {}
>> }
>>
>> class Ford extends Car {
>> function fixOrRepairDaily() {}
>> }
>>
>> Reflection::export(new ReflectionClass(Car));
>>
>>
>> Class {
>>
>> - Methods {
>> Method {
>> }
>>
>> Method {
>> }
>>
>> Method {
>> }
>>
>> Method {
>> }
>> }
>>
>> I am developing on a Windows machine so a Unified Patch isn't
>> easily attainable (with the tools I have at least).
>>
>> Psuedo Patch:
>> Modify _function_string in zend_reflection_api.c to take a
>> zend_class_entry of the reflecting class or NULL if not used
>> in a class context.
>> Then add the "inherited from" section as below (or however
>> you'd like to implement).
>>
>> string_printf(str, "%s", fptr->common.function_name); if
>> (fptr->common.scope && memcmp(fptr->common.scope->name, ce->name)) {
>> string_printf(str, " inherited from %s",
>> fptr->common.scope->name); } string_printf(str, " ] {\n");
>>
>>
>> Not sure if this works in all situations, I'll leave that for
>> you guys to determine if you think this is useful functionality.
>>
>> Bob Silva
>>
>> --
>> PHP Internals - PHP Runtime Development Mailing List To
>> unsubscribe, visit:http://www.php.net/unsub.php>>




Best regards,
Marcus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#7 Nov. 23, 2005 21:11:02

Jared W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Reflection API idea


Hi,

> hey cool stuff! Any chance you could publish this or make
> it a PEAR class or put it into the newly created Reflection
> extension as example?http://sourceforge.net/projects/phpclassbrowser/Its in CVS at sourceforge. (Still haven't gotten around to reading up on how to
create file packages on SF)http://cvs.sourceforge.net/viewcvs.py/phpclassbrowser/classbrowser/Need to update it sometime one of the parameter required column needs to go now
as bug #29523 is fixed.

Jared

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

  • Root
  • » PHP
  • » [PHP-DEV] Reflection API idea [RSS Feed]

Board footer

Moderator control

Enjoy the 22nd of January
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support