github vimeo/psalm 7.7.0

34 minutes ago

What's Changed

Features

  • feat(reconciler): a non-empty string that is not "0" is non-falsy by @jirkace in #13132
  • feat(instanceof): report instanceof iterable as a reserved word by @jirkace in #13093
  • Infer bounded ranges for |, ^, & and << on int ranges (#9902) by @jirkace in #12737
  • Infer templates when invoking generic first-class callables by @nicolas-grekas in #12714
  • Don't report MissingClassConstType for final constants by @orklah in #13889

Fixes

  • Don't make an array shape key optional because its value was possibly undefined by @jirkace in #12702
  • fix(loops): a variable a break leaves undefined is possibly undefined after the loop by @jirkace in #13089
  • fix(docblocks): an override documenting only some params inherits the others' types from the parent #13161 by @jirkace in #13271
  • Fix false PossiblyUndefinedVariable after reference bindings and elseif condition assignments by @orklah in #13795
  • Keep getter results after calls to methods whose body writes nothing by @orklah in #13793
  • Keep the narrowing of the other variables of an if or elseif condition assigned to a variable by @orklah in #13794
  • fix(references): a reference a branch or loop rebinds is detached from the variable it was bound to by @jirkace in #13707
  • Fix unsound negations of conditions with parts that can't be negated by @orklah in #13813
  • fix(class-exists): the class of a negated class_exists() is only phantom after the first statement of the block by @jirkace in #13293
  • fix(closure): don't keep the capture-time literal of a variable captured by reference by @jirkace in #13215
  • Allow public(set) on readonly properties by @orklah in #13817
  • Keep '0' in strings that are loosely != null by @orklah in #13819
  • fix(type): make union comparison independent of member order #3957 by @jirkace in #13709
  • Don't report a condition as already asserted when its key or property changed by @orklah in #13818
  • fix(foreach): a foreach by reference that writes every item leaves the written type in the array #4292 by @jirkace in #13273
  • fix(return-types): do not suggest never for an overridable method that always throws #9604 by @jirkace in #13289
  • fix(traits): self and static of a trait method refer to the class it ends up in when comparing signatures by @jirkace in #12678
  • fix(array-fetch): a remembered offset does not hide the null of the array it is read from by @jirkace in #13693
  • fix(assert): resolve self in an assertion of a trait method to the class using it by @jirkace in #13232
  • fix(foreach): a mixed value iterated by foreach may still be empty after it by @jirkace in #12686
  • Type the matches of the preg_replace_callback callback as nullable with PREG_UNMATCHED_AS_NULL by @jirkace in #12608
  • fix(loop): keep the assigned type of a do-while condition variable after the loop by @jirkace in #13359
  • fix(arrays): report an offset that can't be an array key when assigning to an array by @jirkace in #13180
  • fix(types): a space inside a type name is a syntax error by @jirkace in #12819
  • fix(reconciler): a loose comparison with a string keeps an object with __toString by @jirkace in #13113
  • fix(enum): resolve global constants as enum case values by @jirkace in #12841
  • fix(references): report more non-variable arguments of by-reference parameters by @jirkace in #12791
  • Infer an object cast of an array, scalar or null as an stdClass by @jirkace in #12723
  • fix(types): an array shape as the type of a @method parameter by @jirkace in #13781
  • fix(callmap): language constructs are not functions by @jirkace in #13360
  • Apply loop conditions only where they hold by @orklah in #13824
  • Tell apart conditions whose assertions had the same identity by @orklah in #13828
  • Fix: language server crash after an interface method is renamed by @alies-dev in #13783
  • Fix crash on a missing trait while following a method for property initialization by @alies-dev in #13784
  • Drop the clauses about a variable once it is reassigned by @orklah in #13829
  • Keep the classes checked with class_exists() on both sides of && and || by @jirkace in #12609
  • Type the variables after while (true) from its breaks only by @orklah in #13833
  • Resolve type variables in the results of closure, function and static calls by @orklah in #13840
  • Taint: don't share the by-reference out node of an inferred-pure callee across its calls by @orklah in #13826
  • Name the left operand of ?? in issue messages instead of a tmp coalesce var by @jirkace in #12594
  • fix(reconciler): a comparison narrows the bound of a template by @jirkace in #12601
  • fix(new): report UnsafeInstantiation for new on an object by @jirkace in #12867
  • fix(property): name the object in property assignment messages by @jirkace in #12901
  • fix(filter_var): the default filter supports FILTER_FLAG_EMPTY_STRING_NULL by @jirkace in #12828
  • fix(array_merge): put the elements after an array of unknown length into its rest by @jirkace in #13257
  • Validate writes to interface property hooks by @MohannadElemary in #13467
  • Document missing CLI options in help by @MrYamous in #13744
  • Pass $final when expanding the members of an intersection by @orklah in #13852
  • Keep a union that TypeExpander leaves unchanged by @orklah in #13848
  • Don't leak the narrowing of a ternary or ?? condition into the outer scope by @orklah in #13847
  • Fix the context after an if whose condition or body narrows by @orklah in #13832
  • Re-analyse a loop for variables defined before continue, not because an issue was recorded by @orklah in #13856
  • Infer method templates when calling a first-class callable of a bound generic object by @orklah in #13855
  • fix(callable): a protected callback is accessible from a parent class's method by @jirkace in #12910
  • fix(nullsafe): narrow the receiver and the value of a checked nullsafe property fetch by @jirkace in #13121
  • fix(assertions): trait_exists() with a false autoload argument asserts a trait-string by @jirkace in #13748
  • fix(coalesce): variables assigned in the call on the left of ?? are set on the right by @jirkace in #12990
  • fix(assertions): a nullsafe fetch identical to a non-null variable asserts its receiver by @jirkace in #12830
  • Narrow a class comparison only for ::class, not for other class constants by @jirkace in #12735
  • Check the constructor arguments of new on a class-string whose constructor can't change by @jirkace in #12706
  • Fix false RedundantCondition on loop condition after an offset unset in an if by @orklah in #13861
  • fix(algebra): negate a condition assigning on the right of && or || from the negated condition #13739 by @orklah in #13868
  • Widen int ranges a loop keeps shifting past the analysed passes by @orklah in #13865
  • Fix the narrowing of nullsafe call receivers and of variables reassigned on the right of an && by @orklah in #13864
  • Narrow through boolean flags set from calls, and keep them across offset writes by @orklah in #13867
  • Fix false PossiblyUndefinedArrayOffset after an isset() check on a list by @orklah in #13866
  • Taint: keep the flow through a static call of an inherited method through a subclass by @orklah in #13870
  • fix(algebra): count a variable passed by reference in a condition as assigned there #13739 by @orklah in #13879
  • fix(parser): report a duplicate type in a native union by @jirkace in #13131
  • fix(switch): use the variables of breaks for a case whose end is unreachable by @jirkace in #13385
  • fix(analysis): escape string offsets in array variable ids by @jirkace in #13086
  • Widen int ranges a loop keeps shifting in array values by @orklah in #13880
  • Fix assertions on self::$prop and static::$prop called from outside the class by @orklah in #13891
  • Keep what the right operand of && writes or forgets after the expression by @orklah in #13888
  • Update the holding arrays on a nested unset by @orklah in #13884
  • Report reads before a later assignment in a loop as possibly undefined by @orklah in #13885
  • Keep the truthy clause of a nullable int in the branches it guards by @orklah in #13892
  • Fix: an object-shape part object{} of an intersection makes method calls mixed by @alies-dev in #13876

Internal changes

  • Perf: serialize storages without keeping their property tables (cold run of a big app: -18 % peak memory, -7 % wall) by @alies-dev in #13593

New Contributors

Full Changelog: 7.6.0...7.7.0

Don't miss a new psalm release

NewReleases is sending notifications on new releases.