Skip to content

Configuration Reference

The Mago Analyzer is highly configurable, allowing you to tailor the analysis to your project's specific needs. All settings go under the [analyzer] table in your mago.toml file.

toml
[analyzer]
# Disable a specific issue category
redundancy-issues = false

# Ignore a specific error code across the whole project
ignore = ["mixed-argument"]

General Options

OptionTypeDefaultDescription
excludesstring[][]A list of glob patterns to exclude from analysis.
ignorestring[][]A list of specific issue codes to ignore globally.

Issue Categories

You can enable or disable entire categories of issues. All categories are enabled by default.

OptionDefaultDescription
mixed-issuestrueReport all issues related to the use of mixed types.
falsable-issuestrueReport all issues related to possibly false values.
nullable-issuestrueReport all issues related to possibly null values.
redundancy-issuestrueReport all issues related to redundant code.
reference-issuestrueReport all issues related to by-reference variables.
unreachable-issuestrueReport all issues related to unreachable code.
deprecation-issuestrueReport all issues related to using deprecated code.
impossibility-issuestrueReport all issues related to logically impossible conditions.
ambiguity-issuestrueReport all issues related to ambiguous code constructs.
existence-issuestrueReport all issues related to the existence of symbols.
template-issuestrueReport all issues related to generic template types.
argument-issuestrueReport all issues related to function arguments.
operand-issuestrueReport all issues related to expression operands.
property-issuestrueReport all issues related to class properties.
generator-issuestrueReport all issues related to generators.
array-issuestrueReport all issues related to array operations.
return-issuestrueReport issues related to function and method return types.
method-issuestrueReport issues related to methods and their usage.
iterator-issuestrueReport issues related to iterators and their usage.

Feature Flags

These flags control specific, powerful analysis capabilities.

OptionDefaultDescription
find-unused-expressionstrueFind and report expressions whose results are not used (e.g., $a + $b;).
find-unused-definitionstrueFind and report unused definitions (e.g., private methods that are never called).
analyze-dead-codetrueAnalyze code that appears to be unreachable.
memoize-propertiesfalseTrack the literal values of class properties. Improves type inference but may increase memory usage.
allow-possibly-undefined-array-keystrueAllow accessing array keys that may not be defined without reporting an issue.
check-throwstrueCheck for unhandled thrown exceptions that are not caught or documented with @throws.
perform-heuristic-checkstruePerform extra heuristic checks for potential issues that are not strict typing errors.