Psalm 7.9 compatibility. Plugin v4.22.0 can crash with a TypeError on Psalm 7.9 when analyzing a nullsafe property fetch through a higher-order collection proxy ($c->map?->name), so this release requires Psalm 7.9.
Requirements
- Require
vimeo/psalm^7.9.0(was^7.7.0). Upgrade Psalm together with the plugin:composer update vimeo/psalm psalm/plugin-laravel(#2333)
Features
- Type the closure parameter of eager-load constraints in
with(),withOnly(),load()andloadMissing()(#1955)
Customer::query()->with(['vehicles' => fn ($query) => $query->where('year', '>', 2020)]);
-// MissingClosureParamType, MixedMethodCall: $query was untyped
+// $query is typed as the constrained relationFixes
- 🛡️ Propagate closure return taint through
value(),rescue(),retry(),once(),with()andDB::transaction()(#2280)
echo DB::transaction(fn () => (string) $request->input('name'));
-// no issue
+// TaintedHtml, TaintedTextWithQuotes- Type a custom caster's
get()by its native return type when it has no docblock (#2294)
// MoneyCast::get(...): Money, no docblock
return $payment->amount->format();
-// MixedReturnStatement, PossiblyNullReference, MixedMethodCall
+// no issue- Report a wrong
@returnon template-boundgroupBy()andkeyBy()receivers (@template C of Collection<...>) asInvalidReturnStatementinstead of accepting it (#2332) - Stop narrowing
getKey()tointfor the non-finalIlluminate\Foundation\Auth\Userreceiver, which can use string keys (#2293)
$key = $user->getKey();
if (\is_string($key)) { ... }
-// TypeDoesNotContainType: Type int for $key is never string
+// no issue- Type
__()andtrans()calls with amixedkey asstring(#2289)
return '"' . __($row['message']) . '"';
-// PossiblyNullOperand, PossiblyInvalidOperand
+// only MixedArgument for the mixed key remains- Stop flagging custom Eloquent builder methods returning
selfasPossiblyUnusedReturnValue(#1449) - Narrow
non-empty-stringtonon-falsy-stringinCollection::filter()without a callback, since it removes"0"(#2335)
Full Changelog: v4.22.0...v4.22.1