Skip to content

Mago analyzer report: grouped issues #39

Description

@mnavarrocarter

Mago analyzer report

Command run:

devenv shell ./vendor/bin/mago analyze --sort

Result: failed.

Summary from Mago: found 450 issues: 352 errors, 96 warnings, and 2 help messages. Mago also reported 366 stale baseline entries and filtered 268 issues via the existing analyzer baseline.

Issues by type

Type Count Suggested solution
error[mixed-property-access] 298 Add or tighten return types, collection value types, PHPUnit assertions, or PHPDoc generics so analyzer knows retrieved accounts, transfers, balances, histories, and array elements are concrete domain objects before property access.
warning[mixed-assignment] 91 Type intermediate variables at assignment points; add repository/ledger method return types or local @var annotations where values are intentionally dynamic.
error[mixed-method-access] 44 Narrow variables from mixed before method calls using stronger API return types, assertions such as self::assertInstanceOf, or precise PHPDoc.
error[mixed-operand] 6 Ensure arithmetic/comparison operands have scalar numeric/string types before use; cast or type source values explicitly.
warning[incompatible-parameter-name] 4 Align implementing/overriding method parameter names with their parent/interface declarations.
help[write-only-property] 2 Remove unused property writes or add reads if the stored value is needed.
error[invalid-iterator] 1 Ensure the iterated expression is typed as iterable with a known value type.
error[method-access-on-null] 1 Add a null check/assertion or adjust the return type so the method call is only made on a non-null object.
error[mixed-argument] 1 Type the argument before passing it to a parameter requiring a stricter type.
warning[redundant-docblock-type] 1 Remove the redundant docblock type or update it only if it adds missing generic/detail information.
error[non-existent-method] 1 Update tests/PHPUnit/DatabaseExtension.php for the installed PHPUnit event API; PHPUnit\Event\Code\Test::metadata() is not available.

Notable locations

  • Many mixed-property-access findings are in tests/StandardLedgerTest.php, tests/IdempotentLedgerTest.php, and tests/Storage/Dbal/TransferRepositoryTest.php when dereferencing retrieved fixtures or repository results.
  • tests/PHPUnit/DatabaseExtension.php:62 calls metadata() on PHPUnit\Event\Code\Test, which Mago reports as non-existent.

Suggested remediation order

  1. Fix the PHPUnit extension API issue because it is a concrete missing-method error.
  2. Add precise return types/PHPDoc generics to repository and ledger retrieval APIs used by tests.
  3. Add PHPUnit assertInstanceOf/non-null assertions where tests intentionally validate dynamic repository results.
  4. Regenerate or verify the analyzer baseline after fixes to remove stale entries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions