What's Changed
Features
- Report a constant top-level code uses before its declaration further down the file by @shu-chen-dot-ca in #15118
Fixes
- Report @psalm-cli-only methods overriding methods that may run outside of the command line by @danog in #15661
- Raise dependency lower bounds that cannot be installed or do not work by @orklah in #15657
- fix(reconciliation): a property a call writes through a helper method or an argument is no longer reported as already asserted by @shu-chen-dot-ca in #15023
- fix(return-type): static of a final class is the class itself in the signature check by @jirkace in #15246
- fix(constants): a class constant fetched on any expression has the type of the constant by @jirkace in #15249
- Keep an int an int after ctype_digit() and ctype_lower() by @shu-chen-dot-ca in #15645
- Analyse a loop again while the flags it combines bitwise keep changing by @arsalankhan786777 in #15652
- fix(destructuring): the null of a nullable value is assigned to the array holding the item by @jirkace in #15260
- fix(namespaces): the classes declared in an if of a namespace are known to the file by @jirkace in #15261
- fix(assertion): narrow a variable stepped by ++/-- and compared with an int literal by @jirkace in #15268
- fix(type): keep from_docblock on everything a docblock type expands to by @jirkace in #15269
- fix(traits): an adaptation of a trait method does not apply to the method the class declares by @jirkace in #15262
- fix(deprecated): do not report a deprecated property used by its own hooks by @jirkace in #15270
- fix(reconciler): name a literal in a redundant or impossible identity as a type by @jirkace in #15272
- fix(isset): read the name of a dynamic property or class constant in isset mode by @jirkace in #15276
- fix(template): a virtual property with only a set hook takes values by @jirkace in #15284
- Fix dynamic property refinement after unrelated writes by @sanketpatel32 in #15615
- fix(throws): a class declared on its own beside an intersection of it is still checked by @jirkace in #15291
- fix(type): --alter writes the type a type variable stands for by @jirkace in #15292
- Keep the assigned type of an object shape property for the next read by @Asimmirzac in #15660
- fix(call): a callback that takes some of the values of a union is a possibly invalid argument by @jirkace in #15297
- fix(comparator): get_class() of a union is checked as each class of it by @jirkace in #15300
- docs(skills): add lessons from pull request reviews by @jirkace in #15307
- fix(assert): identical arrays of unrelated interfaces intersect their values by @jirkace in #15311
- fix(assert): a nullsafe method call identical to a non-null value narrows its receiver by @jirkace in #15313
- fix(try): the conditions of a try body don't hold after a catch that continues by @jirkace in #15316
- fix(config): find the composer.json of the project above a config in a subdirectory by @jirkace in #15318
- fix(arrays): an offset written to a possibly undefined array leaves its other offsets optional by @jirkace in #15324
- fix(language-server): --disable-on-change without a value disables on-change analysis by @O1sumitkumar in #15654
- fix(missing-dependency): a method call on a class with a missing parent stops at MissingDependency also in a loop by @jirkace in #15336
- Report a misplaced covariant or contravariant keyword as InvalidDocblock by @jirkace in #15343
- Report UninitializedProperty on a property read in the arguments of a parent constructor by @jirkace in #15355
- Combine numeric-string with a non-empty literal or lowercase string to non-empty-string by @jirkace in #15358
- fix(properties): a @Property of a template is written through a generic object with the object's type arguments by @jirkace in #15369
- fix(callable): a callable array of several known method names is called as each of them by @jirkace in #15370
- fix(taint): @psalm-taint-unescape only adds its kinds back to taint flowing into the return by @jirkace in #15373
- fix(templates): each argument binding a template at several depths keeps its own deepest bounds by @jirkace in #15376
- fix(arrays): array_map() checks the elements against an invokable object or a typed callable by @jirkace in #15393
- fix(templates): a conditional type resolves an iterable through its array and Traversable parts by @jirkace in #15397
- fix(templates): static in the bound of an extended template param is the extending class by @jirkace in #15400
- fix(arrays): array_is_list() of an array keyed by a template is a list of its values by @jirkace in #15404
- fix(arrays): a list read by an int range only partly within its keys gives its values, not mixed by @jirkace in #15415
- fix(taint): parse SQL that is one of a few literals as each of them by @jirkace in #15440
- fix(templates): the class-string of a parent is the class-string of what the subclass passes for T by @jirkace in #15522
- Keep the first declaration of a global function declared in several files by @jirkace in #15543
- Count the result of a recursive call used outside of the return value as a use of the return value by @jirkace in #15544
- Leave the constants of Psalm's own stubs and dependencies out of --generate-stubs by @jirkace in #15344
- Handle PropertyNotSetInConstructor by the property id its message names by @jirkace in #15560
- Make long elseif and match chains on one variable cheap to analyse by @orklah in #15684
- Drop the always-true clauses of an || of int ranges by @orklah in #15685
- Analyse a group of fall-through switch cases in linear time by @orklah in #15686
- Compare literals by key in canExpressionTypesBeIdentical() by @orklah in #15683
- Cap the literals a cast of an int range expands into at 128 by @orklah in #15680
Internal changes
- Fix the language server test that waited 30 seconds per case by @orklah in #15658
- Fix master CI: MissingDependency loop test, ComplexMethod in getAnalyzeNamedExpression() by @orklah in #15676
- Reuse the formula of an || or && operand instead of rebuilding it at each level of a chain by @orklah in #15682
Other changes
New Contributors
- @Asimmirzac made their first contribution in #15660
- @O1sumitkumar made their first contribution in #15654
Full Changelog: 7.27.0...7.28.0