Skip to content

[Analysis] Connection.php: $resource nullable typing cascades due to mago flow-analysis limitation #68

Description

@tyrsson

Context

Part of #60.

Data

mago analyze flags incompatible-property-type, invalid-property-assignment-value, and 2x redundant-condition around $resource (declared /** @var mysqli */ protected $resource;, non-nullable per docblock, but disconnect() genuinely sets it to null). Making the property honestly nullable (native ?mysqli or docblock-only mysqli|null) was tried and reverted: it cascades into ~6 new possible-method-access-on-null findings across every other method (beginTransaction(), commit(), rollback(), getLastGeneratedValue(), etc.), because mago does not retain null-narrowing of a class property across separate statements/methods, matching the same limitation already documented for Statement.php in #61.

These findings will be captured in a mago baseline rather than fixed or suppressed inline.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions