Skip to content

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

Closed

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

  1. added this to the 0.5.0 milestone on Aug 10, 2026
  2. tyrsson commented on Oct 7, 2026

    @tyrsson
    MemberAuthor

    Closing as resolved. The \ nullable-typing findings are captured in the committed analysis-baseline.toml for src/Connection.php — incompatible-property-type, invalid-property-assignment-value and redundant-condition.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions