Repository navigation
Immutable
release. Only release title and notes can be modified.
What's Changed
Added
- Static
Factoriesloaders.Factories::config(),Factories::models()andFactories::get()now return the requested class, the same as theconfig()andmodel()functions. A class-string resolves for any component. A short alias such asFactories::config('App')resolves through the config and model namespaces, includingadditionalConfigNamespacesandadditionalModelNamespaces. Request::getServer(). With no index it returnsarray<string, mixed>. A constant key returnsstring|null, or the actual type forargv,argc,REQUEST_TIMEandREQUEST_TIME_FLOAT.IncomingRequestinput accessors.getGet(),getPost(),getCookie(),getPostGet(),getGetPost()andgetRawInputVar()returnarray<string, mixed>for a null or array index. A constant string index returnsarray<mixed>|string|null(getRawInputVar()keeps its declared type here). A filter argument also keeps the declared type.
Fixed
- Crash under PHPStan 2.3. Rector and other tools that ask PHPStan for native types stopped with
assert(count($classTypes) === 1)on model fetch chains such as$this->select('name')->asArray()->find(). When the receiver has no known class, the model fetch extension now falls back to the declared return type. - Model fetches on a union of models.
find(),findAll(),first()andfindColumn()called on a union of models, for example($flag ? $users : $jobs)->find(1), now return the union of the row types of every model in it. Previously they used the first model's type only. - Schema build in parallel runs. Migrations are discovered once per run, and building a cold schema cache is locked, so parallel PHPStan workers no longer all run the migrations.
Compatibility
- Works with PHPStan 2.3. The minimum stays at PHPStan 2.2.
Coming natively in CodeIgniter 4.7.5
CodeIgniter 4.7.5 will declare precise types for the ResultInterface row accessors, the CLIRequest input getters, current_url()/previous_url(), and IncomingRequest::getJSON()/getJsonVar() (codeigniter4/CodeIgniter4#10588). This extension doesn't add those types itself. Upgrade CodeIgniter when 4.7.5 is out to get them.
Full Changelog: v2.1.0...v2.2.0