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