packagist vimeo/psalm 7.25.0

2 hours ago

What's Changed

Features

  • Add an MCP server, and make the agent skill a Claude Code plugin by @danog in #15004
  • Make @psalm-flow of the elements of a property bag act on its properties by @danog in #15509
  • Add sinks on the values under keys of array parameters by @danog in #14955
  • Codebase::addTaintDatabaseWrite() and addTaintDatabaseRead(): plugins store in and read the database columns by @danog in #14382
  • Scan with the worker pool in the language server by @danog in #15531
  • feat(language-server): provide document symbols by @tm1000 in #15503
  • Add --dry-run to psalm-refactor by @danog in #15549
  • Let an override opt out of inherited taint sources with @psalm-taint-source none by @danog in #15098
  • Add MCP tools to find symbols and members, trace taint issues, and fix, rename and move code by @danog in #15554
  • Let only this user connect to the language server's socket, and send it only text by @danog in #15528
  • Answer requests while the language server analyses the open files by @danog in #15569
  • Add a write-caches capability, allowed in the methods of specialized classes by @danog in #15625

Fixes

  • Fix: CLI crash on a type ending in two dots by @alies-dev in #15470
  • Fix: crash on a default value in a callable parameter type (report InvalidDocblock on PHPDoc callable default values) by @alies-dev in #15413
  • Fix: parse tree leak on an invalid docblock type by @alies-dev in #15476
  • Keep what __get() returns on a read of a magic property a sealed class doesn't define by @danog in #15204
  • Don't report the negated left side of an || at an array_key_exists() on the right by @danog in #15055
  • Bound the documents of MongoDB CursorInterface to array|object as Cursor does by @danog in #15054
  • Resolve magic constants in the string starts of a class's methods by @danog in #15192
  • Take the string start of a method or function from all its returns by @danog in #15193
  • Don't crash on properties with integer-like names set and got by name by @danog in #15481
  • Don't read the storage of class-likes that may not be scanned yet when scanning docblocks by @danog in #15480
  • Keep the type arguments of a generic object when expanding an inferred closure param by @danog in #15073
  • fix(language-server): coalesce pending analyses instead of dropping them by @tm1000 in #15241
  • fix(types): an int operation on an operand that may have overflowed to a float may be a float too by @alex00010 in #15395
  • Read the arguments of named function calls by parameter name by @backendArchitect in #15240
  • Report the source expression when destructuring a non-array value by @abu-tahir-0 in #15468
  • fix(taint): an unpacked array of unknown shape keeps its taint in the parameters it fills by @shu-chen-dot-ca in #15035
  • Fix taint flows of @psalm-taint-specialize objects through temporary receivers and callables by @orklah in #15494
  • fix(language-server): analyze a pending file before a request reads its analysis by @tm1000 in #15491
  • Compare the type params of every generic part of an intersection by @shu-chen-dot-ca in #15308
  • fix(constants): a class constant with a docblock type is not missing a type by @jirkace in #15452
  • Accept array and string callables that differ from the expected callable by a variadic parameter by @jirkace in #15460
  • Report a negated array_is_list() of a docblock list over a native array as DocblockTypeContradiction by @jirkace in #15362
  • Fix false PossiblyUndefinedVariable after a try for a variable a while (true) loop in it defines by @jirkace in #15340
  • fix(loops): keep arithmetic exact on a variable the same pass assigned a value the loop doesn't change by @jirkace in #15422
  • fix(cache): the analysis PHP version is part of the cache hash by @jirkace in #15317
  • fix(isset): read the receiver of a call under isset(), empty() or ?? as anywhere else by @jirkace in #15458
  • Evaluate defined() of a class constant when scanning conditional declarations by @jirkace in #15354
  • fix(stubs): the reader methods of the classic DOM classes only read their object by @jirkace in #15459
  • fix(inheritance): keep the return type of a method whose documenting method only documents its params by @jirkace in #15439
  • Treat a write under a template key with a single literal bound as a write under that key by @jirkace in #15352
  • fix(if): the classes an else that falls through proves to exist are kept after the if by @jirkace in #15303
  • Fix qualified constant resolution fallback by @sanketpatel32 in #15502
  • fix(types): unary minus and plus keep the possible float overflow of their operand by @arsalankhan786777 in #15504
  • perf(language-server): don't write the reference cache to disk by @tm1000 in #15496
  • Forget the properties of the receiver of a builtin method that may write them by @danog in #15057
  • Treat what filter_input(), getallheaders() and other request functions return as user input by @danog in #15488
  • Report a value after a literal URL start again once text is put before it by @danog in #15205
  • Report a value after a literal URL start again once a builtin cuts the string by @danog in #15485
  • Report a value after a literal URL start again in the characters of the string by @danog in #15486
  • Report a redirect to a value continuing the first segment of a path with text before it by @danog in #15487
  • Leave a specialized call only through its own call site when other parameters are tainted by @danog in #15190
  • Bind the class templates of an inherited constructor's params as the subclass does by @danog in #15053
  • Pass the taints of an unpacked array or iterable to the parameters given its elements by @danog in #14961
  • Populate again the class-likes populated before the interfaces and traits of the stubs by @danog in #14964
  • Check the extensions of a file against the composer.json of its package in a monorepo by @danog in #14953
  • Apply the assertions of each receiver type of a union to the variables as they were before the call by @danog in #15047
  • Follow the taints of properties fetched and assigned under names that are not literals by @danog in #15484
  • Treat what readline callbacks and SplFileObject read from the terminal and the request as user input by @danog in #15514
  • Give func_get_args() and func_get_arg() the taints of the arguments by @danog in #15516
  • Expand the types of a class constant and its override before comparing them by @danog in #15515
  • Follow the taints of the callables given to Closure::fromCallable() by @danog in #15517
  • Give back the taints escapes removed to what builtins decode by @danog in #15511
  • Find the subclasses of a class at any depth by @danog in #15510
  • Report a value after a literal URL start again once a character of the string is overwritten by @danog in #15513
  • Pass the taints of magic calls through __call() and __callStatic() by @danog in #15512
  • Enter the overrides specialized by call with a specialization of each virtual call by @danog in #14957
  • Notice a file written again with its size and modification time in the MCP server by @danog in #15525
  • Load the stub of an extension composer.json doesn't require when the code uses it by @danog in #14231
  • Keep the template a conditional return type makes of a parameter of an inherited type by @danog in #14068
  • Give an override the method templates that the parameter types it inherits name by @danog in #15519
  • Report an object a pure function hands to a fiber or a generator by @danog in #15523
  • Don't report a value after a literal ? or # as choosing where a redirect goes by @danog in #15168
  • Don't take what an object's construction gave for all it can hold in the taint analysis by @danog in #15527
  • Cut long results of the MCP server's psalm_check, and stop all the processes of a cancelled one by @danog in #15518
  • Find references with several threads, imports included, and report the progress of MCP calls by @danog in #15526
  • Follow the object and keyed stores into the arguments of callables, and the flows of constructors by @danog in #14966
  • Pass taints through the callbacks of array_reduce(), array_walk(), the sorts and the other builtins calling them by @danog in #14958
  • Load the stubs of the extensions named in strings and by dependencies by @danog in #15529
  • Follow taints into the keys written to arrays by @danog in #15530
  • Leave null for the negated isset() of a nullable optional offset by @MikeFTV in #15233
  • Report a hyphenated name with generic params as an unrecognized type by @shu-chen-dot-ca in #15498
  • Don't report UnnecessaryVarAnnotation on a destructuring foreach inside another loop by @ARAYN7011 in #15239
  • fix(types): account for overflow in negated float checks by @Golden007-prog in #15495
  • fix(templates): the default of a template is a type written in a docblock by @jirkace in #15012
  • fix(arrays): an empty array is no coercion for a list shape with required elements by @jirkace in #15255
  • fix(assertions): is_scalar() keeps the callable-string of a callable by @jirkace in #15256
  • fix(taint): a numeric string is as safe as a numeric value by @jirkace in #15258
  • fix(properties): an undefined static property is reported once by the assignment writing it by @jirkace in #15259
  • fix(switch): a switch on strings compares them as == does by @jirkace in #15302
  • fix(templates): a covariant or contravariant template nested in an invariant extended param is reported by @jirkace in #15410
  • fix(assertions): a comparison with a constant that is true or false narrows like the literal by @jirkace in #15418
  • fix(properties): report a readonly property redeclared as non-readonly, or the reverse, and one without a native type by @jirkace in #15448
  • fix(baseline): match issues whose selected text has a lone CR by @jirkace in #15267
  • fix(arguments): report array_find, array_any, array_all and array_find_key without a callback by @jirkace in #15271
  • fix(callmap): date_interval_create_from_date_string() returns false on an invalid string by @jirkace in #15273
  • fix(comparator): contravariant never holds every projected argument by @jirkace in #15275
  • fix(docblock): a @var on a yield sees the templates and type aliases by @jirkace in #15279
  • fix(assertion): report an impossible gettype() or get_debug_type() comparison of an expression by @jirkace in #15280
  • fix(template): check the variance of a template in class-string by @jirkace in #15285
  • Report InvalidDocblock for a @template whose as/of/super has no bound type by @shu-chen-dot-ca in #15499
  • fix(language-server): reanalyze the open files when a closed file changes on disk by @tm1000 in #15546
  • Negating an int that may be PHP_INT_MIN may overflow to a float by @alex00010 in #15541
  • fix(constants): keep a namespaced const out of other namespaces of the file by @manch1915 in #15507
  • Test the closures calling a static method with conditional capabilities by @danog in #15539
  • Rename the overrides of a method with it in psalm-refactor by @danog in #15550
  • Pass the taints of arrays to the keys builtins put their values under, and the arrays array_map() is given unpacked by @danog in #15532
  • Treat fibers like generators: charge writing a new object after handing it over, not the hand-off by @danog in #15538
  • Type a by-reference argument once the later arguments have bound its templates by @danog in #15553
  • Analyze the calls of builtins given named and unpacked arguments with them by position by @danog in #15556
  • Give an override the signature it inherits in one place, as if its docblock repeated it by @danog in #15558
  • Call the builtins the PHP running Psalm lacks by the names in variables by @danog in #15561
  • Use the PHP version of the project in the language server by @danog in #15564
  • Follow assignments of elements, lists and loops to magic properties into __set by @danog in #15565
  • Keep the start of a URL whose whitespace str_replace() replaces by @danog in #15573
  • Read back what is written to memory streams and temporary files in the taint analysis by @danog in #15574
  • Decode what bin2hex() encodes again in the taint analysis by @danog in #15577
  • Keep the taints of copied calls whose open assignments are forgotten by @danog in #15578
  • Follow taints through the methods that callable arrays and strings name by @danog in #15579
  • Keep the taints of a property that only some classes of a union have by @danog in #15580
  • Follow taints through raw digests by @danog in #15590
  • Accept any argument for a template bounded by a class template of mixed by @danog in #15534
  • Resolve conditional capabilities over documented, templated and variadic parameters by @danog in #15535
  • Follow taints through XML and HTML documents by @danog in #15588
  • Give an object read as an array the taints of its properties by @danog in #15591
  • Keep the taints numbers carry through arithmetic and narrowing by @danog in #15589
  • Give back the taints that replacements decode by @danog in #15571
  • Leave the receivers whose method never returns out of what a call on a union asserts by @danog in #15559
  • Ask the return type provider of the class whose @mixin a method is found through by @danog in #15595
  • Keep PHP 8.6's own classes unprefixed in the phar by @danog in #15596
  • Traverse a parsed type once to look for the purity wildcard by @danog in #15601
  • fix(property): an optional object shape property reads as its type or null, not possibly undefined by @arsalankhan786777 in #15576
  • fix(language-server): reanalyze the methods that use an inherited member that changed by @tm1000 in #15542
  • fix(template): bind templates for non-first generic members in intersections by @VishakhaSainani in #15520
  • Write an offset of a template through each type of its bound by @alex00010 in #15585
  • fix(constants): define() inside a namespace defines the constant by its full name by @manch1915 in #15586
  • Speed up the analysis of count() assertions on lists, many keyed arrays and many literals by @orklah in #15616
  • Keep the taints written to a property of a DOM node in that node by @orklah in #15618
  • Take nothing assigned to the keys of an array a call is given in a fetch of its values by @danog in #15605
  • Enter despecialized calls made in specialized calls as entries of their own by @danog in #15600

