2020-02-17 22:33:28 +01:00
# Error levels
You can run Psalm in at different levels of strictness from 1 to 8.
Level 1 is the most strict, level 8 is the most lenient.
2021-03-11 06:06:02 +01:00
When no level is explicitly defined, psalm defaults to level 2.
2022-12-02 00:57:52 +01:00
Some issues are always treated as errors. These are issues with a very low probability of false-positives.
2020-02-17 22:33:28 +01:00
2022-12-02 00:57:52 +01:00
At level 1 all issues (except those emitted for opt-in features) that Psalm can find are treated as errors. Those issues include any situation where Psalm cannot infer the type of a given expression.
2020-02-17 22:33:28 +01:00
At level 2 Psalm ignores those `Mixed*` issues, but treats most other issues as errors.
At level 3 Psalm starts to be a little more lenient. For example Psalm allows missing param types, return types and property types.
At level 4 Psalm ignores issues for _possible_ problems. These are more likely to be false positives – where the application code may guarantee behaviour that Psalm isn't able to infer.
Level 5 and above allows a more non-verifiable code, and higher levels are even more permissive.
## Always treated as errors
2020-03-19 17:34:48 +01:00
- [AbstractMethodCall ](issues/AbstractMethodCall.md )
2020-11-30 05:21:09 +01:00
- [ComplexFunction ](issues/ComplexFunction.md )
- [ComplexMethod ](issues/ComplexMethod.md )
2021-06-07 16:46:26 +02:00
- [ConfigIssue ](issues/ConfigIssue.md )
2020-03-19 17:34:48 +01:00
- [DuplicateArrayKey ](issues/DuplicateArrayKey.md )
- [DuplicateClass ](issues/DuplicateClass.md )
- [DuplicateFunction ](issues/DuplicateFunction.md )
- [DuplicateMethod ](issues/DuplicateMethod.md )
- [DuplicateParam ](issues/DuplicateParam.md )
- [EmptyArrayAccess ](issues/EmptyArrayAccess.md )
2020-11-30 05:21:09 +01:00
- [ExtensionRequirementViolation ](issues/ExtensionRequirementViolation.md )
- [ImplementationRequirementViolation ](issues/ImplementationRequirementViolation.md )
2020-03-19 17:34:48 +01:00
- [ImpureByReferenceAssignment ](issues/ImpureByReferenceAssignment.md )
- [ImpureFunctionCall ](issues/ImpureFunctionCall.md )
- [ImpureMethodCall ](issues/ImpureMethodCall.md )
- [ImpurePropertyAssignment ](issues/ImpurePropertyAssignment.md )
2020-11-30 05:21:09 +01:00
- [ImpurePropertyFetch ](issues/ImpurePropertyFetch.md )
2020-03-19 17:34:48 +01:00
- [ImpureStaticProperty ](issues/ImpureStaticProperty.md )
- [ImpureStaticVariable ](issues/ImpureStaticVariable.md )
2020-11-30 05:21:09 +01:00
- [ImpureVariable ](issues/ImpureVariable.md )
2020-03-19 17:34:48 +01:00
- [InaccessibleClassConstant ](issues/InaccessibleClassConstant.md )
- [InaccessibleMethod ](issues/InaccessibleMethod.md )
- [InaccessibleProperty ](issues/InaccessibleProperty.md )
- [InterfaceInstantiation ](issues/InterfaceInstantiation.md )
2020-11-30 05:21:09 +01:00
- [InvalidAttribute ](issues/InvalidAttribute.md )
2022-12-12 08:03:20 +01:00
- [InvalidEnumMethod ](issues/InvalidEnumMethod.md )
2020-09-12 17:25:41 +02:00
- [InvalidExtendClass ](issues/InvalidExtendClass.md )
2020-03-19 17:34:48 +01:00
- [InvalidGlobal ](issues/InvalidGlobal.md )
2023-02-12 07:42:59 +01:00
- [InvalidInterfaceImplementation ](issues/InvalidInterfaceImplementation.md )
2020-03-19 17:34:48 +01:00
- [InvalidParamDefault ](issues/InvalidParamDefault.md )
- [InvalidParent ](issues/InvalidParent.md )
- [InvalidPassByReference ](issues/InvalidPassByReference.md )
- [InvalidScope ](issues/InvalidScope.md )
- [InvalidStaticInvocation ](issues/InvalidStaticInvocation.md )
- [InvalidThrow ](issues/InvalidThrow.md )
- [LoopInvalidation ](issues/LoopInvalidation.md )
- [MethodSignatureMustOmitReturnType ](issues/MethodSignatureMustOmitReturnType.md )
2022-01-19 12:20:50 +01:00
- [MethodSignatureMustProvideReturnType ](issues/MethodSignatureMustProvideReturnType.md )
2020-03-19 17:34:48 +01:00
- [MissingDependency ](issues/MissingDependency.md )
- [MissingFile ](issues/MissingFile.md )
- [MissingImmutableAnnotation ](issues/MissingImmutableAnnotation.md )
- [MissingTemplateParam ](issues/MissingTemplateParam.md )
- [MissingThrowsDocblock ](issues/MissingThrowsDocblock.md )
- [NonStaticSelfCall ](issues/NonStaticSelfCall.md )
2020-11-30 05:21:09 +01:00
- [NoValue ](issues/NoValue.md )
2020-03-19 17:34:48 +01:00
- [NullArrayAccess ](issues/NullArrayAccess.md )
- [NullFunctionCall ](issues/NullFunctionCall.md )
- [NullIterator ](issues/NullIterator.md )
- [NullPropertyAssignment ](issues/NullPropertyAssignment.md )
- [NullPropertyFetch ](issues/NullPropertyFetch.md )
- [NullReference ](issues/NullReference.md )
- [OverriddenPropertyAccess ](issues/OverriddenPropertyAccess.md )
- [ParadoxicalCondition ](issues/ParadoxicalCondition.md )
- [ParentNotFound ](issues/ParentNotFound.md )
- [TooFewArguments ](issues/TooFewArguments.md )
2020-11-30 05:21:09 +01:00
- [UndefinedAttributeClass ](issues/UndefinedAttributeClass.md )
2020-03-19 17:34:48 +01:00
- [UndefinedClass ](issues/UndefinedClass.md )
- [UndefinedConstant ](issues/UndefinedConstant.md )
- [UndefinedDocblockClass ](issues/UndefinedDocblockClass.md )
- [UndefinedFunction ](issues/UndefinedFunction.md )
- [UndefinedGlobalVariable ](issues/UndefinedGlobalVariable.md )
- [UndefinedInterface ](issues/UndefinedInterface.md )
- [UndefinedTrait ](issues/UndefinedTrait.md )
- [UndefinedVariable ](issues/UndefinedVariable.md )
- [UnimplementedAbstractMethod ](issues/UnimplementedAbstractMethod.md )
- [UnimplementedInterfaceMethod ](issues/UnimplementedInterfaceMethod.md )
- [UnrecognizedExpression ](issues/UnrecognizedExpression.md )
- [UnrecognizedStatement ](issues/UnrecognizedStatement.md )
- [UnusedFunctionCall ](issues/UnusedFunctionCall.md )
- [UnusedMethodCall ](issues/UnusedMethodCall.md )
2020-02-17 22:33:28 +01:00
2022-12-02 00:57:52 +01:00
## Errors that appear at level 7 and below
- [AbstractInstantiation ](issues/AbstractInstantiation.md )
- [AssignmentToVoid ](issues/AssignmentToVoid.md )
- [CircularReference ](issues/CircularReference.md )
- [ConflictingReferenceConstraint ](issues/ConflictingReferenceConstraint.md )
- [ContinueOutsideLoop ](issues/ContinueOutsideLoop.md )
2024-02-03 01:06:12 +01:00
- [InvalidOverride ](issues/InvalidOverride.md )
2022-12-02 00:57:52 +01:00
- [InvalidTypeImport ](issues/InvalidTypeImport.md )
- [MethodSignatureMismatch ](issues/MethodSignatureMismatch.md )
- [OverriddenMethodAccess ](issues/OverriddenMethodAccess.md )
- [ParamNameMismatch ](issues/ParamNameMismatch.md )
- [ReservedWord ](issues/ReservedWord.md )
- [UnhandledMatchCondition ](issues/UnhandledMatchCondition.md )
- [UninitializedProperty ](issues/UninitializedProperty.md )
## Errors that appear at level 6 and below
- [InvalidArgument ](issues/InvalidArgument.md )
- [InvalidArrayAccess ](issues/InvalidArrayAccess.md )
- [InvalidArrayAssignment ](issues/InvalidArrayAssignment.md )
- [InvalidArrayOffset ](issues/InvalidArrayOffset.md )
- [InvalidCast ](issues/InvalidCast.md )
- [InvalidCatch ](issues/InvalidCatch.md )
- [InvalidClass ](issues/InvalidClass.md )
- [InvalidClone ](issues/InvalidClone.md )
- [InvalidFunctionCall ](issues/InvalidFunctionCall.md )
- [InvalidIterator ](issues/InvalidIterator.md )
- [InvalidMethodCall ](issues/InvalidMethodCall.md )
- [InvalidNamedArgument ](issues/InvalidNamedArgument.md )
- [InvalidPropertyAssignment ](issues/InvalidPropertyAssignment.md )
- [InvalidPropertyAssignmentValue ](issues/InvalidPropertyAssignmentValue.md )
- [InvalidPropertyFetch ](issues/InvalidPropertyFetch.md )
- [InvalidReturnStatement ](issues/InvalidReturnStatement.md )
- [InvalidReturnType ](issues/InvalidReturnType.md )
- [InvalidTemplateParam ](issues/InvalidTemplateParam.md )
- [NullArgument ](issues/NullArgument.md )
- [NullArrayOffset ](issues/NullArrayOffset.md )
- [TooManyTemplateParams ](issues/TooManyTemplateParams.md )
- [TraitMethodSignatureMismatch ](issues/TraitMethodSignatureMismatch.md )
- [UndefinedMethod ](issues/UndefinedMethod.md )
- [UndefinedPropertyAssignment ](issues/UndefinedPropertyAssignment.md )
- [UndefinedPropertyFetch ](issues/UndefinedPropertyFetch.md )
- [UndefinedThisPropertyFetch ](issues/UndefinedThisPropertyFetch.md )
## Errors that appear at level 5 and below
- [ConstructorSignatureMismatch ](issues/ConstructorSignatureMismatch.md )
- [FalsableReturnStatement ](issues/FalsableReturnStatement.md )
- [InvalidNullableReturnType ](issues/InvalidNullableReturnType.md )
- [LessSpecificImplementedReturnType ](issues/LessSpecificImplementedReturnType.md )
- [MoreSpecificImplementedParamType ](issues/MoreSpecificImplementedParamType.md )
- [NullableReturnStatement ](issues/NullableReturnStatement.md )
- [UndefinedInterfaceMethod ](issues/UndefinedInterfaceMethod.md )
- [UndefinedThisPropertyAssignment ](issues/UndefinedThisPropertyAssignment.md )
## Errors that appear at level 4 and below
- [FalseOperand ](issues/FalseOperand.md )
- [ForbiddenCode ](issues/ForbiddenCode.md )
- [ImplementedParamTypeMismatch ](issues/ImplementedParamTypeMismatch.md )
- [ImplementedReturnTypeMismatch ](issues/ImplementedReturnTypeMismatch.md )
- [ImplicitToStringCast ](issues/ImplicitToStringCast.md )
- [InternalClass ](issues/InternalClass.md )
- [InternalMethod ](issues/InternalMethod.md )
- [InternalProperty ](issues/InternalProperty.md )
- [InvalidDocblock ](issues/InvalidDocblock.md )
- [InvalidLiteralArgument ](issues/InvalidLiteralArgument.md )
- [InvalidOperand ](issues/InvalidOperand.md )
- [InvalidScalarArgument ](issues/InvalidScalarArgument.md )
- [InvalidToString ](issues/InvalidToString.md )
- [MismatchingDocblockParamType ](issues/MismatchingDocblockParamType.md )
- [MismatchingDocblockReturnType ](issues/MismatchingDocblockReturnType.md )
- [MissingDocblockType ](issues/MissingDocblockType.md )
- [NoInterfaceProperties ](issues/NoInterfaceProperties.md )
- [PossibleRawObjectIteration ](issues/PossibleRawObjectIteration.md )
- [RedundantCondition ](issues/RedundantCondition.md )
- [RedundantFunctionCall ](issues/RedundantFunctionCall.md )
- [RedundantPropertyInitializationCheck ](issues/RedundantPropertyInitializationCheck.md )
- [StringIncrement ](issues/StringIncrement.md )
- [TooManyArguments ](issues/TooManyArguments.md )
- [TypeDoesNotContainNull ](issues/TypeDoesNotContainNull.md )
- [TypeDoesNotContainType ](issues/TypeDoesNotContainType.md )
- [UndefinedMagicMethod ](issues/UndefinedMagicMethod.md )
- [UndefinedMagicPropertyAssignment ](issues/UndefinedMagicPropertyAssignment.md )
- [UndefinedMagicPropertyFetch ](issues/UndefinedMagicPropertyFetch.md )
## Errors that appear at level 3 and below
- [ArgumentTypeCoercion ](issues/ArgumentTypeCoercion.md )
- [LessSpecificReturnStatement ](issues/LessSpecificReturnStatement.md )
- [MoreSpecificReturnType ](issues/MoreSpecificReturnType.md )
- [PossiblyFalseArgument ](issues/PossiblyFalseArgument.md )
- [PossiblyFalseIterator ](issues/PossiblyFalseIterator.md )
- [PossiblyFalseOperand ](issues/PossiblyFalseOperand.md )
- [PossiblyFalsePropertyAssignmentValue ](issues/PossiblyFalsePropertyAssignmentValue.md )
- [PossiblyFalseReference ](issues/PossiblyFalseReference.md )
- [PossiblyInvalidArgument ](issues/PossiblyInvalidArgument.md )
- [PossiblyInvalidArrayAccess ](issues/PossiblyInvalidArrayAccess.md )
- [PossiblyInvalidArrayAssignment ](issues/PossiblyInvalidArrayAssignment.md )
- [PossiblyInvalidArrayOffset ](issues/PossiblyInvalidArrayOffset.md )
- [PossiblyInvalidCast ](issues/PossiblyInvalidCast.md )
- [PossiblyInvalidClone ](issues/PossiblyInvalidClone.md )
- [PossiblyInvalidFunctionCall ](issues/PossiblyInvalidFunctionCall.md )
- [PossiblyInvalidIterator ](issues/PossiblyInvalidIterator.md )
- [PossiblyInvalidMethodCall ](issues/PossiblyInvalidMethodCall.md )
- [PossiblyInvalidOperand ](issues/PossiblyInvalidOperand.md )
- [PossiblyInvalidPropertyAssignment ](issues/PossiblyInvalidPropertyAssignment.md )
- [PossiblyInvalidPropertyAssignmentValue ](issues/PossiblyInvalidPropertyAssignmentValue.md )
- [PossiblyInvalidPropertyFetch ](issues/PossiblyInvalidPropertyFetch.md )
- [PossiblyNullArgument ](issues/PossiblyNullArgument.md )
- [PossiblyNullArrayAccess ](issues/PossiblyNullArrayAccess.md )
- [PossiblyNullArrayAssignment ](issues/PossiblyNullArrayAssignment.md )
- [PossiblyNullArrayOffset ](issues/PossiblyNullArrayOffset.md )
- [PossiblyNullFunctionCall ](issues/PossiblyNullFunctionCall.md )
- [PossiblyNullIterator ](issues/PossiblyNullIterator.md )
- [PossiblyNullPropertyAssignment ](issues/PossiblyNullPropertyAssignment.md )
- [PossiblyNullPropertyAssignmentValue ](issues/PossiblyNullPropertyAssignmentValue.md )
- [PossiblyNullPropertyFetch ](issues/PossiblyNullPropertyFetch.md )
- [PossiblyNullReference ](issues/PossiblyNullReference.md )
- [PossiblyUndefinedArrayOffset ](issues/PossiblyUndefinedArrayOffset.md )
- [PossiblyUndefinedGlobalVariable ](issues/PossiblyUndefinedGlobalVariable.md )
- [PossiblyUndefinedMethod ](issues/PossiblyUndefinedMethod.md )
- [PossiblyUndefinedVariable ](issues/PossiblyUndefinedVariable.md )
- [PropertyTypeCoercion ](issues/PropertyTypeCoercion.md )
- [RiskyCast ](issues/RiskyCast.md )
## Errors that appear at level 2 and below
- [DeprecatedClass ](issues/DeprecatedClass.md )
- [DeprecatedConstant ](issues/DeprecatedConstant.md )
- [DeprecatedFunction ](issues/DeprecatedFunction.md )
- [DeprecatedInterface ](issues/DeprecatedInterface.md )
- [DeprecatedMethod ](issues/DeprecatedMethod.md )
- [DeprecatedProperty ](issues/DeprecatedProperty.md )
- [DeprecatedTrait ](issues/DeprecatedTrait.md )
2023-02-16 01:14:00 +01:00
- [DirectConstructorCall ](issues/DirectConstructorCall.md )
2022-12-02 00:57:52 +01:00
- [DocblockTypeContradiction ](issues/DocblockTypeContradiction.md )
- [InvalidDocblockParamName ](issues/InvalidDocblockParamName.md )
- [InvalidFalsableReturnType ](issues/InvalidFalsableReturnType.md )
- [InvalidStringClass ](issues/InvalidStringClass.md )
2024-03-14 18:12:01 +01:00
- [MissingClassConstType ](issues/MissingClassConstType.md )
2022-12-02 00:57:52 +01:00
- [MissingClosureParamType ](issues/MissingClosureParamType.md )
- [MissingClosureReturnType ](issues/MissingClosureReturnType.md )
- [MissingConstructor ](issues/MissingConstructor.md )
- [MissingParamType ](issues/MissingParamType.md )
- [MissingPropertyType ](issues/MissingPropertyType.md )
- [MissingReturnType ](issues/MissingReturnType.md )
- [NullOperand ](issues/NullOperand.md )
2023-03-03 07:00:09 +01:00
- [PrivateFinalMethod ](issues/PrivateFinalMethod.md )
2022-12-02 00:57:52 +01:00
- [PropertyNotSetInConstructor ](issues/PropertyNotSetInConstructor.md )
- [RawObjectIteration ](issues/RawObjectIteration.md )
- [RedundantConditionGivenDocblockType ](issues/RedundantConditionGivenDocblockType.md )
- [RedundantFunctionCallGivenDocblockType ](issues/RedundantFunctionCallGivenDocblockType.md )
- [ReferenceConstraintViolation ](issues/ReferenceConstraintViolation.md )
2024-01-15 10:09:49 +01:00
- [RiskyTruthyFalsyComparison ](issues/RiskyTruthyFalsyComparison.md )
2022-12-02 00:57:52 +01:00
- [UndefinedTrace ](issues/UndefinedTrace.md )
- [UnresolvableInclude ](issues/UnresolvableInclude.md )
- [UnsafeInstantiation ](issues/UnsafeInstantiation.md )
2020-02-17 22:33:28 +01:00
## Errors that only appear at level 1
2020-03-19 17:34:48 +01:00
- [LessSpecificReturnType ](issues/LessSpecificReturnType.md )
- [MixedArgument ](issues/MixedArgument.md )
- [MixedArgumentTypeCoercion ](issues/MixedArgumentTypeCoercion.md )
- [MixedArrayAccess ](issues/MixedArrayAccess.md )
- [MixedArrayAssignment ](issues/MixedArrayAssignment.md )
- [MixedArrayOffset ](issues/MixedArrayOffset.md )
- [MixedArrayTypeCoercion ](issues/MixedArrayTypeCoercion.md )
- [MixedAssignment ](issues/MixedAssignment.md )
2020-09-12 17:25:41 +02:00
- [MixedClone ](issues/MixedClone.md )
2020-03-19 17:34:48 +01:00
- [MixedFunctionCall ](issues/MixedFunctionCall.md )
- [MixedInferredReturnType ](issues/MixedInferredReturnType.md )
- [MixedMethodCall ](issues/MixedMethodCall.md )
- [MixedOperand ](issues/MixedOperand.md )
- [MixedPropertyAssignment ](issues/MixedPropertyAssignment.md )
- [MixedPropertyFetch ](issues/MixedPropertyFetch.md )
- [MixedPropertyTypeCoercion ](issues/MixedPropertyTypeCoercion.md )
- [MixedReturnStatement ](issues/MixedReturnStatement.md )
- [MixedReturnTypeCoercion ](issues/MixedReturnTypeCoercion.md )
- [MixedStringOffsetAssignment ](issues/MixedStringOffsetAssignment.md )
- [MutableDependency ](issues/MutableDependency.md )
- [PossiblyNullOperand ](issues/PossiblyNullOperand.md )
2020-09-12 17:25:41 +02:00
- [RedundantIdentityWithTrue ](issues/RedundantIdentityWithTrue.md )
2020-04-09 03:03:05 +02:00
- [Trace ](issues/Trace.md )
2020-02-17 22:33:28 +01:00
## Feature-specific errors
2024-02-03 23:17:13 +01:00
- [MissingOverrideAttribute ](issues/MissingOverrideAttribute.md )
2020-03-19 17:34:48 +01:00
- [PossiblyUndefinedIntArrayOffset ](issues/PossiblyUndefinedIntArrayOffset.md )
- [PossiblyUndefinedStringArrayOffset ](issues/PossiblyUndefinedStringArrayOffset.md )
- [PossiblyUnusedMethod ](issues/PossiblyUnusedMethod.md )
- [PossiblyUnusedParam ](issues/PossiblyUnusedParam.md )
- [PossiblyUnusedProperty ](issues/PossiblyUnusedProperty.md )
2020-11-30 05:21:09 +01:00
- [TaintedCallable ](issues/TaintedCallable.md )
- [TaintedCookie ](issues/TaintedCookie.md )
- [TaintedCustom ](issues/TaintedCustom.md )
- [TaintedEval ](issues/TaintedEval.md )
- [TaintedFile ](issues/TaintedFile.md )
- [TaintedHeader ](issues/TaintedHeader.md )
- [TaintedHtml ](issues/TaintedHtml.md )
- [TaintedInclude ](issues/TaintedInclude.md )
2020-03-19 17:34:48 +01:00
- [TaintedInput ](issues/TaintedInput.md )
2020-11-30 05:21:09 +01:00
- [TaintedLdap ](issues/TaintedLdap.md )
- [TaintedShell ](issues/TaintedShell.md )
- [TaintedSql ](issues/TaintedSql.md )
- [TaintedSSRF ](issues/TaintedSSRF.md )
- [TaintedSystemSecret ](issues/TaintedSystemSecret.md )
- [TaintedUnserialize ](issues/TaintedUnserialize.md )
- [TaintedUserSecret ](issues/TaintedUserSecret.md )
2020-03-19 17:34:48 +01:00
- [UncaughtThrowInGlobalScope ](issues/UncaughtThrowInGlobalScope.md )
- [UnevaluatedCode ](issues/UnevaluatedCode.md )
- [UnnecessaryVarAnnotation ](issues/UnnecessaryVarAnnotation.md )
- [UnusedClass ](issues/UnusedClass.md )
- [UnusedClosureParam ](issues/UnusedClosureParam.md )
2020-11-30 05:21:09 +01:00
- [UnusedConstructor ](issues/UnusedConstructor.md )
2023-02-16 03:04:26 +01:00
- [UnusedDocblockParam ](issues/UnusedDocblockParam.md )
2021-06-17 06:40:24 +02:00
- [UnusedForeachValue ](issues/UnusedForeachValue.md )
2020-03-19 17:34:48 +01:00
- [UnusedMethod ](issues/UnusedMethod.md )
- [UnusedParam ](issues/UnusedParam.md )
- [UnusedProperty ](issues/UnusedProperty.md )
- [UnusedPsalmSuppress ](issues/UnusedPsalmSuppress.md )
- [UnusedVariable ](issues/UnusedVariable.md )