Force types of RegistryTrait usages to shut PHPStan up

we need generic traits to solve this problem properly.
This commit is contained in:
Dylan K. Taylor
2020-05-21 19:12:48 +01:00
parent 8e2b9b686b
commit f93bc0739c
6 changed files with 26 additions and 142 deletions

View File

@ -51,7 +51,10 @@ trait EnumTrait{
* @return self[]
*/
public static function getAll() : array{
return self::_registryGetAll();
//phpstan doesn't support generic traits yet :(
/** @var self[] $result */
$result = self::_registryGetAll();
return $result;
}
/**
@ -61,7 +64,10 @@ trait EnumTrait{
* @throws \InvalidArgumentException if no member matches.
*/
public static function fromString(string $name) : self{
return self::_registryFromString($name);
//phpstan doesn't support generic traits yet :(
/** @var self $result */
$result = self::_registryFromString($name);
return $result;
}
/** @var int|null */