Skip to content

Commit 4eb80a9

Browse files
committed
Type hinting update for IDEs
- Close #11: The instantiate method in DependencyInjector has been enhanced with PHPDoc annotations that use templates. This enhancement is aimed to support improved autocompletion in IDEs like PhpStorm. Now, IDEs should be able to provide method suggestions based on the specific class being instantiated, helping developers write more accurate code more quickly. This change does not affect the functionality of the instantiate method, but greatly enhances developer experience
1 parent da7cfe9 commit 4eb80a9

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/DependencyInjector.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ public function __construct()
5050
}
5151

5252
/**
53-
* @param class-string $className The fully qualified class name to instantiate
53+
* @template T
54+
* @param class-string<T> $className The fully qualified class name to instantiate
5455
* @param array $parameters The parameters to pass to the constructor
55-
* @return object The instantiated object.
56+
* @return T The instantiated object.
5657
* @throws ClassNotDefinedException
5758
* @throws ClassNotInstantiableException
5859
* @throws ParameterDiscoveryFailedException

0 commit comments

Comments
 (0)