github vimeo/psalm 7.12.0

latest release: 6.21.0
47 minutes ago

What's Changed

Features

  • Add @optional-arguments-by-name, @arguments-by-name and @stable-parameter-names by @nicolas-grekas in #12389
  • Make everything a PSR-7 message holds a taint source, and a method implementing or overriding a source one too by @danog in #14211
  • Define a variable assigned under a condition when the same condition is checked again by @orklah in #14222
  • feat(call): report a function called with a different casing than it is declared with by @jirkace in #13348
  • fix(types): remember the result of a pure function called with literals by @jirkace in #13422
  • Add a stub of the protobuf extension for Message, Timestamp and Duration by @jirkace in #12617

Fixes

  • Let loops see the writes made through references by @orklah in #14193
  • Drop the clauses of variables a call writes through a closure or a global by @orklah in #14195
  • Keep the arrays holding an item bound by reference in sync by @orklah in #14194
  • Fix: crash on sort() and array_unique() when Psalm runs on PHP 8.6 by @alies-dev in #14201
  • Replace the invalid UTF-8 in the taint traces of a report too by @danog in #14212
  • Match named arguments by name where named arguments are not allowed by @danog in #14213
  • Analyse the condition of a ternary as the condition of an if by @orklah in #14207
  • Forget the memoized results of the methods of an object when one of its properties is written by @danog in #14167
  • Report a sink of a variadic parameter once for an argument after its first by @danog in #13651
  • Narrow a value cast to a string and found in a list when none of its other types has a string form in it by @danog in #14169
  • Read a dynamic property as what the object holds under its name by @danog in #14177
  • Keep what was assigned to a dynamic property when it is read back by @danog in #14223
  • Store what is assigned to a dynamic property in the object, under its name by @danog in #14224
  • Fork workers with the StreamSelectDriver event loop by @orklah in #14238
  • Report array access on objects not implementing ArrayAccess as InvalidArrayAccess by @orklah in #14237
  • Forget stale narrowings after branches, offset writes and comparand changes by @orklah in #14208
  • Keep inherited assertions on parent:: calls and in unused-call checks by @orklah in #14280
  • Forget narrowings of variables a closure passed inside an array captures by reference by @orklah in #14276
  • Replace templates inside class-string<Foo> by @orklah in #14278
  • Fix TypeDoesNotContainType when narrowing a class&interface intersection to a subclass by @orklah in #14275
  • Apply by-reference captures of a closure only in the scope it was made in by @orklah in #14281
  • Keep the key and value types when iterating over a nullable or falsable iterable by @orklah in #14279
  • Narrow $x when $x ??= $y is compared with null by @orklah in #14282
  • Infer open template params for new on a generic class without a constructor by @orklah in #14277
  • Keep wider types on !== with a non-literal value by @orklah in #14295
  • fix(throws): accept an intersection type in @throws by @jirkace in #12896
  • feat(suppress): a @psalm-suppress docblock in front of an argument suppresses the issues of its expression #5599 by @jirkace in #13288
  • fix(docblock): resolve imported aliases when checking an alias definition by @jirkace in #13230
  • fix(unused-code): a variable used only in the arguments of a static call on an undefined class is used by @jirkace in #12864
  • fix(templates): the called class maps the templates of an interface to those of a parent method by @jirkace in #13436
  • Decide a conditional on Closure for interfaces, iterables and bounded templates (#12497) by @jirkace in #12756
  • fix(purity): an impure instance method or constructor costs write-refs like an impure function by @jirkace in #13688
  • fix(arrays): report a write with an offset that may not be a key by @jirkace in #12812
  • fix(destructuring): a nullable shape destructured by key is no PossiblyNullArrayAccess, like a list by @jirkace in #13295
  • fix(array-key-exists): report a non-numeric string key checked on a list or int-keyed array by @jirkace in #13291
  • fix(class-string): do not check array literals as class names when the value type is a union by @jirkace in #12667
  • fix(types): expand properties-of for a class without instance properties by @jirkace in #12935
  • Fix static kept on the union of $this and another object of its class by @shu-chen-dot-ca in #14078
  • Analyse the arguments of a self call of an instance method once by @jirkace in #13315
  • Analyse the iterated expression of a foreach once by @jirkace in #13316
  • fix(callable): non-public static callbacks of the current class by class string by @jirkace in #12875
  • fix(callable): a callable array naming a method declared by @method is callable by @jirkace in #12986
  • A call is only redundant if every assertion it makes is (#11847) by @jirkace in #12766
  • fix(assert): don't check an is_*() call inside assert() a second time by @jirkace in #12648
  • fix(empty): no RiskyTruthyFalsyComparison for a required key of a sealed shape by @jirkace in #12883
  • fix(templates): input types a non-template part of a union contains are not the template's by @jirkace in #13439
  • fix(templates): an omitted default equal to an atomic of the union does not bound the template by @jirkace in #12985
  • fix(templates): expand @psalm-if-this-is type before binding templates by @jirkace in #12942
  • fix(templates): keep templates of the calling function-like in scope in traits by @jirkace in #13220
  • fix(algebra): the right side of && assigning an offset or property forgets only what the left side tested of it by @jirkace in #13199
  • fix(switch): narrow the subject after a switch without default whose cases all return by @jirkace in #12972
  • fix(unset): report a variable unset in a branch as possibly undefined afterwards by @jirkace in #13126
  • Fix TypeError in && when the right side calls a closure capturing a variable by reference by @alies-dev in #14303

Internal changes

  • Fail CI on PHP deprecations (PHPunit) and run Shepherd on PHP 8.6 by @alies-dev in #14229

Full Changelog: 7.11.0...7.12.0

Don't miss a new psalm release

NewReleases is sending notifications on new releases.