ILIAS
ILIAS copied to clipboard
Data: Add @template type annotations for `ILIAS\Data\Result`
This PR adds type annotations for the ILIAS\Data\Result
inteface as well as it's implementors ILIAS\Data\Result\Ok
and ILIAS\Data\Result\Error
to support a generic type. These type annotations are understood by phpstan (https://phpstan.org/blog/generics-in-php-using-phpdocs) and phpstorm.
With this change the following can be checked via static analysis:
/**
* @param Result<Baz> $bar
*/
function foo(Result $bar): void
{
// ...
}