← Back to all error identifiers

Error Identifiers: return.*

There are 24 error identifiers in the return.* group:

  • A finally block modifies the value a function returns by reference, so the caller receives a type that no longer matches the declared return type.
  • return.deprecatedClass phpstan-deprecation-rules
    Return type declaration references a deprecated class.
  • return.deprecatedEnum phpstan-deprecation-rules
    Return type declaration references a deprecated enum.
  • return.deprecatedInterface phpstan-deprecation-rules
    Return type declaration references a deprecated interface.
  • return.deprecatedTrait phpstan-deprecation-rules
    Return type declaration references a deprecated trait.
  • Bare return statement is used in a function with a non-void return type.
  • Return type declaration references an internal class from another package.
  • Return type declaration references an internal enum from another package.
  • Return type declaration references an internal interface from another package.
  • Return type declaration references an internal trait from another package.
  • Function with a non-void return type is missing a return statement.
  • Declared return type contains a nested type that is never actually returned.
  • Function with a never return type contains a return statement.
  • Never return type in arrow functions is not supported on this PHP version.
  • Return type uses parent keyword but there is no parent class.
  • PHPDoc @return type is incompatible with the native return type.
  • return.tooWideBool auto-fixable
    Function declares bool return type but only ever returns true or only false.
  • Return type declaration uses a trait, which is not a valid type.
  • Returned value type does not match the declared return type.
  • Native union return type is not supported on the configured PHP version.
  • Native return type contains an intersection that cannot be resolved.
  • PHPDoc @return tag contains a type that cannot be resolved.
  • return.unusedType auto-fixable
    Declared return type contains a union member that is never returned.
  • Function with a void return type returns a value.
Theme
© 2026 PHPStan s.r.o.