aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/bakame/http-structured-fields/src/Validation/ErrorCode.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/bakame/http-structured-fields/src/Validation/ErrorCode.php')
-rw-r--r--vendor/bakame/http-structured-fields/src/Validation/ErrorCode.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/vendor/bakame/http-structured-fields/src/Validation/ErrorCode.php b/vendor/bakame/http-structured-fields/src/Validation/ErrorCode.php
new file mode 100644
index 000000000..3f6ed43ae
--- /dev/null
+++ b/vendor/bakame/http-structured-fields/src/Validation/ErrorCode.php
@@ -0,0 +1,26 @@
+<?php
+
+namespace Bakame\Http\StructuredFields\Validation;
+
+/**
+ * General Error Code-.
+ *
+ * When adding new codes the name MUST be prefixed with
+ * a `@` to avoid conflicting with parameters keys.
+ */
+enum ErrorCode: string
+{
+ case ItemFailedParsing = '@item.failed.parsing';
+ case ItemValueFailedValidation = '@item.value.failed.validation';
+ case ParametersFailedParsing = '@parameters.failed.parsing';
+ case ParametersMissingConstraints = '@parameters.missing.constraints';
+ case ParametersFailedCriteria = '@parameters.failed.criteria';
+
+ /**
+ * @return array<string>
+ */
+ public static function list(): array
+ {
+ return array_map(fn (self $case) => $case->value, self::cases());
+ }
+}