Skip to content

Commit ef387aa

Browse files
authored
Merge pull request #7730 from paulbalandan/service-functions
refactor: services function actually returns `object|null`
2 parents a18c060 + 96ed873 commit ef387aa

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

system/Common.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,10 +1004,8 @@ function session(?string $val = null)
10041004
* - $timer = \CodeIgniter\Config\Services::timer();
10051005
*
10061006
* @param array|bool|float|int|object|string|null ...$params
1007-
*
1008-
* @return object
10091007
*/
1010-
function service(string $name, ...$params)
1008+
function service(string $name, ...$params): ?object
10111009
{
10121010
return Services::$name(...$params);
10131011
}
@@ -1018,10 +1016,8 @@ function service(string $name, ...$params)
10181016
* Always returns a new instance of the class.
10191017
*
10201018
* @param array|bool|float|int|object|string|null ...$params
1021-
*
1022-
* @return object|null
10231019
*/
1024-
function single_service(string $name, ...$params)
1020+
function single_service(string $name, ...$params): ?object
10251021
{
10261022
$service = Services::serviceExists($name);
10271023

0 commit comments

Comments
 (0)