Skip to main content

mago_analyzer/
code.rs

1//! This file is auto-generated. Do not edit manually.
2
3/// An issue code representing a specific type of analysis issue.
4///
5/// Each issue code corresponds to a unique identifier for a particular
6/// kind of issue that the analyzer can detect during code analysis.
7///
8/// This enum is non-exhaustive; new issue codes may be added in future versions.
9#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[repr(u16)]
11#[non_exhaustive]
12pub enum IssueCode {
13    AbstractClassUsedAsAttribute,
14    AbstractInstantiation,
15    AlwaysMatchingSwitchCase,
16    AmbiguousClassLikeConstantAccess,
17    AmbiguousInstantiationTarget,
18    AmbiguousObjectMethodAccess,
19    AmbiguousObjectPropertyAccess,
20    ArrayAppendInReadContext,
21    ArrayToStringConversion,
22    AssignmentToConstant,
23    AssignmentToThis,
24    AttributeNotRepeatable,
25    AvoidCatchingError,
26    BackedPropertyReferenceHook,
27    CatchTypeNotThrowable,
28    ClassNotMarkedAsAttribute,
29    CloneInsideLoop,
30    ConditionIsTooComplex,
31    ConflictingReferenceConstraint,
32    ConflictingTemplateEqualityBounds,
33    DeprecatedClass,
34    DeprecatedClosure,
35    DeprecatedConstant,
36    DeprecatedFeature,
37    DeprecatedFunction,
38    DeprecatedMethod,
39    DeprecatedTrait,
40    DirectTraitConstantAccess,
41    DocblockTypeMismatch,
42    DuplicateArrayKey,
43    DuplicateCaughtType,
44    DuplicateClosureUseVariable,
45    DuplicateNamedArgument,
46    DynamicStaticMethodCall,
47    EmptyMatchExpression,
48    EnumInstantiation,
49    EnumIteration,
50    ExcessTemplateParameter,
51    ExpressionIsTooComplex,
52    ExtendFinalClass,
53    FalsableReturnStatement,
54    FalseArgument,
55    FalseIterator,
56    FalseOperand,
57    GenericObjectIteration,
58    HiddenGeneratorReturn,
59    ImplicitResourceToStringCast,
60    ImplicitToStringCast,
61    ImpossibleArrayAccess,
62    ImpossibleArrayAssignment,
63    ImpossibleAssignment,
64    ImpossibleCondition,
65    ImpossibleKeyCheck,
66    ImpossibleNonnullEntryCheck,
67    ImpossibleNullTypeComparison,
68    ImpossibleTypeComparison,
69    ImpureConstruct,
70    ImpureStaticVariable,
71    IncompatibleConstantAccess,
72    IncompatibleConstantOverride,
73    IncompatibleConstantType,
74    IncompatibleConstantVisibility,
75    IncompatibleParameterCount,
76    IncompatibleParameterName,
77    IncompatibleParameterType,
78    IncompatiblePropertyAccess,
79    IncompatiblePropertyDefault,
80    IncompatiblePropertyHookParameterType,
81    IncompatiblePropertyHookSignature,
82    IncompatiblePropertyOverride,
83    IncompatiblePropertyReadonly,
84    IncompatiblePropertyStatic,
85    IncompatiblePropertyType,
86    IncompatiblePropertyVisibility,
87    IncompatibleReadonlyModifier,
88    IncompatibleReturnType,
89    IncompatibleStaticModifier,
90    IncompatibleTemplateLowerBound,
91    IncompatibleVisibility,
92    InconsistentTemplate,
93    InterfaceInstantiation,
94    InvalidArgument,
95    InvalidArrayAccess,
96    InvalidArrayAccessAssignmentValue,
97    InvalidArrayElement,
98    InvalidArrayElementKey,
99    InvalidArrayIndex,
100    InvalidAssignment,
101    InvalidAttributeTarget,
102    InvalidBreak,
103    InvalidCallable,
104    InvalidCatchType,
105    InvalidCatchTypeNotClassOrInterface,
106    InvalidClassConstantOnString,
107    InvalidClassStringExpression,
108    InvalidClone,
109    InvalidConstantSelector,
110    InvalidContinue,
111    InvalidDestructuringSource,
112    InvalidDocblock,
113    InvalidEnumCaseValue,
114    InvalidExtend,
115    InvalidForeachKey,
116    InvalidForeachValue,
117    InvalidGeneratorReturnType,
118    InvalidGlobal,
119    InvalidImplement,
120    InvalidIssetExpression,
121    InvalidIterator,
122    InvalidMemberSelector,
123    InvalidMethodAccess,
124    InvalidNamedArgument,
125    InvalidOperand,
126    InvalidOverrideAttribute,
127    InvalidParentType,
128    InvalidPassByReference,
129    InvalidPropertyAccess,
130    InvalidPropertyAssignmentValue,
131    InvalidPropertyRead,
132    InvalidPropertyWrite,
133    InvalidReturnStatement,
134    InvalidScopeKeywordContext,
135    InvalidStaticMethodAccess,
136    InvalidStaticMethodCall,
137    InvalidStaticPropertyAccess,
138    InvalidTemplateParameter,
139    InvalidThrow,
140    InvalidTraitAliasModifier,
141    InvalidTraitUse,
142    InvalidTypeCast,
143    InvalidUnset,
144    InvalidYieldKeyType,
145    InvalidYieldValueType,
146    LessSpecificArgument,
147    LessSpecificNestedArgumentType,
148    LessSpecificNestedReturnStatement,
149    LessSpecificReturnStatement,
150    ListUsedInReadContext,
151    MatchArmAlwaysTrue,
152    MatchDefaultArmAlwaysExecuted,
153    MatchExpressionOnlyDefaultArm,
154    MatchNotExhaustive,
155    MatchSubjectTypeIsNever,
156    MethodAccessOnNull,
157    MismatchedArrayIndex,
158    MissingConstantType,
159    MissingConstructor,
160    MissingMagicMethod,
161    MissingOverrideAttribute,
162    MissingParameterType,
163    MissingPropertyType,
164    MissingRequiredInterface,
165    MissingRequiredParent,
166    MissingReturnStatement,
167    MissingReturnType,
168    MissingTemplateParameter,
169    MixedArgument,
170    MixedArrayAccess,
171    MixedArrayAssignment,
172    MixedArrayIndex,
173    MixedAssignment,
174    MixedClone,
175    MixedDestructuringShape,
176    MixedMethodAccess,
177    MixedOperand,
178    MixedPropertyAccess,
179    MixedPropertyTypeCoercion,
180    MixedReturnStatement,
181    NameAlreadyInUse,
182    NamedArgumentAfterPositional,
183    NamedArgumentNotAllowed,
184    NamedArgumentOverridesPositional,
185    NeverMatchingSwitchCase,
186    NeverReturn,
187    NoValidCatchTypeFound,
188    NoValue,
189    NonClassUsedAsAttribute,
190    NonDocumentedConstant,
191    NonDocumentedMethod,
192    NonDocumentedProperty,
193    NonExistentAttributeClass,
194    NonExistentCatchType,
195    NonExistentClass,
196    NonExistentClassConstant,
197    NonExistentClassLike,
198    NonExistentConstant,
199    NonExistentFunction,
200    NonExistentMethod,
201    NonExistentProperty,
202    NonExistentUseImport,
203    NonIterableObjectIteration,
204    NonStaticAbstractImplementation,
205    NullArgument,
206    NullArrayAccess,
207    NullArrayIndex,
208    NullIterator,
209    NullOperand,
210    NullPropertyAccess,
211    NullableReturnStatement,
212    OverrideFinalConstant,
213    OverrideFinalMethod,
214    OverrideFinalProperty,
215    OverrideFinalPropertyHook,
216    ParadoxicalCondition,
217    ParentOutsideClassScope,
218    PossibleMethodAccessOnNull,
219    PossiblyFalseArgument,
220    PossiblyFalseIterator,
221    PossiblyFalseOperand,
222    PossiblyInvalidArgument,
223    PossiblyInvalidClone,
224    PossiblyInvalidIterator,
225    PossiblyInvalidOperand,
226    PossiblyNonExistentMethod,
227    PossiblyNonExistentProperty,
228    PossiblyNullArgument,
229    PossiblyNullArrayAccess,
230    PossiblyNullArrayIndex,
231    PossiblyNullIterator,
232    PossiblyNullOperand,
233    PossiblyNullPropertyAccess,
234    PossiblyStaticAccessOnInterface,
235    PossiblyUndefinedArrayIndex,
236    PossiblyUndefinedIntArrayIndex,
237    PossiblyUndefinedStringArrayIndex,
238    PossiblyUndefinedVariable,
239    PropertyTypeCoercion,
240    PsalmTrace,
241    RedundantCast,
242    RedundantComparison,
243    RedundantCondition,
244    RedundantDocblockType,
245    RedundantIssetCheck,
246    RedundantKeyCheck,
247    RedundantLogicalOperation,
248    RedundantNonnullEntryCheck,
249    RedundantNonnullTypeComparison,
250    RedundantNullCoalesce,
251    RedundantNullsafeOperator,
252    RedundantTypeComparison,
253    ReferenceConstraintViolation,
254    ReferenceReusedFromConfusingScope,
255    ReferenceToUndefinedVariable,
256    SelfOutsideClassScope,
257    SkipInKeyedDestructuring,
258    SpreadInDestructuring,
259    StaticAccessOnInterface,
260    StaticOutsideClassScope,
261    StringConstantSelector,
262    StringMemberSelector,
263    TemplateConstraintViolation,
264    TooFewArguments,
265    TooManyArguments,
266    TraitConstantOverride,
267    TraitInstantiation,
268    TypeConfirmation,
269    TypeInspection,
270    UndefinedIntArrayIndex,
271    UndefinedStringArrayIndex,
272    UndefinedVariable,
273    UndefinedVariableInClosureUse,
274    UnevaluatedCode,
275    UnhandledThrownType,
276    UnimplementedAbstractMethod,
277    UnimplementedAbstractPropertyHook,
278    UninitializedProperty,
279    UnknownClassInstantiation,
280    UnknownConstantSelectorType,
281    UnknownIteratorType,
282    UnknownMatchSubjectType,
283    UnknownMemberSelectorType,
284    UnknownYieldFromIteratorType,
285    UnreachableMatchArm,
286    UnreachableMatchDefaultArm,
287    UnreachableSwitchCase,
288    UnreachableSwitchDefault,
289    UnsafeInstantiation,
290    UnusedFunctionCall,
291    UnusedMethod,
292    UnusedMethodCall,
293    UnusedParameter,
294    UnusedProperty,
295    UnusedStatement,
296    UnusedTemplateParameter,
297    UselessControlFlow,
298    WhereConstraintViolation,
299    WriteOnlyProperty,
300    YieldFromInvalidKeyType,
301    YieldFromInvalidSendType,
302    YieldFromInvalidValueType,
303    YieldFromNonIterable,
304    YieldOutsideFunction,
305}
306
307impl IssueCode {
308    pub fn as_str(&self) -> &'static str {
309        match self {
310            Self::AbstractClassUsedAsAttribute => "abstract-class-used-as-attribute",
311            Self::AbstractInstantiation => "abstract-instantiation",
312            Self::AlwaysMatchingSwitchCase => "always-matching-switch-case",
313            Self::AmbiguousClassLikeConstantAccess => "ambiguous-class-like-constant-access",
314            Self::AmbiguousInstantiationTarget => "ambiguous-instantiation-target",
315            Self::AmbiguousObjectMethodAccess => "ambiguous-object-method-access",
316            Self::AmbiguousObjectPropertyAccess => "ambiguous-object-property-access",
317            Self::ArrayAppendInReadContext => "array-append-in-read-context",
318            Self::ArrayToStringConversion => "array-to-string-conversion",
319            Self::AssignmentToConstant => "assignment-to-constant",
320            Self::AssignmentToThis => "assignment-to-this",
321            Self::AttributeNotRepeatable => "attribute-not-repeatable",
322            Self::AvoidCatchingError => "avoid-catching-error",
323            Self::BackedPropertyReferenceHook => "backed-property-reference-hook",
324            Self::CatchTypeNotThrowable => "catch-type-not-throwable",
325            Self::ClassNotMarkedAsAttribute => "class-not-marked-as-attribute",
326            Self::CloneInsideLoop => "clone-inside-loop",
327            Self::ConditionIsTooComplex => "condition-is-too-complex",
328            Self::ConflictingReferenceConstraint => "conflicting-reference-constraint",
329            Self::ConflictingTemplateEqualityBounds => "conflicting-template-equality-bounds",
330            Self::DeprecatedClass => "deprecated-class",
331            Self::DeprecatedClosure => "deprecated-closure",
332            Self::DeprecatedConstant => "deprecated-constant",
333            Self::DeprecatedFeature => "deprecated-feature",
334            Self::DeprecatedFunction => "deprecated-function",
335            Self::DeprecatedMethod => "deprecated-method",
336            Self::DeprecatedTrait => "deprecated-trait",
337            Self::DirectTraitConstantAccess => "direct-trait-constant-access",
338            Self::DocblockTypeMismatch => "docblock-type-mismatch",
339            Self::DuplicateArrayKey => "duplicate-array-key",
340            Self::DuplicateCaughtType => "duplicate-caught-type",
341            Self::DuplicateClosureUseVariable => "duplicate-closure-use-variable",
342            Self::DuplicateNamedArgument => "duplicate-named-argument",
343            Self::DynamicStaticMethodCall => "dynamic-static-method-call",
344            Self::EmptyMatchExpression => "empty-match-expression",
345            Self::EnumInstantiation => "enum-instantiation",
346            Self::EnumIteration => "enum-iteration",
347            Self::ExcessTemplateParameter => "excess-template-parameter",
348            Self::ExpressionIsTooComplex => "expression-is-too-complex",
349            Self::ExtendFinalClass => "extend-final-class",
350            Self::FalsableReturnStatement => "falsable-return-statement",
351            Self::FalseArgument => "false-argument",
352            Self::FalseIterator => "false-iterator",
353            Self::FalseOperand => "false-operand",
354            Self::GenericObjectIteration => "generic-object-iteration",
355            Self::HiddenGeneratorReturn => "hidden-generator-return",
356            Self::ImplicitResourceToStringCast => "implicit-resource-to-string-cast",
357            Self::ImplicitToStringCast => "implicit-to-string-cast",
358            Self::ImpossibleArrayAccess => "impossible-array-access",
359            Self::ImpossibleArrayAssignment => "impossible-array-assignment",
360            Self::ImpossibleAssignment => "impossible-assignment",
361            Self::ImpossibleCondition => "impossible-condition",
362            Self::ImpossibleKeyCheck => "impossible-key-check",
363            Self::ImpossibleNonnullEntryCheck => "impossible-nonnull-entry-check",
364            Self::ImpossibleNullTypeComparison => "impossible-null-type-comparison",
365            Self::ImpossibleTypeComparison => "impossible-type-comparison",
366            Self::ImpureConstruct => "impure-construct",
367            Self::ImpureStaticVariable => "impure-static-variable",
368            Self::IncompatibleConstantAccess => "incompatible-constant-access",
369            Self::IncompatibleConstantOverride => "incompatible-constant-override",
370            Self::IncompatibleConstantType => "incompatible-constant-type",
371            Self::IncompatibleConstantVisibility => "incompatible-constant-visibility",
372            Self::IncompatibleParameterCount => "incompatible-parameter-count",
373            Self::IncompatibleParameterName => "incompatible-parameter-name",
374            Self::IncompatibleParameterType => "incompatible-parameter-type",
375            Self::IncompatiblePropertyAccess => "incompatible-property-access",
376            Self::IncompatiblePropertyDefault => "incompatible-property-default",
377            Self::IncompatiblePropertyHookParameterType => "incompatible-property-hook-parameter-type",
378            Self::IncompatiblePropertyHookSignature => "incompatible-property-hook-signature",
379            Self::IncompatiblePropertyOverride => "incompatible-property-override",
380            Self::IncompatiblePropertyReadonly => "incompatible-property-readonly",
381            Self::IncompatiblePropertyStatic => "incompatible-property-static",
382            Self::IncompatiblePropertyType => "incompatible-property-type",
383            Self::IncompatiblePropertyVisibility => "incompatible-property-visibility",
384            Self::IncompatibleReadonlyModifier => "incompatible-readonly-modifier",
385            Self::IncompatibleReturnType => "incompatible-return-type",
386            Self::IncompatibleStaticModifier => "incompatible-static-modifier",
387            Self::IncompatibleTemplateLowerBound => "incompatible-template-lower-bound",
388            Self::IncompatibleVisibility => "incompatible-visibility",
389            Self::InconsistentTemplate => "inconsistent-template",
390            Self::InterfaceInstantiation => "interface-instantiation",
391            Self::InvalidArgument => "invalid-argument",
392            Self::InvalidArrayAccess => "invalid-array-access",
393            Self::InvalidArrayAccessAssignmentValue => "invalid-array-access-assignment-value",
394            Self::InvalidArrayElement => "invalid-array-element",
395            Self::InvalidArrayElementKey => "invalid-array-element-key",
396            Self::InvalidArrayIndex => "invalid-array-index",
397            Self::InvalidAssignment => "invalid-assignment",
398            Self::InvalidAttributeTarget => "invalid-attribute-target",
399            Self::InvalidBreak => "invalid-break",
400            Self::InvalidCallable => "invalid-callable",
401            Self::InvalidCatchType => "invalid-catch-type",
402            Self::InvalidCatchTypeNotClassOrInterface => "invalid-catch-type-not-class-or-interface",
403            Self::InvalidClassConstantOnString => "invalid-class-constant-on-string",
404            Self::InvalidClassStringExpression => "invalid-class-string-expression",
405            Self::InvalidClone => "invalid-clone",
406            Self::InvalidConstantSelector => "invalid-constant-selector",
407            Self::InvalidContinue => "invalid-continue",
408            Self::InvalidDestructuringSource => "invalid-destructuring-source",
409            Self::InvalidDocblock => "invalid-docblock",
410            Self::InvalidEnumCaseValue => "invalid-enum-case-value",
411            Self::InvalidExtend => "invalid-extend",
412            Self::InvalidForeachKey => "invalid-foreach-key",
413            Self::InvalidForeachValue => "invalid-foreach-value",
414            Self::InvalidGeneratorReturnType => "invalid-generator-return-type",
415            Self::InvalidGlobal => "invalid-global",
416            Self::InvalidImplement => "invalid-implement",
417            Self::InvalidIssetExpression => "invalid-isset-expression",
418            Self::InvalidIterator => "invalid-iterator",
419            Self::InvalidMemberSelector => "invalid-member-selector",
420            Self::InvalidMethodAccess => "invalid-method-access",
421            Self::InvalidNamedArgument => "invalid-named-argument",
422            Self::InvalidOperand => "invalid-operand",
423            Self::InvalidOverrideAttribute => "invalid-override-attribute",
424            Self::InvalidParentType => "invalid-parent-type",
425            Self::InvalidPassByReference => "invalid-pass-by-reference",
426            Self::InvalidPropertyAccess => "invalid-property-access",
427            Self::InvalidPropertyAssignmentValue => "invalid-property-assignment-value",
428            Self::InvalidPropertyRead => "invalid-property-read",
429            Self::InvalidPropertyWrite => "invalid-property-write",
430            Self::InvalidReturnStatement => "invalid-return-statement",
431            Self::InvalidScopeKeywordContext => "invalid-scope-keyword-context",
432            Self::InvalidStaticMethodAccess => "invalid-static-method-access",
433            Self::InvalidStaticMethodCall => "invalid-static-method-call",
434            Self::InvalidStaticPropertyAccess => "invalid-static-property-access",
435            Self::InvalidTemplateParameter => "invalid-template-parameter",
436            Self::InvalidThrow => "invalid-throw",
437            Self::InvalidTraitAliasModifier => "invalid-trait-alias-modifier",
438            Self::InvalidTraitUse => "invalid-trait-use",
439            Self::InvalidTypeCast => "invalid-type-cast",
440            Self::InvalidUnset => "invalid-unset",
441            Self::InvalidYieldKeyType => "invalid-yield-key-type",
442            Self::InvalidYieldValueType => "invalid-yield-value-type",
443            Self::LessSpecificArgument => "less-specific-argument",
444            Self::LessSpecificNestedArgumentType => "less-specific-nested-argument-type",
445            Self::LessSpecificNestedReturnStatement => "less-specific-nested-return-statement",
446            Self::LessSpecificReturnStatement => "less-specific-return-statement",
447            Self::ListUsedInReadContext => "list-used-in-read-context",
448            Self::MatchArmAlwaysTrue => "match-arm-always-true",
449            Self::MatchDefaultArmAlwaysExecuted => "match-default-arm-always-executed",
450            Self::MatchExpressionOnlyDefaultArm => "match-expression-only-default-arm",
451            Self::MatchNotExhaustive => "match-not-exhaustive",
452            Self::MatchSubjectTypeIsNever => "match-subject-type-is-never",
453            Self::MethodAccessOnNull => "method-access-on-null",
454            Self::MismatchedArrayIndex => "mismatched-array-index",
455            Self::MissingConstantType => "missing-constant-type",
456            Self::MissingConstructor => "missing-constructor",
457            Self::MissingMagicMethod => "missing-magic-method",
458            Self::MissingOverrideAttribute => "missing-override-attribute",
459            Self::MissingParameterType => "missing-parameter-type",
460            Self::MissingPropertyType => "missing-property-type",
461            Self::MissingRequiredInterface => "missing-required-interface",
462            Self::MissingRequiredParent => "missing-required-parent",
463            Self::MissingReturnStatement => "missing-return-statement",
464            Self::MissingReturnType => "missing-return-type",
465            Self::MissingTemplateParameter => "missing-template-parameter",
466            Self::MixedArgument => "mixed-argument",
467            Self::MixedArrayAccess => "mixed-array-access",
468            Self::MixedArrayAssignment => "mixed-array-assignment",
469            Self::MixedArrayIndex => "mixed-array-index",
470            Self::MixedAssignment => "mixed-assignment",
471            Self::MixedClone => "mixed-clone",
472            Self::MixedDestructuringShape => "mixed-destructuring-shape",
473            Self::MixedMethodAccess => "mixed-method-access",
474            Self::MixedOperand => "mixed-operand",
475            Self::MixedPropertyAccess => "mixed-property-access",
476            Self::MixedPropertyTypeCoercion => "mixed-property-type-coercion",
477            Self::MixedReturnStatement => "mixed-return-statement",
478            Self::NameAlreadyInUse => "name-already-in-use",
479            Self::NamedArgumentAfterPositional => "named-argument-after-positional",
480            Self::NamedArgumentNotAllowed => "named-argument-not-allowed",
481            Self::NamedArgumentOverridesPositional => "named-argument-overrides-positional",
482            Self::NeverMatchingSwitchCase => "never-matching-switch-case",
483            Self::NeverReturn => "never-return",
484            Self::NoValidCatchTypeFound => "no-valid-catch-type-found",
485            Self::NoValue => "no-value",
486            Self::NonClassUsedAsAttribute => "non-class-used-as-attribute",
487            Self::NonDocumentedConstant => "non-documented-constant",
488            Self::NonDocumentedMethod => "non-documented-method",
489            Self::NonDocumentedProperty => "non-documented-property",
490            Self::NonExistentAttributeClass => "non-existent-attribute-class",
491            Self::NonExistentCatchType => "non-existent-catch-type",
492            Self::NonExistentClass => "non-existent-class",
493            Self::NonExistentClassConstant => "non-existent-class-constant",
494            Self::NonExistentClassLike => "non-existent-class-like",
495            Self::NonExistentConstant => "non-existent-constant",
496            Self::NonExistentFunction => "non-existent-function",
497            Self::NonExistentMethod => "non-existent-method",
498            Self::NonExistentProperty => "non-existent-property",
499            Self::NonExistentUseImport => "non-existent-use-import",
500            Self::NonIterableObjectIteration => "non-iterable-object-iteration",
501            Self::NonStaticAbstractImplementation => "non-static-abstract-implementation",
502            Self::NullArgument => "null-argument",
503            Self::NullArrayAccess => "null-array-access",
504            Self::NullArrayIndex => "null-array-index",
505            Self::NullIterator => "null-iterator",
506            Self::NullOperand => "null-operand",
507            Self::NullPropertyAccess => "null-property-access",
508            Self::NullableReturnStatement => "nullable-return-statement",
509            Self::OverrideFinalConstant => "override-final-constant",
510            Self::OverrideFinalMethod => "override-final-method",
511            Self::OverrideFinalProperty => "override-final-property",
512            Self::OverrideFinalPropertyHook => "override-final-property-hook",
513            Self::ParadoxicalCondition => "paradoxical-condition",
514            Self::ParentOutsideClassScope => "parent-outside-class-scope",
515            Self::PossibleMethodAccessOnNull => "possible-method-access-on-null",
516            Self::PossiblyFalseArgument => "possibly-false-argument",
517            Self::PossiblyFalseIterator => "possibly-false-iterator",
518            Self::PossiblyFalseOperand => "possibly-false-operand",
519            Self::PossiblyInvalidArgument => "possibly-invalid-argument",
520            Self::PossiblyInvalidClone => "possibly-invalid-clone",
521            Self::PossiblyInvalidIterator => "possibly-invalid-iterator",
522            Self::PossiblyInvalidOperand => "possibly-invalid-operand",
523            Self::PossiblyNonExistentMethod => "possibly-non-existent-method",
524            Self::PossiblyNonExistentProperty => "possibly-non-existent-property",
525            Self::PossiblyNullArgument => "possibly-null-argument",
526            Self::PossiblyNullArrayAccess => "possibly-null-array-access",
527            Self::PossiblyNullArrayIndex => "possibly-null-array-index",
528            Self::PossiblyNullIterator => "possibly-null-iterator",
529            Self::PossiblyNullOperand => "possibly-null-operand",
530            Self::PossiblyNullPropertyAccess => "possibly-null-property-access",
531            Self::PossiblyStaticAccessOnInterface => "possibly-static-access-on-interface",
532            Self::PossiblyUndefinedArrayIndex => "possibly-undefined-array-index",
533            Self::PossiblyUndefinedIntArrayIndex => "possibly-undefined-int-array-index",
534            Self::PossiblyUndefinedStringArrayIndex => "possibly-undefined-string-array-index",
535            Self::PossiblyUndefinedVariable => "possibly-undefined-variable",
536            Self::PropertyTypeCoercion => "property-type-coercion",
537            Self::PsalmTrace => "psalm-trace",
538            Self::RedundantCast => "redundant-cast",
539            Self::RedundantComparison => "redundant-comparison",
540            Self::RedundantCondition => "redundant-condition",
541            Self::RedundantDocblockType => "redundant-docblock-type",
542            Self::RedundantIssetCheck => "redundant-isset-check",
543            Self::RedundantKeyCheck => "redundant-key-check",
544            Self::RedundantLogicalOperation => "redundant-logical-operation",
545            Self::RedundantNonnullEntryCheck => "redundant-nonnull-entry-check",
546            Self::RedundantNonnullTypeComparison => "redundant-nonnull-type-comparison",
547            Self::RedundantNullCoalesce => "redundant-null-coalesce",
548            Self::RedundantNullsafeOperator => "redundant-nullsafe-operator",
549            Self::RedundantTypeComparison => "redundant-type-comparison",
550            Self::ReferenceConstraintViolation => "reference-constraint-violation",
551            Self::ReferenceReusedFromConfusingScope => "reference-reused-from-confusing-scope",
552            Self::ReferenceToUndefinedVariable => "reference-to-undefined-variable",
553            Self::SelfOutsideClassScope => "self-outside-class-scope",
554            Self::SkipInKeyedDestructuring => "skip-in-keyed-destructuring",
555            Self::SpreadInDestructuring => "spread-in-destructuring",
556            Self::StaticAccessOnInterface => "static-access-on-interface",
557            Self::StaticOutsideClassScope => "static-outside-class-scope",
558            Self::StringConstantSelector => "string-constant-selector",
559            Self::StringMemberSelector => "string-member-selector",
560            Self::TemplateConstraintViolation => "template-constraint-violation",
561            Self::TooFewArguments => "too-few-arguments",
562            Self::TooManyArguments => "too-many-arguments",
563            Self::TraitConstantOverride => "trait-constant-override",
564            Self::TraitInstantiation => "trait-instantiation",
565            Self::TypeConfirmation => "type-confirmation",
566            Self::TypeInspection => "type-inspection",
567            Self::UndefinedIntArrayIndex => "undefined-int-array-index",
568            Self::UndefinedStringArrayIndex => "undefined-string-array-index",
569            Self::UndefinedVariable => "undefined-variable",
570            Self::UndefinedVariableInClosureUse => "undefined-variable-in-closure-use",
571            Self::UnevaluatedCode => "unevaluated-code",
572            Self::UnhandledThrownType => "unhandled-thrown-type",
573            Self::UnimplementedAbstractMethod => "unimplemented-abstract-method",
574            Self::UnimplementedAbstractPropertyHook => "unimplemented-abstract-property-hook",
575            Self::UninitializedProperty => "uninitialized-property",
576            Self::UnknownClassInstantiation => "unknown-class-instantiation",
577            Self::UnknownConstantSelectorType => "unknown-constant-selector-type",
578            Self::UnknownIteratorType => "unknown-iterator-type",
579            Self::UnknownMatchSubjectType => "unknown-match-subject-type",
580            Self::UnknownMemberSelectorType => "unknown-member-selector-type",
581            Self::UnknownYieldFromIteratorType => "unknown-yield-from-iterator-type",
582            Self::UnreachableMatchArm => "unreachable-match-arm",
583            Self::UnreachableMatchDefaultArm => "unreachable-match-default-arm",
584            Self::UnreachableSwitchCase => "unreachable-switch-case",
585            Self::UnreachableSwitchDefault => "unreachable-switch-default",
586            Self::UnsafeInstantiation => "unsafe-instantiation",
587            Self::UnusedFunctionCall => "unused-function-call",
588            Self::UnusedMethod => "unused-method",
589            Self::UnusedMethodCall => "unused-method-call",
590            Self::UnusedParameter => "unused-parameter",
591            Self::UnusedProperty => "unused-property",
592            Self::UnusedStatement => "unused-statement",
593            Self::UnusedTemplateParameter => "unused-template-parameter",
594            Self::UselessControlFlow => "useless-control-flow",
595            Self::WhereConstraintViolation => "where-constraint-violation",
596            Self::WriteOnlyProperty => "write-only-property",
597            Self::YieldFromInvalidKeyType => "yield-from-invalid-key-type",
598            Self::YieldFromInvalidSendType => "yield-from-invalid-send-type",
599            Self::YieldFromInvalidValueType => "yield-from-invalid-value-type",
600            Self::YieldFromNonIterable => "yield-from-non-iterable",
601            Self::YieldOutsideFunction => "yield-outside-function",
602        }
603    }
604
605    pub fn as_u16(&self) -> u16 {
606        *self as u16
607    }
608}
609
610impl std::str::FromStr for IssueCode {
611    type Err = &'static str;
612
613    fn from_str(s: &str) -> Result<Self, Self::Err> {
614        match s {
615            "abstract-class-used-as-attribute" => Ok(Self::AbstractClassUsedAsAttribute),
616            "abstract-instantiation" => Ok(Self::AbstractInstantiation),
617            "always-matching-switch-case" => Ok(Self::AlwaysMatchingSwitchCase),
618            "ambiguous-class-like-constant-access" => Ok(Self::AmbiguousClassLikeConstantAccess),
619            "ambiguous-instantiation-target" => Ok(Self::AmbiguousInstantiationTarget),
620            "ambiguous-object-method-access" => Ok(Self::AmbiguousObjectMethodAccess),
621            "ambiguous-object-property-access" => Ok(Self::AmbiguousObjectPropertyAccess),
622            "array-append-in-read-context" => Ok(Self::ArrayAppendInReadContext),
623            "array-to-string-conversion" => Ok(Self::ArrayToStringConversion),
624            "assignment-to-constant" => Ok(Self::AssignmentToConstant),
625            "assignment-to-this" => Ok(Self::AssignmentToThis),
626            "attribute-not-repeatable" => Ok(Self::AttributeNotRepeatable),
627            "avoid-catching-error" => Ok(Self::AvoidCatchingError),
628            "backed-property-reference-hook" => Ok(Self::BackedPropertyReferenceHook),
629            "catch-type-not-throwable" => Ok(Self::CatchTypeNotThrowable),
630            "class-not-marked-as-attribute" => Ok(Self::ClassNotMarkedAsAttribute),
631            "clone-inside-loop" => Ok(Self::CloneInsideLoop),
632            "condition-is-too-complex" => Ok(Self::ConditionIsTooComplex),
633            "conflicting-reference-constraint" => Ok(Self::ConflictingReferenceConstraint),
634            "conflicting-template-equality-bounds" => Ok(Self::ConflictingTemplateEqualityBounds),
635            "deprecated-class" => Ok(Self::DeprecatedClass),
636            "deprecated-closure" => Ok(Self::DeprecatedClosure),
637            "deprecated-constant" => Ok(Self::DeprecatedConstant),
638            "deprecated-feature" => Ok(Self::DeprecatedFeature),
639            "deprecated-function" => Ok(Self::DeprecatedFunction),
640            "deprecated-method" => Ok(Self::DeprecatedMethod),
641            "deprecated-trait" => Ok(Self::DeprecatedTrait),
642            "direct-trait-constant-access" => Ok(Self::DirectTraitConstantAccess),
643            "docblock-type-mismatch" => Ok(Self::DocblockTypeMismatch),
644            "duplicate-array-key" => Ok(Self::DuplicateArrayKey),
645            "duplicate-caught-type" => Ok(Self::DuplicateCaughtType),
646            "duplicate-closure-use-variable" => Ok(Self::DuplicateClosureUseVariable),
647            "duplicate-named-argument" => Ok(Self::DuplicateNamedArgument),
648            "dynamic-static-method-call" => Ok(Self::DynamicStaticMethodCall),
649            "empty-match-expression" => Ok(Self::EmptyMatchExpression),
650            "enum-instantiation" => Ok(Self::EnumInstantiation),
651            "enum-iteration" => Ok(Self::EnumIteration),
652            "excess-template-parameter" => Ok(Self::ExcessTemplateParameter),
653            "expression-is-too-complex" => Ok(Self::ExpressionIsTooComplex),
654            "extend-final-class" => Ok(Self::ExtendFinalClass),
655            "falsable-return-statement" => Ok(Self::FalsableReturnStatement),
656            "false-argument" => Ok(Self::FalseArgument),
657            "false-iterator" => Ok(Self::FalseIterator),
658            "false-operand" => Ok(Self::FalseOperand),
659            "generic-object-iteration" => Ok(Self::GenericObjectIteration),
660            "hidden-generator-return" => Ok(Self::HiddenGeneratorReturn),
661            "implicit-resource-to-string-cast" => Ok(Self::ImplicitResourceToStringCast),
662            "implicit-to-string-cast" => Ok(Self::ImplicitToStringCast),
663            "impossible-array-access" => Ok(Self::ImpossibleArrayAccess),
664            "impossible-array-assignment" => Ok(Self::ImpossibleArrayAssignment),
665            "impossible-assignment" => Ok(Self::ImpossibleAssignment),
666            "impossible-condition" => Ok(Self::ImpossibleCondition),
667            "impossible-key-check" => Ok(Self::ImpossibleKeyCheck),
668            "impossible-nonnull-entry-check" => Ok(Self::ImpossibleNonnullEntryCheck),
669            "impossible-null-type-comparison" => Ok(Self::ImpossibleNullTypeComparison),
670            "impossible-type-comparison" => Ok(Self::ImpossibleTypeComparison),
671            "impure-construct" => Ok(Self::ImpureConstruct),
672            "impure-static-variable" => Ok(Self::ImpureStaticVariable),
673            "incompatible-constant-access" => Ok(Self::IncompatibleConstantAccess),
674            "incompatible-constant-override" => Ok(Self::IncompatibleConstantOverride),
675            "incompatible-constant-type" => Ok(Self::IncompatibleConstantType),
676            "incompatible-constant-visibility" => Ok(Self::IncompatibleConstantVisibility),
677            "incompatible-parameter-count" => Ok(Self::IncompatibleParameterCount),
678            "incompatible-parameter-name" => Ok(Self::IncompatibleParameterName),
679            "incompatible-parameter-type" => Ok(Self::IncompatibleParameterType),
680            "incompatible-property-access" => Ok(Self::IncompatiblePropertyAccess),
681            "incompatible-property-default" => Ok(Self::IncompatiblePropertyDefault),
682            "incompatible-property-hook-parameter-type" => Ok(Self::IncompatiblePropertyHookParameterType),
683            "incompatible-property-hook-signature" => Ok(Self::IncompatiblePropertyHookSignature),
684            "incompatible-property-override" => Ok(Self::IncompatiblePropertyOverride),
685            "incompatible-property-readonly" => Ok(Self::IncompatiblePropertyReadonly),
686            "incompatible-property-static" => Ok(Self::IncompatiblePropertyStatic),
687            "incompatible-property-type" => Ok(Self::IncompatiblePropertyType),
688            "incompatible-property-visibility" => Ok(Self::IncompatiblePropertyVisibility),
689            "incompatible-readonly-modifier" => Ok(Self::IncompatibleReadonlyModifier),
690            "incompatible-return-type" => Ok(Self::IncompatibleReturnType),
691            "incompatible-static-modifier" => Ok(Self::IncompatibleStaticModifier),
692            "incompatible-template-lower-bound" => Ok(Self::IncompatibleTemplateLowerBound),
693            "incompatible-visibility" => Ok(Self::IncompatibleVisibility),
694            "inconsistent-template" => Ok(Self::InconsistentTemplate),
695            "interface-instantiation" => Ok(Self::InterfaceInstantiation),
696            "invalid-argument" => Ok(Self::InvalidArgument),
697            "invalid-array-access" => Ok(Self::InvalidArrayAccess),
698            "invalid-array-access-assignment-value" => Ok(Self::InvalidArrayAccessAssignmentValue),
699            "invalid-array-element" => Ok(Self::InvalidArrayElement),
700            "invalid-array-element-key" => Ok(Self::InvalidArrayElementKey),
701            "invalid-array-index" => Ok(Self::InvalidArrayIndex),
702            "invalid-assignment" => Ok(Self::InvalidAssignment),
703            "invalid-attribute-target" => Ok(Self::InvalidAttributeTarget),
704            "invalid-break" => Ok(Self::InvalidBreak),
705            "invalid-callable" => Ok(Self::InvalidCallable),
706            "invalid-catch-type" => Ok(Self::InvalidCatchType),
707            "invalid-catch-type-not-class-or-interface" => Ok(Self::InvalidCatchTypeNotClassOrInterface),
708            "invalid-class-constant-on-string" => Ok(Self::InvalidClassConstantOnString),
709            "invalid-class-string-expression" => Ok(Self::InvalidClassStringExpression),
710            "invalid-clone" => Ok(Self::InvalidClone),
711            "invalid-constant-selector" => Ok(Self::InvalidConstantSelector),
712            "invalid-continue" => Ok(Self::InvalidContinue),
713            "invalid-destructuring-source" => Ok(Self::InvalidDestructuringSource),
714            "invalid-docblock" => Ok(Self::InvalidDocblock),
715            "invalid-enum-case-value" => Ok(Self::InvalidEnumCaseValue),
716            "invalid-extend" => Ok(Self::InvalidExtend),
717            "invalid-foreach-key" => Ok(Self::InvalidForeachKey),
718            "invalid-foreach-value" => Ok(Self::InvalidForeachValue),
719            "invalid-generator-return-type" => Ok(Self::InvalidGeneratorReturnType),
720            "invalid-global" => Ok(Self::InvalidGlobal),
721            "invalid-implement" => Ok(Self::InvalidImplement),
722            "invalid-isset-expression" => Ok(Self::InvalidIssetExpression),
723            "invalid-iterator" => Ok(Self::InvalidIterator),
724            "invalid-member-selector" => Ok(Self::InvalidMemberSelector),
725            "invalid-method-access" => Ok(Self::InvalidMethodAccess),
726            "invalid-named-argument" => Ok(Self::InvalidNamedArgument),
727            "invalid-operand" => Ok(Self::InvalidOperand),
728            "invalid-override-attribute" => Ok(Self::InvalidOverrideAttribute),
729            "invalid-parent-type" => Ok(Self::InvalidParentType),
730            "invalid-pass-by-reference" => Ok(Self::InvalidPassByReference),
731            "invalid-property-access" => Ok(Self::InvalidPropertyAccess),
732            "invalid-property-assignment-value" => Ok(Self::InvalidPropertyAssignmentValue),
733            "invalid-property-read" => Ok(Self::InvalidPropertyRead),
734            "invalid-property-write" => Ok(Self::InvalidPropertyWrite),
735            "invalid-return-statement" => Ok(Self::InvalidReturnStatement),
736            "invalid-scope-keyword-context" => Ok(Self::InvalidScopeKeywordContext),
737            "invalid-static-method-access" => Ok(Self::InvalidStaticMethodAccess),
738            "invalid-static-method-call" => Ok(Self::InvalidStaticMethodCall),
739            "invalid-static-property-access" => Ok(Self::InvalidStaticPropertyAccess),
740            "invalid-template-parameter" => Ok(Self::InvalidTemplateParameter),
741            "invalid-throw" => Ok(Self::InvalidThrow),
742            "invalid-trait-alias-modifier" => Ok(Self::InvalidTraitAliasModifier),
743            "invalid-trait-use" => Ok(Self::InvalidTraitUse),
744            "invalid-type-cast" => Ok(Self::InvalidTypeCast),
745            "invalid-unset" => Ok(Self::InvalidUnset),
746            "invalid-yield-key-type" => Ok(Self::InvalidYieldKeyType),
747            "invalid-yield-value-type" => Ok(Self::InvalidYieldValueType),
748            "less-specific-argument" => Ok(Self::LessSpecificArgument),
749            "less-specific-nested-argument-type" => Ok(Self::LessSpecificNestedArgumentType),
750            "less-specific-nested-return-statement" => Ok(Self::LessSpecificNestedReturnStatement),
751            "less-specific-return-statement" => Ok(Self::LessSpecificReturnStatement),
752            "list-used-in-read-context" => Ok(Self::ListUsedInReadContext),
753            "match-arm-always-true" => Ok(Self::MatchArmAlwaysTrue),
754            "match-default-arm-always-executed" => Ok(Self::MatchDefaultArmAlwaysExecuted),
755            "match-expression-only-default-arm" => Ok(Self::MatchExpressionOnlyDefaultArm),
756            "match-not-exhaustive" => Ok(Self::MatchNotExhaustive),
757            "match-subject-type-is-never" => Ok(Self::MatchSubjectTypeIsNever),
758            "method-access-on-null" => Ok(Self::MethodAccessOnNull),
759            "mismatched-array-index" => Ok(Self::MismatchedArrayIndex),
760            "missing-constant-type" => Ok(Self::MissingConstantType),
761            "missing-constructor" => Ok(Self::MissingConstructor),
762            "missing-magic-method" => Ok(Self::MissingMagicMethod),
763            "missing-override-attribute" => Ok(Self::MissingOverrideAttribute),
764            "missing-parameter-type" => Ok(Self::MissingParameterType),
765            "missing-property-type" => Ok(Self::MissingPropertyType),
766            "missing-required-interface" => Ok(Self::MissingRequiredInterface),
767            "missing-required-parent" => Ok(Self::MissingRequiredParent),
768            "missing-return-statement" => Ok(Self::MissingReturnStatement),
769            "missing-return-type" => Ok(Self::MissingReturnType),
770            "missing-template-parameter" => Ok(Self::MissingTemplateParameter),
771            "mixed-argument" => Ok(Self::MixedArgument),
772            "mixed-array-access" => Ok(Self::MixedArrayAccess),
773            "mixed-array-assignment" => Ok(Self::MixedArrayAssignment),
774            "mixed-array-index" => Ok(Self::MixedArrayIndex),
775            "mixed-assignment" => Ok(Self::MixedAssignment),
776            "mixed-clone" => Ok(Self::MixedClone),
777            "mixed-destructuring-shape" => Ok(Self::MixedDestructuringShape),
778            "mixed-method-access" => Ok(Self::MixedMethodAccess),
779            "mixed-operand" => Ok(Self::MixedOperand),
780            "mixed-property-access" => Ok(Self::MixedPropertyAccess),
781            "mixed-property-type-coercion" => Ok(Self::MixedPropertyTypeCoercion),
782            "mixed-return-statement" => Ok(Self::MixedReturnStatement),
783            "name-already-in-use" => Ok(Self::NameAlreadyInUse),
784            "named-argument-after-positional" => Ok(Self::NamedArgumentAfterPositional),
785            "named-argument-not-allowed" => Ok(Self::NamedArgumentNotAllowed),
786            "named-argument-overrides-positional" => Ok(Self::NamedArgumentOverridesPositional),
787            "never-matching-switch-case" => Ok(Self::NeverMatchingSwitchCase),
788            "never-return" => Ok(Self::NeverReturn),
789            "no-valid-catch-type-found" => Ok(Self::NoValidCatchTypeFound),
790            "no-value" => Ok(Self::NoValue),
791            "non-class-used-as-attribute" => Ok(Self::NonClassUsedAsAttribute),
792            "non-documented-constant" => Ok(Self::NonDocumentedConstant),
793            "non-documented-method" => Ok(Self::NonDocumentedMethod),
794            "non-documented-property" => Ok(Self::NonDocumentedProperty),
795            "non-existent-attribute-class" => Ok(Self::NonExistentAttributeClass),
796            "non-existent-catch-type" => Ok(Self::NonExistentCatchType),
797            "non-existent-class" => Ok(Self::NonExistentClass),
798            "non-existent-class-constant" => Ok(Self::NonExistentClassConstant),
799            "non-existent-class-like" => Ok(Self::NonExistentClassLike),
800            "non-existent-constant" => Ok(Self::NonExistentConstant),
801            "non-existent-function" => Ok(Self::NonExistentFunction),
802            "non-existent-method" => Ok(Self::NonExistentMethod),
803            "non-existent-property" => Ok(Self::NonExistentProperty),
804            "non-existent-use-import" => Ok(Self::NonExistentUseImport),
805            "non-iterable-object-iteration" => Ok(Self::NonIterableObjectIteration),
806            "non-static-abstract-implementation" => Ok(Self::NonStaticAbstractImplementation),
807            "null-argument" => Ok(Self::NullArgument),
808            "null-array-access" => Ok(Self::NullArrayAccess),
809            "null-array-index" => Ok(Self::NullArrayIndex),
810            "null-iterator" => Ok(Self::NullIterator),
811            "null-operand" => Ok(Self::NullOperand),
812            "null-property-access" => Ok(Self::NullPropertyAccess),
813            "nullable-return-statement" => Ok(Self::NullableReturnStatement),
814            "override-final-constant" => Ok(Self::OverrideFinalConstant),
815            "override-final-method" => Ok(Self::OverrideFinalMethod),
816            "override-final-property" => Ok(Self::OverrideFinalProperty),
817            "override-final-property-hook" => Ok(Self::OverrideFinalPropertyHook),
818            "paradoxical-condition" => Ok(Self::ParadoxicalCondition),
819            "parent-outside-class-scope" => Ok(Self::ParentOutsideClassScope),
820            "possible-method-access-on-null" => Ok(Self::PossibleMethodAccessOnNull),
821            "possibly-false-argument" => Ok(Self::PossiblyFalseArgument),
822            "possibly-false-iterator" => Ok(Self::PossiblyFalseIterator),
823            "possibly-false-operand" => Ok(Self::PossiblyFalseOperand),
824            "possibly-invalid-argument" => Ok(Self::PossiblyInvalidArgument),
825            "possibly-invalid-clone" => Ok(Self::PossiblyInvalidClone),
826            "possibly-invalid-iterator" => Ok(Self::PossiblyInvalidIterator),
827            "possibly-invalid-operand" => Ok(Self::PossiblyInvalidOperand),
828            "possibly-non-existent-method" => Ok(Self::PossiblyNonExistentMethod),
829            "possibly-non-existent-property" => Ok(Self::PossiblyNonExistentProperty),
830            "possibly-null-argument" => Ok(Self::PossiblyNullArgument),
831            "possibly-null-array-access" => Ok(Self::PossiblyNullArrayAccess),
832            "possibly-null-array-index" => Ok(Self::PossiblyNullArrayIndex),
833            "possibly-null-iterator" => Ok(Self::PossiblyNullIterator),
834            "possibly-null-operand" => Ok(Self::PossiblyNullOperand),
835            "possibly-null-property-access" => Ok(Self::PossiblyNullPropertyAccess),
836            "possibly-static-access-on-interface" => Ok(Self::PossiblyStaticAccessOnInterface),
837            "possibly-undefined-array-index" => Ok(Self::PossiblyUndefinedArrayIndex),
838            "possibly-undefined-int-array-index" => Ok(Self::PossiblyUndefinedIntArrayIndex),
839            "possibly-undefined-string-array-index" => Ok(Self::PossiblyUndefinedStringArrayIndex),
840            "possibly-undefined-variable" => Ok(Self::PossiblyUndefinedVariable),
841            "property-type-coercion" => Ok(Self::PropertyTypeCoercion),
842            "psalm-trace" => Ok(Self::PsalmTrace),
843            "redundant-cast" => Ok(Self::RedundantCast),
844            "redundant-comparison" => Ok(Self::RedundantComparison),
845            "redundant-condition" => Ok(Self::RedundantCondition),
846            "redundant-docblock-type" => Ok(Self::RedundantDocblockType),
847            "redundant-isset-check" => Ok(Self::RedundantIssetCheck),
848            "redundant-key-check" => Ok(Self::RedundantKeyCheck),
849            "redundant-logical-operation" => Ok(Self::RedundantLogicalOperation),
850            "redundant-nonnull-entry-check" => Ok(Self::RedundantNonnullEntryCheck),
851            "redundant-nonnull-type-comparison" => Ok(Self::RedundantNonnullTypeComparison),
852            "redundant-null-coalesce" => Ok(Self::RedundantNullCoalesce),
853            "redundant-nullsafe-operator" => Ok(Self::RedundantNullsafeOperator),
854            "redundant-type-comparison" => Ok(Self::RedundantTypeComparison),
855            "reference-constraint-violation" => Ok(Self::ReferenceConstraintViolation),
856            "reference-reused-from-confusing-scope" => Ok(Self::ReferenceReusedFromConfusingScope),
857            "reference-to-undefined-variable" => Ok(Self::ReferenceToUndefinedVariable),
858            "self-outside-class-scope" => Ok(Self::SelfOutsideClassScope),
859            "skip-in-keyed-destructuring" => Ok(Self::SkipInKeyedDestructuring),
860            "spread-in-destructuring" => Ok(Self::SpreadInDestructuring),
861            "static-access-on-interface" => Ok(Self::StaticAccessOnInterface),
862            "static-outside-class-scope" => Ok(Self::StaticOutsideClassScope),
863            "string-constant-selector" => Ok(Self::StringConstantSelector),
864            "string-member-selector" => Ok(Self::StringMemberSelector),
865            "template-constraint-violation" => Ok(Self::TemplateConstraintViolation),
866            "too-few-arguments" => Ok(Self::TooFewArguments),
867            "too-many-arguments" => Ok(Self::TooManyArguments),
868            "trait-constant-override" => Ok(Self::TraitConstantOverride),
869            "trait-instantiation" => Ok(Self::TraitInstantiation),
870            "type-confirmation" => Ok(Self::TypeConfirmation),
871            "type-inspection" => Ok(Self::TypeInspection),
872            "undefined-int-array-index" => Ok(Self::UndefinedIntArrayIndex),
873            "undefined-string-array-index" => Ok(Self::UndefinedStringArrayIndex),
874            "undefined-variable" => Ok(Self::UndefinedVariable),
875            "undefined-variable-in-closure-use" => Ok(Self::UndefinedVariableInClosureUse),
876            "unevaluated-code" => Ok(Self::UnevaluatedCode),
877            "unhandled-thrown-type" => Ok(Self::UnhandledThrownType),
878            "unimplemented-abstract-method" => Ok(Self::UnimplementedAbstractMethod),
879            "unimplemented-abstract-property-hook" => Ok(Self::UnimplementedAbstractPropertyHook),
880            "uninitialized-property" => Ok(Self::UninitializedProperty),
881            "unknown-class-instantiation" => Ok(Self::UnknownClassInstantiation),
882            "unknown-constant-selector-type" => Ok(Self::UnknownConstantSelectorType),
883            "unknown-iterator-type" => Ok(Self::UnknownIteratorType),
884            "unknown-match-subject-type" => Ok(Self::UnknownMatchSubjectType),
885            "unknown-member-selector-type" => Ok(Self::UnknownMemberSelectorType),
886            "unknown-yield-from-iterator-type" => Ok(Self::UnknownYieldFromIteratorType),
887            "unreachable-match-arm" => Ok(Self::UnreachableMatchArm),
888            "unreachable-match-default-arm" => Ok(Self::UnreachableMatchDefaultArm),
889            "unreachable-switch-case" => Ok(Self::UnreachableSwitchCase),
890            "unreachable-switch-default" => Ok(Self::UnreachableSwitchDefault),
891            "unsafe-instantiation" => Ok(Self::UnsafeInstantiation),
892            "unused-function-call" => Ok(Self::UnusedFunctionCall),
893            "unused-method" => Ok(Self::UnusedMethod),
894            "unused-method-call" => Ok(Self::UnusedMethodCall),
895            "unused-parameter" => Ok(Self::UnusedParameter),
896            "unused-property" => Ok(Self::UnusedProperty),
897            "unused-statement" => Ok(Self::UnusedStatement),
898            "unused-template-parameter" => Ok(Self::UnusedTemplateParameter),
899            "useless-control-flow" => Ok(Self::UselessControlFlow),
900            "where-constraint-violation" => Ok(Self::WhereConstraintViolation),
901            "write-only-property" => Ok(Self::WriteOnlyProperty),
902            "yield-from-invalid-key-type" => Ok(Self::YieldFromInvalidKeyType),
903            "yield-from-invalid-send-type" => Ok(Self::YieldFromInvalidSendType),
904            "yield-from-invalid-value-type" => Ok(Self::YieldFromInvalidValueType),
905            "yield-from-non-iterable" => Ok(Self::YieldFromNonIterable),
906            "yield-outside-function" => Ok(Self::YieldOutsideFunction),
907            _ => Err("unknown issue code"),
908        }
909    }
910}
911
912impl std::fmt::Display for IssueCode {
913    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
914        write!(f, "{}", self.as_str())
915    }
916}
917
918impl std::convert::TryFrom<&str> for IssueCode {
919    type Error = &'static str;
920
921    fn try_from(value: &str) -> Result<Self, Self::Error> {
922        <Self as std::str::FromStr>::from_str(value)
923    }
924}
925
926impl std::convert::From<IssueCode> for &'static str {
927    fn from(val: IssueCode) -> Self {
928        val.as_str()
929    }
930}
931
932impl std::convert::From<IssueCode> for String {
933    fn from(val: IssueCode) -> Self {
934        val.as_str().to_string()
935    }
936}
937
938impl std::borrow::Borrow<str> for IssueCode {
939    fn borrow(&self) -> &'static str {
940        self.as_str()
941    }
942}
943
944impl<'a> std::borrow::Borrow<str> for &'a IssueCode {
945    fn borrow(&self) -> &'a str {
946        self.as_str()
947    }
948}