-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
add support for class string service ids #434
add support for class string service ids #434
Conversation
if ($arg1 instanceof String_) { | ||
// @todo determine what these types are. | ||
return $arg1->value; | ||
} | ||
|
||
if ($arg1 instanceof ClassConstFetch && $arg1->class instanceof FullyQualified) { | ||
return (string) $arg1->class; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if there's anyway to leverage PHPStan type system, which may abstract away some of this logic. But it may not be as accessible in these extensions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I understand correctly, that you would like to ask phpstan if the argument is of type 'string' or 'class-string' instead of this?
Do you have any idea where to start looking to come up with a solution that does that (because I am not really experienced in phpstan source)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can ignore that other PR, it's experimental. Let's work on this first
According to this docs page using the fully qualified class name when interacting with services is a supported approach.
This PR adds the correct return type hint when this approach is used.