Hi Johannes
2009/5/11 Johannes Schlüter <[email protected]>:
> (re-sending, sorry if this arrives twice)
>
> Hi,
>
> This should be low risk as it's a self-contained function and we all est
> HEAD ... but I'd prefer not adding anything but bug fixes to 5.3 as it
> already took way too long.
We can always just merge it in 5.3.1 if your fine with it, seems
stupid to have a method there in a branch which isn't anywhere soon
(but hopefully im wrong), but nonetheless.
>
> Didn't take a look at the code so can't say much
>
> At least getClosureThis() depends on $this handling which was reverted
> from 5.3.
> Not sure what getClosure() does.
As said on irc, then yea getClosure() can be used to create a closure
of the function instance:
function greet($who) {
echo 'Greetings ' . $who;
}
$rf = new ReflectionFunction('greet');
$greet = $rf->getClosure();
$greet('Johannes');
I will have a look and reply to Christians mail once I've read and
understood the $this handling with closures, but I sort of see why its
not reverted there yet.
>
> We have no real namespace meta-data available, the only way doing things
> there would be by iterating over the class table and parsing the class
> names. Not usre that's really a good thing to do.
It just seems odd that we have reflection for almost class, function
etc. elements but not namespaces, whereas it could be so simple as:
class ReflectionNamespace {
public $name;
public $absolute_path;
public function __construct($absolute_path_or_inherited_name);
ReflectionClass[] public function getClasses();
ReflectionFunction[] public function getFunctions();
array public function getConstants();
int public function getLine();
string public function getFile();
bool public function isAutoLoaded();
/* etc */
}
And then change inNamespace() to return:
ReflectionNamespace public function inNamespace()
or add an additional parameter/method to do so.
>
>
> I was under the impression this was possible, or is it only printed by
> export()?
I see it being printed in _extension_string(), but I don't see any
other references to how you may obtain that value. But if you like I
can add it (perhaps together with getDefaultValue) in 5.3.1.
>
>
> I don't think this belongs to that class as these values should match
> the one PHP was compiled with, so I think this should be a global
> function.
After looking some more on it, then I agree, however the
isDynamicLoaded might be somewhat useful.
>
> johannes
>
>
>
--
Kalle Sommer Nielsen
[email protected]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php