Repository navigation
chore(deps): update dependency vimeo/psalm to v7 - #82
Open
text-html-renovate[bot] wants to merge 1 commit into
Open
text-html-renovate[bot] wants to merge 1 commit into
text-html-renovate[bot] wants to merge 1 commit into
Conversation
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^6.0→^7.0Release Notes
vimeo/psalm (vimeo/psalm)
v7.0.0: Psalm 7Compare Source
Psalm 7
Announcing the release of Psalm 7!
Featuring a simply enormous number of new features and bug fixes, such as:
php://inputand uploaded file names, flows through closures, generators, traits and by-reference parameters, and ready-made stubs for Guzzle, PSR-7, Monolog, MongoDB and more.io,time,write-props...), with purity templates for classes, closures and automatically inferred annotations;@template TError of Throwable = RuntimeException) for classes, functions and methods:Result<int>just works, and libraries can add templates without breaking their users.dev-master.Psalm 7 runs on 64-bit PHP 8.2 to 8.6. Upgrading is simple for most projects: see Upgrading below.
Security analysis: faster, always on, in a single run
Taints are now stored as a bitmask, and the taint graph is resolved over compact summaries of each function. This makes security analysis up to 10x faster.
Combined analysis (#11384) runs type checking, security analysis and dead code detection together in one run, so taint analysis is now on by default (#11399).
Taint issues are reported with a
SECURITYseverity, and with a rank in SARIF reports (#12068, #11383). The results no longer change between runs or with the thread count (#11946, #11952, #11953).Deeper taint tracking
Try it on psalm.dev »
TaintedNosql(MongoDB sinks),TaintedLlmPrompt(prompt injection), andTaintedUrlComponent/TaintedUrlPath(query and path injection). curl options andCURLFileare reported by what they do: SSRF, header injection, file access, sleep or callables. Every taint type is now documented (#11944, #11746, #12097, #12099, #12468).php://input,STDIN, the client-sent entries of$_SERVERand$_FILES,getopt(),$argv, DNS answers, exception messages, and the files, paths and URLs builtins read (#11945, #12086, #12246, #12245, #12135, #12139).foreachby reference, global and static variables, trait method bodies, promoted constructor properties,__toString(), inherited methods and their overrides, exceptions, and builtin functions and objects (#12147, #12096, #12095, #12121, #12243, #12255, #12272, #12091, #12127, #12262, #12084, #12102).inthas nohtmltaint). Array keys are tracked much more precisely. Inferred-pure functions are specialized per call, and@psalm-cli-onlymarks code whose output isn't an HTML response (#12079, #12348, #12150, #12375, #12048, #12459).loadLibraryStubs, on by default) (#12460–#12467, #12481–#12484).@psalm-taint-sink ($mode is 0 ? null : 'html') $content(#12458);@psalm-taint-sink sql $params[*](#12171);@psalm-taint-source input return['key'](#12455);~(html|has_quotes)(#12300);@psalm-flowthrough callables (($compute()) -> return), the receiver (($this) -> return),$thisproperties, and keyed stores (($value) -> Store::$data[$key]) (#12299, #12302, #12456, #12312, #12327);@psalm-taint-property-bag(#12486);psalm.xml(#12330).Codebase::getTaintNode(),getTaintPropertyNode(),addTaintPath(),getReceiverTaintPath(), and the taint nodes of a call's return value, arguments and receiver (#12454, #12414, #12489, #12535).A new purity model: capabilities
@psalm-pure,@psalm-mutation-freeand@psalm-external-mutation-freeare replaced by capabilities, modelled on Hack's contexts and capabilities. A function-like declares exactly which side effects it may have:read-props,write-this-props,write-props,read-globals,write-globals,write-refs,ioandtime, withpureandimpureat the two ends (#11984):Try it on psalm.dev »
<psalm suggestPurityAnnotations="true">to getMissingPureAnnotationandMissingImmutableAnnotation(and their abstract and interface variants), and run--alter --issues=MissingPureAnnotation,MissingImmutableAnnotationto add the annotations. The--altercommand works without the attribute. The suggestions are opt-in.clone,__toString(),__invoke(),ArrayAccess, destructors,new $classand parameter defaults are now checked too.@psalm-purecan be used on classes, and plugins can declare the capabilities of the methods they handle.The new Purity Model article explains the model in full.
Purity templates
Many functions are only as pure as what they are given:
array_map()is pure when its callback is. Purity templates are template parameters whose values are capability sets instead of types, like Hack's[ctx $f]contexts. A function can now be both pure and higher-order, and each call costs only what its arguments do (#11984).With
Closure[_], a function takes its purity from the closure it is given:On a class, a purity template lets each subclass decide what its methods may do:
Traversable,Iterator,IteratorAggregateandGeneratorhave a purity template, for what iterating over them does.iterablehas one too. A generator with a purity annotation binds it to what its body does:Closure[io](int): void,Handler[pure],Iterator[pure]<int, string>,Box[io]<int>. Named templates are declared with@psalm-purity-template Pand used with@psalm-purity-from-template P.@psalm-purity-template write-this-props <= C(write-this-props) <= write-this-props|write-props|io. A method may use the lower bound unconditionally. Subclasses must stay within the bounds, and get the default when they don't bind the template.Closure[P]parameter or a conditional@returnon__construct. For example,new ArrayObject([...])is anArrayObject[pure], so a pure function may fill anArrayObjectit created (#12116, #12179, #12190).--alteraddsClosure[_]to the closure parameters a function calls (#12077, #12019).array_map,usort,preg_replace_callback,iterator_to_array,CallbackFilterIterator,Fiberand more (#12122).See Purity templates in the Purity Model article.
Graph-based dead code detection
Unused code is now found on a graph of references (#11939). Code is used only if it can be reached from an entry point, so classes and methods referenced only by other unused code, cycles included, are reported. Exceptions that are created but never thrown are reported too (#12487):
Try it on psalm.dev »
--find-unused-psalm-suppressnow also checks suppressions on classes and onTainted*issues.Type system
Template defaults: a template can declare a default type,
@template T = Defaultor@template T of Bound = Default, on classes, interfaces, traits, functions and methods. Psalm uses it when the type argument is left out: in@extends/@implements/@use, in a generic type with only its first arguments (Result<int>), innew, and in calls that don't infer the template. Libraries can add a template without breaking everyFoo<A>their users wrote, and those users no longer getMissingTemplateParam. See Template defaults.Try it on psalm.dev »
New types and syntax:
decimal-int-stringandnon-decimal-int-string, global constant wildcards, conditional types on types that depend on a template,is notin conditional types, and exact intersections of scalar and conditional types.Constructor
@returntypes.New
IntMaskComparisonissue for int-masks compared by value.PHP 8.5 and 8.6
Psalm runs on PHP 8.6 and has a PHP 8.6 call map.
The PHP 8.5 pipe operator and PHP 8.6 partial function application are fully typed: Psalm infers the type of every pipeline stage and the signature of every partially applied closure, so a stage that doesn't fit the previous one is reported :
Try it on psalm.dev »
Plugins
^0.4): Composer will then only install the plugin with a Psalm release whose plugin API it was written for.psalm/plugin-phpunit,plugin-mockery,plugin-symfony,plugin-laravelandplugin-sabre-event, and enables each one, plus the webmozart/assert plugin, when yourcomposer.jsonuses the matching library (loadLibraryPlugins, on by default) (#12568, #12570, #12571).ERROR_LEVEL(#11735, #11736).CLI and configuration
--init-cigenerates a GitHub Actions workflow that runs the official Docker image, pinned to the Psalm version in yourcomposer.lock. The docs now cover the Psalm GitHub Action and the Psalm Security Scan action, which sends security analysis results to GitHub code scanning.ghcr.io/psalm/psalm.compactoutput format is renamedtable, and a new, truly compactcompactformat is added.<unsuppressibleIssues>makes the issues it lists impossible to suppress.Upgrading
For most projects, upgrading is as simple as updating the Composer dependency:
Everything else is in the upgrade guide.
Most projects will notice:
runTaintAnalysis="false"to opt out.<psalm suggestPurityAnnotations="true">, newMissingPureAnnotation/MissingImmutableAnnotationissues appear for code that can be annotated. Fix them with--alter --issues=MissingPureAnnotation,MissingImmutableAnnotation. The annotations Psalm adds improve both security analysis and type inference:$a->get() !== null ? $a->get() : ''is astring. Without@psalm-immutable, the second call is still?string.Thanks
Thanks to everyone who contributed to Psalm 7, and to everyone who tested the betas and release candidates and reported issues!
Full Changelog: vimeo/psalm@6.20.3...7.0.0
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate CLI.