Skip to content

v2.0.0

Choose a tag to compare

@paulbalandan paulbalandan released this 15 Jun 17:09
· 0 commits to 1.x since this release
Immutable release. Only release title and notes can be modified.
v2.0.0
408f5d4

Highlights

This release is a ground-up rewrite of the extension. The headline feature is Model and Entity type inference driven by your real database schema: the extension materializes your schema by running your migrations against a temporary SQLite database, then uses it to type your models, entities, and fetched rows.

Important

This is a major release with breaking changes. Read the Upgrade Guide before upgrading.

Requirements

  • PHP ^8.2
  • PHPStan ^2.2
  • CodeIgniter 4 ^4.7
  • The sqlite3 PHP extension (new, powers the schema layer)

What's new

Model and Entity type inference

Resolved from your live schema instead of heuristics (closes #17, #19, #25):

  • Model::find(), findAll(), first(), and findColumn() return the precise row type for the model's $returnType (an entity, a shaped array{...} of columns, or a stdClass), honoring asArray(), asObject(), and the select() field list (aliases, table.*, and joined columns).
  • Entity virtual properties are typed from the entity's $casts and $dates (including custom $castHandlers) layered over the backing database column.
  • fake() returns a single fabricated record of the model's return type.

See the type inference docs for the full list.

Rules

  • The superglobals rules were split into four (SuperglobalsOffsetAccess, SuperglobalsOffsetAssign, SuperglobalsOffsetUnset, SuperglobalsGlobalAssign), now also catching whole-array assignment. Most are auto-fixable with vendor/bin/phpstan analyse --fix.
  • The config() / model() ::class discouragement rule was removed.

Breaking changes

  • PHPStan ^2.2 and the sqlite3 extension are now required.
  • Rule identifiers and messages changed (the superglobals split/rename and the removed discouragement rule), so existing baseline entries will no longer match and must be regenerated.

See the Upgrade Guide for the full migration steps.

Full Changelog: v1.6.0...v2.0.0