What's Changed
Features
- Keep non-emptiness on a shape with only optional keys by @orklah in #15720
- Write and unset a literal key in each disjoint array shape by @orklah in #15743
- Keep the shapes of a union of array shapes apart through array_merge(), + and spread by @orklah in #15770
- Keep the disjoint shapes of an array through array_map() and array_filter() by @orklah in #15768
- Bound an unbounded function template by the native types of the parameters and the return it types by @orklah in #15823
Fixes
- Keep a non-empty list non-empty when it is merged with a shape that holds another key by @MikeFTV in #15653
- Fix UnusedVariable and lost MixedAssignment hints on long assignment chains, bound ored clause pairs by @orklah in #15691
- Check each isset() argument only when the ones before it are set by @orklah in #15698
- Check paradoxes of an || whose CNF is too large to negate by @orklah in #15699
- fix(get_debug_type): report a comparison with a name it never returns by @ARAYN7011 in #15581
- fix(reconciler): allow intersecting undefined classes by @VishakhaSainani in #15655
- Compare the signature and purity of a callable object passed as a callable by @crispyaus in #15673
- fix(isset): read the name of a variable variable outside of isset mode by @arsalankhan786777 in #15681
- Forget the properties a closure writes of the objects it captured after it is called or passed by @arsalankhan786777 in #15687
- Don't report a constant a loop of top-level code define()s further down it by @arsalankhan786777 in #15689
- Pass a dynamic method or property name to the $name of __call, __callStatic, __isset and __unset by @orklah in #15721
- Read the bound of a * receiver through the iterator it returns by @orklah in #15718
- Narrow the array on === of an offset, without adding null to a possibly undefined offset by @orklah in #15706
- Invalidate the storage caches when a plugin changes by @orklah in #15723
- Keep what the cases of a long switch say of its variable past 50 labels by @orklah in #15700
- Give overlapping runs sharing a cache distinct custom taint bits by @orklah in #15717
- Report reads of write-only virtual properties by @sanketpatel32 in #15693
- fix(pseudo-methods): an overload with a static param accepts an object of the class of a non-final receiver by @jirkace in #15371
- fix(arrays): array_diff_key() with sealed shapes keeps the shape of the first array without their keys by @jirkace in #15334
- fix(superglobals): the headers and environment keys of $_SERVER may be empty, $_ENV has its own shape by @jirkace in #15250
- fix(arrays): array_column() of rows typed as generic arrays or unsealed shapes takes their values by @jirkace in #15414
- fix(templates): a decimal-int-string found by array_key_exists() on a template array is not narrowed to key-of by @jirkace in #15405
- fix(reconciler): is_callable() on an array of templates is a callable array by @jirkace in #15294
- fix(type): an intersection narrowed by its own main type does not repeat it by @jirkace in #15289
- fix(docblock): self and static of a class constant in an intersection are the class using them by @jirkace in #15254
- fix(algebra): narrow the operands of an xor condition by @jirkace in #15416
- Narrow shapes with optional keys by an exact count by @orklah in #15736
- Bound CNF formulas by two named thresholds in Algebra by @orklah in #15737
- Isolate trial analyses from the node data they leave behind by @orklah in #15734
- Fix static calls confirmed only by method existence providers by @sanketpatel32 in #15679
- Know the constants of a namespace in every file, whatever the analysis order by @jirkace in #15345
- Infer TReturn never for a generator whose end is unreachable by @jirkace in #15342
- Keep the disjoint shapes of an array shape when replacing its templates by @orklah in #15742
- fix(arguments): non-empty-mixed parameters and returns are checked by @jirkace in #15295
- fix(init): follow the private methods a trait constructor calls by @jirkace in #15314
- Narrow every receiver of a nullsafe chain with several ?-> compared to null by @jirkace in #15346
- fix(switch): a case assigning a variable forgets the narrowed offsets keyed by it by @jirkace in #14439
- The implicit key after a negative key follows it from PHP 8.0 by @jirkace in #15603
- fix(refactor): a conditional return type on a parameter keeps the parameter name when its docblock is rewritten by @jirkace in #15372
- Type a static variable the function never writes by its initializer by @jirkace in #15557
- fix(reconciler): asserting a generic class with narrower type arguments narrows them instead of intersecting the class with itself by @jirkace in #15386
- fix(docblock): read a spaced by-reference marker and an unspaced ellipsis of a param by @jirkace in #15296
- Check a trait method's return in the terms of the trait or of the class giving its templates by @jirkace in #15347
- fix(taint): a variable tainted by a plugin keeps where its value came from by @jirkace in #15283
- Narrow $a after is_string($a ?? null) and ($a ?? null) instanceof A by @orklah in #15745
- Report array_key_exists() of a key a sealed array shape doesn't list by @orklah in #15747
- fix(isset): an offset whose value is never is not possibly undefined where it is asserted to be set by @jirkace in #15257
- fix(assert): strict in_array of arrays that can be empty narrows to the empty array by @jirkace in #15310
- fix(reconciler): a loose == of arrays of different value types keeps both by @jirkace in #15309
- fix(casing): report the wrong casing of an imported class at its use statement by @jirkace in #15451
- fix(types): expand a properties-of that is the type of a property listed by properties-of by @jirkace in #15423
- Compare an array with each shape of a union of shapes it must fit by @orklah in #15741
- fix(callables): an invokable object or array callable takes its method templates from the expected callable's params by @jirkace in #15396
- Declare GMP's public constructor, available from PHP 8.2 by @orklah in #15790
- Keep the CallMap array shapes of imagick, PDO and SimpleXML stub methods by @orklah in #15791
- Declare ArrayAccess on MongoDB\BSON\Document and PackedArray stubs by @orklah in #15793
- Type PDO::getAttribute() per attribute, and add LOB resources to fetched PDO values by @orklah in #15796
- FFI::cast() accepts a string type and keeps the type of its pointer by @orklah in #15795
- Give a nested destructuring the items of every type the value may be by @Asimmirzac in #15677
- fix(templates): bound the type variable of a template constrained by itself with the variable by @jirkace in #15438
- Update the Redis stub parameters to phpredis 6 by @orklah in #15802
- Show the bound of a template in MixedArgument for an untyped argument by @orklah in #15794
- Restore the callmap's refined types in the dom, mysqli and simplexml stubs by @orklah in #15799
- Keep the assigned type of the properties of an
(object) [...]object by @orklah in #15792 - Type hash(), hash_hmac() and hash_pbkdf2() as returning false before PHP 8.0 by @orklah in #15797
- Fix crash on unrecognised
@psalm-annotation on aconstdeclaration by @pcbeingused33 in #15775 - fix(scalars): the name of a class or a trait is never a numeric-string by @jirkace in #15411
- fix(reconciler): a while condition and assert() forget what they say of an offset of a mixed variable, as an if does by @jirkace in #15379
- Make continue N continue the loop it targets by @orklah in #15827
- Keep the MixedAssignment an if nested in a branch types, and clear every assignment reaching the if by @orklah in #15801
- Report DeprecatedClass and InternalClass on static property fetches by @orklah in #15825
- Report a partly matching array_reduce callback param as PossiblyInvalidArgument by @arsalankhan786777 in #15824
- Fix malformed method tag parameters by @sanketpatel32 in #15837
- fix(properties): a magic property written a value it can't be read as reads as its declared type by @jirkace in #15437
- fix(templates): a loose comparison with key-of or value-of juggles through the bound by @jirkace in #15406
- Read the code for the project's PHP version in psalm-refactor, and accept option values after a space by @orklah in #15838
- Apply a foreach @var to a known variable with the assignment's code by @orklah in #15834
- Analyse a for's post-expressions and a do's condition after what the body and its continues left by @orklah in #15831
- Print a variadic callable param without the optional marker by @orklah in #15828
- Keep a property whose own docblock suppresses the unused issue under --alter by @orklah in #15826
- Pass from_docblock in its own parameter position by @orklah in #15877
Internal changes
- Use one constant for the literal limit by @orklah in #15690
- Reconcile only the new operand's negation at each level of an || chain by @orklah in #15694
- Count how often each performance threshold cuts an analysis short by @orklah in #15692
- Compare a literal only with the same literal when intersecting unions by @orklah in #15703
- Reuse the statements analyzer's node type provider view by @orklah in #15701
- Stop nested loops doubling the passes over inner loops at each level by @orklah in #15697
- Combine the literals of keyed array entries once, not once per array by @orklah in #15704
- Skip template inference on the arguments of a call to a callee without templates by @orklah in #15711
- Perf report: list the caps that changed from base first by @orklah in #15722
- Combine a class with value types and equal types without the full combiner by @orklah in #15715
- Make the vars_in_scope walks done on each assignment and property write cheaper by @orklah in #15719
- Leave default property values out of serialized storage and types by @orklah in #15713
- Make the taint graph preparation cheaper by @orklah in #15712
- Compute the clauses and the reconciliation of the else of an if once by @orklah in #15733
- Memoize per analyzed file what a callee's callees hand over by @orklah in #15732
- Skip the initialisation pass of a constructor that assigns its properties first by @orklah in #15735
- Make CodeLocation cheaper to construct by @orklah in #15731
- Stop re-analysing loops over a narrowed foreach value, and cache inner do-whiles by @orklah in #15739
- Collect the nodes the scan searches in one traversal by @orklah in #15748
- Fix master CI: ComplexMethod in two methods, and an offset array_key_exists() sets by @orklah in #15753
- Keep stubs in the parser cache when Psalm is installed under vendor/ by @orklah in #15756
- Parse each docblock once by @orklah in #15759
- Skip the string-start scan when the taint analysis doesn't run by @orklah in #15804
- Look file filter paths up by their parent directories by @orklah in #15757
- Read the compact state of a location property by property by @orklah in #15842
- Skip the conditional return of a call with no $this argument when checking whether it returns $this by @orklah in #15843
- Share the per-node work of the generator send searches in taint analysis by @orklah in #15845
New Contributors
- @crispyaus made their first contribution in #15673
- @pcbeingused33 made their first contribution in #15775
Full Changelog: 7.28.0...7.29.0