Skip to content

Commit

Permalink
Merge pull request #5186 from kenjis/improve-model-autocompletion
Browse files Browse the repository at this point in the history
Improve `model()` auto-completion
  • Loading branch information
kenjis committed Oct 9, 2021
2 parents 56b1d51 + 60e559e commit 817c099
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion system/Common.php
Expand Up @@ -23,6 +23,7 @@
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\HTTP\URI;
use CodeIgniter\Model;
use CodeIgniter\Session\Session;
use CodeIgniter\Test\TestLogger;
use Config\App;
Expand Down Expand Up @@ -776,7 +777,12 @@ function log_message(string $level, string $message, array $context = [])
/**
* More simple way of getting model instances from Factories
*
* @return mixed
* @template T of Model
*
* @param class-string<T> $name
*
* @return T
* @phpstan-return Model
*/
function model(string $name, bool $getShared = true, ?ConnectionInterface &$conn = null)
{
Expand Down

0 comments on commit 817c099

Please sign in to comment.