Skip to content

Commit

Permalink
docs: add Generics annotation to model()
Browse files Browse the repository at this point in the history
@phpstan-return is to suppress PHPStan error.
  • Loading branch information
kenjis committed Oct 8, 2021
1 parent 34bbbc4 commit 60e559e
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 60e559e

Please sign in to comment.