github vimeo/psalm 4.7.1
Fix potential templated static issue

latest releases: 5.24.0, 5.23.1, 5.23.0...
3 years ago

Prevent type unsoundness in static generic

@gharlan pointed out that return new static can be unsound on generic classes (#5383).

This release fixes that unsoundness, emitting an UnsafeGenericInstantiation issue in some instances. The docs have more information.

Other bugfixes

  • @weirdan fixed an issue with instanceof being flagged after a class_exists check (#5498)
  • array_values and iterator_to_array should now respect nested templates (#5506)
  • @weirdan added a prohibition for @template annotations on closures (#5499)
  • @weirdan marked more functions as impure (#5524)
  • Improved error message when calling isset(self::$some_property) when the property has a non-nullable type, with help from @weirdan (#5489)
  • @vudaltsov marked flock and iterator_to_array as impure
  • Ensure function and methods are marked as used inside throw expressions (#5540, #5545)
  • Ensure nullsafe methods are assumed used (#5542)
  • @AndrolGenhald improved analysis of concats (#5544)
  • @weirdan improved the return type for get_object_vars() (#5557)
  • @weirdan added a coercion warning when coercing object to object{foo: string} (#5566)
  • @weirdan added support for arrays of objects in array_column (#5567)
  • fix assigned-in-conditional edge-case (#5578, #5640)
  • @AndrolGenhald added a lot of improvements to class constant resolution (#5591)
  • @AndrolGenhald fixed method visibility false-negative (#5595)
  • @orklah allowed numeric to be falsy (#5598)
  • @AndrolGenhald improved int/float comparison for conditional types, allowing a fix for range types (#5601)
  • @AndrolGenhald fixed a race condition with cache directory setup (#5603)
  • @orklah added numeric - int = string|float calculations (#5611)
  • @samsonasik marked json_last_error as impure
  • @weirdan forbidded rejecting named arguments when the parent method supports them (#5627)
  • @Jean85 added compatibility for xdebug handler 2.0
  • @VincentLanglet added support for @phpstan-import-type as an alias for @psalm-import-type (#5648)
  • @orklah added missing documentation for @no-named-arguments (#5654)
  • Use more accurate type combination rules when converting templated union (#5652)
  • Prevent crash when reporting issue on virtual arg (#5662)
  • Use mixed type for $foo->$bar, preventing UnusedVariable in some situations (#5518)
  • Ensure @var docblocks don’t override a variable's by-reference property (#5517)

Don't miss a new psalm release

NewReleases is sending notifications on new releases.