Error levels
Psalm can run at error levels 1 (strictest) through 8 (most lenient). The default is level 2.
A stricter level (lower number) reports more issues as errors. A more lenient level (higher number) demotes issues to info (non-blocking).
Quick-reference summary
| Level | Strictness | What changes compared to the level above |
|---|---|---|
| 1 (strictest) | Everything is an error | Adds Mixed* issues, LessSpecificReturnType as errors |
| 2 (default) | Most issues | Mixed* demoted to info |
| 3 | Moderate | Deprecated*, MissingParamType, PropertyNotSetInConstructor demoted to info |
| 4 | Lenient | Possibly* issues demoted to info |
| 5 | More lenient | InvalidScalarArgument, RedundantCondition, TooManyArguments demoted to info |
| 6 | Very lenient | FalsableReturnStatement, InvalidNullableReturnType demoted to info |
| 7 | Extremely lenient | InvalidArgument, InvalidMethodCall, UndefinedMethod demoted to info |
| 8 (most lenient) | Almost nothing | MethodSignatureMismatch, UninitializedProperty demoted to info |
Special categories
- Always errors: Issues with very low false-positive rates (e.g.,
UndefinedClass,UndefinedVariable). These cannot be suppressed by changing the error level. - Feature-specific errors: Issues only reported when their feature is enabled (e.g.,
--taint-analysisforTainted*,--find-unused-codeforUnused*). When enabled, they are always treated as errors.
Always treated as errors
These issues have very low false-positive rates and indicate definite problems. They cannot be suppressed by changing the error level.
- AbstractMethodCall
- ComplexFunction
- ComplexMethod
- ConfigIssue
- ConstantDeclarationInTrait
- DuplicateArrayKey
- DuplicateClass
- DuplicateConstant
- DuplicateEnumCase
- DuplicateEnumCaseValue
- DuplicateFunction
- DuplicateMethod
- DuplicateParam
- DuplicateProperty
- EmptyArrayAccess
- ExtensionRequirementViolation
- ImplementationRequirementViolation
- ImpureByReferenceAssignment
- ImpureFunctionCall
- ImpureGlobalVariable
- ImpureMethodCall
- ImpurePropertyAssignment
- ImpurePropertyFetch
- ImpureStaticProperty
- ImpureStaticVariable
- ImpureVariable
- InaccessibleClassConstant
- InaccessibleMethod
- InaccessibleProperty
- InterfaceInstantiation
- InvalidAttribute
- InvalidEnumBackingType
- InvalidEnumCaseValue
- InvalidEnumMethod
- InvalidExtendClass
- InvalidGlobal
- InvalidInterfaceImplementation
- InvalidParamDefault
- InvalidParent
- InvalidPassByReference
- InvalidScope
- InvalidStaticInvocation
- InvalidThrow
- LoopInvalidation
- MethodSignatureMustOmitReturnType
- MethodSignatureMustProvideReturnType
- MissingAbstractPureAnnotation
- MissingDependency
- MissingFile
- MissingImmutableAnnotation
- MissingInterfaceImmutableAnnotation
- MissingPureAnnotation
- MissingTemplateParam
- MissingThrowsDocblock
- NoEnumProperties
- NoValue
- NonInvariantPropertyType
- NonStaticSelfCall
- NullArrayAccess
- NullFunctionCall
- NullIterator
- NullPropertyAssignment
- NullPropertyFetch
- NullReference
- OverriddenPropertyAccess
- ParadoxicalCondition
- ParentNotFound
- TooFewArguments
- UndefinedAttributeClass
- UndefinedClass
- UndefinedConstant
- UndefinedDocblockClass
- UndefinedFunction
- UndefinedGlobalVariable
- UndefinedInterface
- UndefinedTrait
- UndefinedVariable
- UnimplementedAbstractMethod
- UnimplementedInterfaceMethod
- UnrecognizedExpression
- UnrecognizedStatement
- UnresolvableConstant
- UnsupportedPropertyReferenceUsage
- UnusedBaselineEntry
- UnusedFunctionCall
- UnusedIssueHandlerSuppression
- UnusedMethodCall
Errors that only appear at level 1
At the default level (2), these are reported as info. Set errorLevel="1" to treat them as errors.
- ImmutableDependency
- InvalidClassConstantType
- LessSpecificClassConstantType
- LessSpecificReturnType
- MixedArgument
- MixedArgumentTypeCoercion
- MixedArrayAccess
- MixedArrayAssignment
- MixedArrayOffset
- MixedArrayTypeCoercion
- MixedAssignment
- MixedClone
- MixedFunctionCall
- MixedMethodCall
- MixedOperand
- MixedPropertyAssignment
- MixedPropertyFetch
- MixedPropertyTypeCoercion
- MixedReturnStatement
- MixedReturnTypeCoercion
- MixedStringOffsetAssignment
- MutableDependency
- PossiblyNullOperand
- RedundantFlag
- RedundantIdentityWithTrue
- Trace
Errors at level 2 and below
These issues become info (non-blocking) at level 3 and higher.
- ClassMustBeFinal
- DeprecatedClass
- DeprecatedConstant
- DeprecatedFunction
- DeprecatedInterface
- DeprecatedMethod
- DeprecatedProperty
- DeprecatedTrait
- DirectConstructorCall
- DocblockTypeContradiction
- InvalidDocblockParamName
- InvalidFalsableReturnType
- InvalidStringClass
- MismatchingDocblockPropertyType
- MissingClassConstType
- MissingClosureParamType
- MissingClosureReturnType
- MissingConstructor
- MissingParamType
- MissingPropertyType
- MissingReturnType
- NullOperand
- PrivateFinalMethod
- PropertyNotSetInConstructor
- RawObjectIteration
- RedundantCastGivenDocblockType
- RedundantConditionGivenDocblockType
- RedundantFunctionCallGivenDocblockType
- ReferenceConstraintViolation
- RiskyTruthyFalsyComparison
- UndefinedTrace
- UnresolvableInclude
- UnsafeGenericInstantiation
- UnsafeInstantiation
- UnsupportedReferenceUsage
Errors at level 3 and below
These issues become info (non-blocking) at level 4 and higher.
- ArgumentTypeCoercion
- LessSpecificReturnStatement
- MoreSpecificReturnType
- NonInvariantDocblockPropertyType
- PossiblyFalseArgument
- PossiblyFalseIterator
- PossiblyFalseOperand
- PossiblyFalsePropertyAssignmentValue
- PossiblyFalseReference
- PossiblyInvalidArgument
- PossiblyInvalidArrayAccess
- PossiblyInvalidArrayAssignment
- PossiblyInvalidArrayOffset
- PossiblyInvalidCast
- PossiblyInvalidClone
- PossiblyInvalidFunctionCall
- PossiblyInvalidIterator
- PossiblyInvalidMethodCall
- PossiblyInvalidOperand
- PossiblyInvalidPropertyAssignment
- PossiblyInvalidPropertyAssignmentValue
- PossiblyInvalidPropertyFetch
- PossiblyNullArgument
- PossiblyNullArrayAccess
- PossiblyNullArrayAssignment
- PossiblyNullArrayOffset
- PossiblyNullFunctionCall
- PossiblyNullIterator
- PossiblyNullPropertyAssignment
- PossiblyNullPropertyAssignmentValue
- PossiblyNullPropertyFetch
- PossiblyNullReference
- PossiblyUndefinedArrayOffset
- PossiblyUndefinedGlobalVariable
- PossiblyUndefinedMethod
- PossiblyUndefinedVariable
- PropertyTypeCoercion
- RiskyCast
Errors at level 4 and below
These issues become info (non-blocking) at level 5 and higher.
- FalseOperand
- ForbiddenCode
- IfThisIsMismatch
- ImplementedParamTypeMismatch
- ImplementedReturnTypeMismatch
- ImplicitToStringCast
- InheritorViolation
- InternalClass
- InternalMethod
- InternalProperty
- InvalidDocblock
- InvalidLiteralArgument
- InvalidOperand
- InvalidScalarArgument
- InvalidToString
- MismatchingDocblockParamType
- MismatchingDocblockReturnType
- MissingDocblockType
- NoInterfaceProperties
- PossibleRawObjectIteration
- PossiblyInvalidDocblockTag
- RedundantCast
- RedundantCondition
- RedundantFunctionCall
- RedundantPropertyInitializationCheck
- ReferenceReusedFromConfusingScope
- StringIncrement
- TooManyArguments
- TypeDoesNotContainNull
- TypeDoesNotContainType
- UndefinedMagicMethod
- UndefinedMagicPropertyAssignment
- UndefinedMagicPropertyFetch
Errors at level 5 and below
These issues become info (non-blocking) at level 6 and higher.
- ConstructorSignatureMismatch
- FalsableReturnStatement
- InvalidNullableReturnType
- LessSpecificImplementedReturnType
- MoreSpecificImplementedParamType
- NullableReturnStatement
- UndefinedInterfaceMethod
- UndefinedThisPropertyAssignment
Errors at level 6 and below
These issues become info (non-blocking) at level 7 and higher.
- AmbiguousConstantInheritance
- InvalidArgument
- InvalidArrayAccess
- InvalidArrayAssignment
- InvalidArrayOffset
- InvalidCast
- InvalidCatch
- InvalidClass
- InvalidClone
- InvalidConstantAssignmentValue
- InvalidFunctionCall
- InvalidIterator
- InvalidMethodCall
- InvalidNamedArgument
- InvalidPropertyAssignment
- InvalidPropertyAssignmentValue
- InvalidPropertyFetch
- InvalidReturnStatement
- InvalidReturnType
- InvalidTemplateParam
- NullArgument
- NullArrayOffset
- OverriddenFinalConstant
- OverriddenInterfaceConstant
- TooManyTemplateParams
- TraitMethodSignatureMismatch
- UndefinedMethod
- UndefinedPropertyAssignment
- UndefinedPropertyFetch
- UndefinedThisPropertyFetch
Errors at level 7 and below
These issues become info (non-blocking) at level 8.
- AbstractInstantiation
- AssignmentToVoid
- CircularReference
- ConflictingReferenceConstraint
- ContinueOutsideLoop
- InvalidOverride
- InvalidTraversableImplementation
- InvalidTypeImport
- MethodSignatureMismatch
- NamedArgumentNotAllowed
- NonVariableReferenceReturn
- OverriddenMethodAccess
- ParamNameMismatch
- ReservedWord
- UnhandledMatchCondition
- UninitializedProperty
Feature-specific errors
These issues are only reported when their corresponding feature is enabled (e.g., --taint-analysis for Tainted issues, --find-unused-code for Unused issues). When enabled, they are always treated as errors.
- LiteralKeyUnshapedArray
- MissingOverrideAttribute
- PossiblyUndefinedIntArrayOffset
- PossiblyUndefinedStringArrayOffset
- PossiblyUnusedMethod
- PossiblyUnusedParam
- PossiblyUnusedProperty
- PossiblyUnusedReturnValue
- TaintedCallable
- TaintedCookie
- TaintedCustom
- TaintedEval
- TaintedExtract
- TaintedFile
- TaintedHeader
- TaintedHtml
- TaintedInclude
- TaintedInput
- TaintedLdap
- TaintedSSRF
- TaintedShell
- TaintedSleep
- TaintedSql
- TaintedSystemSecret
- TaintedTextWithQuotes
- TaintedUnserialize
- TaintedUserSecret
- TaintedXpath
- UncaughtThrowInGlobalScope
- UnevaluatedCode
- UnnecessaryVarAnnotation
- UnusedClass
- UnusedClosureParam
- UnusedConstructor
- UnusedDocblockParam
- UnusedForeachValue
- UnusedMethod
- UnusedParam
- UnusedProperty
- UnusedPsalmSuppress
- UnusedReturnValue
- UnusedVariable