Skip to content

v1.2.2 — Full PHPStan Level-Max Compliance & MySQL DBAL Stability Enhancements

Choose a tag to compare

@Maatify Maatify released this 18 Nov 17:09
· 17 commits to main since this release

🚀 maatify/data-adapters v1.2.2

Full PHPStan Level-Max Compliance + MySQL DBAL Stability Enhancements

This release completes two major engineering phases:
✔ Phase 16 — MySQL DBAL Stability Patch + DSN Hardening
✔ Phase 17 — Project-Wide PHPStan Level-Max Compliance

The update provides significant stability, type safety, and CI reliability improvements across all adapters, builders, resolvers, and tests — while remaining 100% backward compatible.


✅ Highlights

🟦 1. PHPStan Level-Max Compliance (Phase 17)

A full strict-typing sweep across the entire library:

  • Eliminated all mixed usage in adapters & builders
  • Enforced strict return types (PDO, DBAL Connection, Redis, Predis, Mongo)
  • Normalized array-shape guarantees for all DSN parsers
  • Replaced nullsafe operators on non-nullable objects
  • Fixed non-exhaustive match() expressions
  • Refined merging logic in EnvironmentConfig & RegistryConfig
  • Solved all leftover PHPStan-level-max violations

This dramatically strengthens static analysis guarantees across the project.


🟧 2. MySQL DBAL Stability Patch + DSN Hardening (Phase 16)

Critical MySQL + Doctrine DBAL improvements:

  • Forced TCP-only MySQL connections
  • Disabled unix_socket fallback (fixes CI “SQLSTATE[HY000] 2002”)
  • Improved DSN parsing for complex passwords with reserved characters
  • Ensured consistent normalization between PDO & DBAL
  • Updated RawAccessTest to run stably across Local & GitHub Actions
  • Strengthened Doctrine DBAL handshake & initialization
  • Resolved DSN merge inconsistencies (Registry → DSN → Legacy)

🔧 Changes in Detail

🟦 Added

  • Strict type signatures for all public adapter APIs

  • PHPStan-safe driver return types:

    • PDO
    • Doctrine\DBAL\Connection
    • MongoDB\Database
    • Redis / Predis\Client
  • Additional tests for:

    • DSN strict parsing
    • Raw driver correctness
    • MySQL profile routing
    • Registry + DSN merging behavior under strict types

🟩 Changed

  • All adapters now return strict concrete driver types
  • DSN parsers rewritten with guaranteed array-shapes
  • Standardized merge logic in EnvironmentConfig::mergeWithRegistry()
  • Unified error positioning in DatabaseResolver
  • Strengthened typing in RedisConfigBuilder, MySqlConfigBuilder, MongoConfigBuilder

🛠 Fixed

  • Doctrine DSN parsing failures (unsafe characters)
  • Incorrect PDOStatement|false unchecked returns
  • executeQuery() being called on mixed DBAL driver
  • Missing host/user/pass in improperly structured DSNs
  • strtolower(null) inside DatabaseResolver
  • Nullsafe operator misuse
  • DSN parsers incorrectly stripping fragments after “?” in encoded passwords
  • CI failures caused by unix_socket fallback

🔬 Testing & CI

  • All suites passed
  • Full strict-type mode validated
  • GitHub Actions build stable for MySQL PDO & DBAL
  • RealMysqlDualConnectionTest now stable across Windows/macOS/Linux runners

Coverage remains approximately 93%+ across adapters, diagnostics, metrics, and registry layers.


⚙️ Backward Compatibility

✔ Zero breaking changes
✔ All public APIs remain identical
✔ No configuration changes required
✔ Fully compatible with:

  • maatify/common
  • maatify/security-guard
  • maatify/rate-limiter
  • maatify/mongo-activity
  • maatify/bootstrap

📌 Recommended Upgrade

This is a highly recommended update for:

  • Projects using MySQL DBAL
  • Projects running GitHub CI pipelines
  • Projects depending on strict static analysis
  • Any environment using DSN-based configuration

No action required — upgrade is drop-in.


📦 Install / Update

composer update maatify/data-adapters

❤️ Credits

Engineered by Mohamed Abdulalim (@megyptm)
Part of the Maatify.dev Unified Backend Ecosystem