Open sebastianbergmann opened 9 years ago
I'm not seeing the notices when I run the code snippet, I suspect they're unrelated. The rest seems rather implementation specific (you're reflecting on systemlib and many of the differences are naming related and otherwise invisible). I think at best this is low-pri, but I don't think supporting parity with systemlib parameter names is realistic. (http://3v4l.org/2JkWA)
Not sure what you think this is about, but HHVM's implementation of ReflectionParameter
is missing the hasType()
and getType()
methods which were introduced in PHP 7.
Ah, that was not clear from the diff...
Not from the diff, no. Sorry about that. But from https://github.com/sebastianbergmann/phpunit-mock-objects/pull/229#issuecomment-111694588 linked from the first line of the issue :-)
Is this equivalent to getTypehintText()
and might be just an alias?
@SiebelsTim it is not equivalent, hasType
should return true
for any type-hinted argument, and getType
should return a ReflectionType
object (or null
when there is no type).
Note that ReflectionType
is also used for return types.
See http://3v4l.org/4hj3X
After a bit of checking, hasType
should be able to be implemented as quite simply:
public function hasType() {
return $this->getTypeText() !== '';
}
As I don't see a ReflectionType
class defined in HHVM currently, I'll assume that's a bit more complicated to implement.
@Orvid of course it does not exist currently. It is part of the new PHP 7 API
A big crux of this looks to be implementing ReflectionType
and ReflectionGenerator
if I understand what was added to PHP 7. And a couple of new methods to existing types...
https://github.com/tpunt/PHP7-Reference#reflection-additions
Discovered via https://github.com/sebastianbergmann/phpunit-mock-objects/issues/228 which is discussed in https://github.com/sebastianbergmann/phpunit-mock-objects/pull/229.
This is just one example of where the Reflection API differs between HHVM and PHP:
The notices have been reported in #5888.