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

Improve model() auto-completion #5186

Merged
merged 1 commit into from Oct 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
kenjis marked this conversation as resolved.
Show resolved Hide resolved
*/
function model(string $name, bool $getShared = true, ?ConnectionInterface &$conn = null)
{
Expand Down