RSS Feed/News Missing type hints on various service() methods

Status
Not open for further replies.

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
33,220
Points
823

Reputation:

\XF::service() / \XF\App::service() and a few other places have what amounts to this as a the type definition for the method;
PHP:

Code:
/**
 * @param $class
 * @param mixed ...$arguments
 *
 * @return mixed
 */
public function service($class, ...$arguments)

This can be replaced with a phpdoc template for type hinting the correct return type;
Code:

Code:
/**
 * @template T of AbstractService
 * @param class-string<T> $class
 * @return T
 */
public static function service(string $class...

Read more

Continue reading...
 
Status
Not open for further replies.
Top