Promote some constructors

This commit is contained in:
Dylan K. Taylor
2022-05-17 22:34:58 +01:00
parent 8e767da29e
commit d4b7f66e15
30 changed files with 144 additions and 218 deletions

View File

@@ -81,8 +81,6 @@ final class PotionType{
__construct as Enum___construct;
}
private string $displayName;
protected static function setup() : void{
self::registerAll(
new self("water", "Water", fn() => []),
@@ -204,16 +202,15 @@ final class PotionType{
);
}
/** @phpstan-var \Closure() : list<EffectInstance> */
private \Closure $effectsGetter;
/**
* @phpstan-param \Closure() : list<EffectInstance> $effectsGetter
*/
private function __construct(string $enumName, string $displayName, \Closure $effectsGetter){
private function __construct(
string $enumName,
private string $displayName,
private \Closure $effectsGetter
){
$this->Enum___construct($enumName);
$this->displayName = $displayName;
$this->effectsGetter = $effectsGetter;
}
public function getDisplayName() : string{ return $this->displayName; }