Internal changes

  • Remove the redundant parse tree destructor by @alies-dev in #15471
  • Perf: Avoid copying unchanged tokens during type qualification by @alies-dev in #15472
  • Perf: Tokenize type names in runs by @alies-dev in #15473
  • Perf: Combine distinct simple union types directly by @alies-dev in #15474
  • Remove an unused import of TypeParser by @danog in #15483
  • refactor(language-server): set each server capability once by @tm1000 in #15492
  • test(callmap): compare static in a call map return type as the class of the method by @jirkace in #15456
  • fix(types): compare the parent class with null where TypeExpander replaces parent by @jirkace in #15521
  • Require psalm/psalm-plugin-api 0.5.5 by @danog in #15533
  • Agents: add a skill on non-blocking I/O by @danog in #15537
  • Restore two TaintTest edits a merge dropped by @danog in #15593
  • Add new test cases next to related ones, not at the start or end of a provider by @danog in #15592
  • Sort the use statements of PluginTest by @danog in #15597
  • Run the phar's MCP check from a file by @danog in #15598
  • Pack the state of taint resolution in ints by @orklah in #15584
  • Evict the statements of each file from the parser cache once it is analysed by @orklah in #15617

Other changes

  • Say in the output of psalm --init that a lenient errorLevel is where the project starts by @danog in #15633
  • Pin event 3.2.0 in the stub images of PHP 7.0 to 8.0 by @danog in #15634
  • Finish the task the agent was given before it climbs to errorLevel 1 by @danog in #15636

New Contributors

Full Changelog: 7.24.1...7.25.0

Don't miss a new psalm release

NewReleases is sending notifications on new releases.