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