Skip to content

[Feature] DI IDE completion hints improvement #106

Open
@szymekjanaczek

Description

@szymekjanaczek

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions