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

Add generic type for $c->get method #18

Open
renakdup opened this issue Aug 20, 2024 · 1 comment
Open

Add generic type for $c->get method #18

renakdup opened this issue Aug 20, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@renakdup
Copy link
Owner

No description provided.

@renakdup renakdup self-assigned this Aug 20, 2024
@renakdup renakdup added the enhancement New feature or request label Aug 20, 2024
@renakdup
Copy link
Owner Author

https://phpstan.org/blog/generics-by-examples#function-accepts-any-string%2C-but-returns-object-of-the-same-type-if-it%E2%80%99s-a-class-string

Generics could not be applied because we use as classes and as string types as well.
So due to that in case of using combining types it would not work, and we get an error
image
due to type normalizing.
And in case we use just class-string and returning type T it works for classes but doesn't work for string in $c->get('string-service') in case we use primitives

@renakdup renakdup reopened this Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant