'紧急', self::URGENT => '急迫', self::NORMAL => '普通' }; } //定义一个方法设置标签颜色-如果没有定义自动生成 public function color(): string { return match ($this) { self::EMERGENCY => 'red', self::URGENT => 'orange', self::NORMAL => 'blue' }; } }