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

[Feature] DI IDE completion hints improvement #106

Open
szymekjanaczek opened this issue Dec 8, 2024 · 0 comments · May be fixed by #107
Open

[Feature] DI IDE completion hints improvement #106

szymekjanaczek opened this issue Dec 8, 2024 · 0 comments · May be fixed by #107

Comments

@szymekjanaczek
Copy link

szymekjanaczek commented Dec 8, 2024

Hi,
Maybe it would be useful to add this small modification to Phalcon\Di\DiInterface and Phalcon\Di\Di class?

/**
 * @template T
 * @param string|class-string<T> $name
 * @param mixed $parameters
 * @return mixed|T
 */
public function get(string $name, $parameters = null): mixed
{
    …
}

having this modified, it is possible to use IDE completion hints, if registered a service using class-string:

$di->set(MyClassInterface::class, MyClass::class);

$di->get(MyClassInterface::class)->…here method completion hints from IDE should appear…

I've prepared a PoC in related PR, but since changes should be done in Zephir I'm not sure how to obtain this: doc-block in Zephir looks a bit different.

What do you think about this change?

@szymekjanaczek szymekjanaczek linked a pull request Dec 8, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant