Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Subtypes #2103

Closed
qkdreyer opened this issue Jan 26, 2022 · 2 comments
Closed

PHP Subtypes #2103

qkdreyer opened this issue Jan 26, 2022 · 2 comments

Comments

@qkdreyer
Copy link

qkdreyer commented Jan 26, 2022

Describe the bug
Subtypes appears to be not supported
https://www.php.net/manual/en/class.reflectiontype.php

To Reproduce

<?php

$reflectionClass = new \ReflectionClass($this);
$reflectionMethods = $reflectionClass->getMethods();
$reflectionMethod = \current($reflectionMethods);
$reflectionParameters = $reflectionMethod->getParameters();
$reflectionParameter = \current($reflectionParameters);
$reflectionType = $reflectionParameter->getType();
$reflectionType->getName();

Expected behavior
$reflectionType should be typed hinted to \ReflectionNamedType|\ReflectionUnionType|null, not \ReflectionType|null

Screenshots
image

Platform and version

  • macOS 12.1
  • intelephense v1.8.0
@jellynoone
Copy link

The manual seems to type hint ?ReflectionType. I believe intelephense uses that information.

@bmewburn
Copy link
Owner

Closing as I think it is the same as #2094 . There's a bug here determining return types for specific php versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants