Update dependency vimeo/psalm to v7 #23
Loading…
Reference in a new issue
No description provided.
Delete branch "renovate/vimeo-psalm-7.x"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR contains the following updates:
^5.23→^7.0Release Notes
vimeo/psalm
v7.18.0: Contravariant templatesCompare Source
Features
@template-contravariant(also@psalm-and@phpstan-template-contravariant): a template for a class that only takes values, such as a handler, writer or mapper. ASink<Animal>fits where aSink<Dog>is expected, not the other way round, and Psalm reports the template where the class gives a value out. Plugins read the variance withClassLikeStorage::getTemplateVariance(). See Template contravariance; the templated annotations page was rewritten with checked examples. (#14669, @alies-dev)--debug-performance(short name--profile) prints where a run spent its time and memory: stages, workers, the slowest files, statements and functions, and plugin handlers. With a path it also writes a JSON profile that you can drop on https://psalm.dev/profile/ to see it as charts; the page reads it in your browser and sends it nowhere. See Finding out why Psalm is slow. (#14737, #14769, #14807, @alies-dev)skills/psalmteaches AI coding agents to run Psalm, fix its issues, write annotations and editpsalm.xmlthe way the docs recommend. Install it withnpx skills add vimeo/psalm --skill psalm, with thellm/skillsComposer plugin, or by copyingvendor/vimeo/psalm/skills/psalminto your agent's skills directory. (#13152, @roxblnfk; #14751, @danog; #14795, @roxblnfk)Performance
Fixes
Templates and type variables
new Pipe(fn (int $x) => ...)with aClosure(T): voidconstructor param capsTatint, so a later$pipe->push('s')isIncompatibleTypeParametersinstead of reaching theintcallback. (#14669, @alies-dev)@template U of T) is reported in a param even after an earlier param usedUlegally. (#14669, @alies-dev)new Coll([1]), then$c->add('x')) see every value it holds, not only the construction-site ones. (#14551, @shu-chen-dot-ca)nullno longer fits a template without a bound:fn() => nullforcallable(): T,[null]forlist<T>. (#14550, @shu-chen-dot-ca)@use. (#13429, @jirkace)@implements Wrapper<static>resolvesstaticto the object it is read from, and chained calls on such a value no longer hang. (#14572, @jirkace)@return static<NewK, NewV>on a template receiver keeps its new type arguments. (#14579, @jirkace)ImplementedReturnTypeMismatch. (#14502, @jirkace)preg_replace()on an array ofStringablereturns an array). (#14421, @jirkace)Tread at akey-of<T>offset isvalue-of<T>. (#14586, @jirkace)is_int(),is_scalar()and similar checks narrow a template bounded byscalar,numeric,array-keyor an int range instead of reportingDocblockTypeContradiction. (#14545, @jirkace)class-string<T>. (#14365, @jirkace)Coll<*>) gives the template's bound instead ofmixed. (#14666, @alies-dev)@template, the variance and the declared order of templates instead of marking every template@template-covariant. (#14669, @alies-dev)Narrowing and arrays
$a !== $bwith several possible values of$bdoesn't exclude them all from$a. (#14525, @jirkace)isset($array[$k])with$kone of several literal keys,$array[$k]is the value of those keys. (#14646, @jirkace)$arr[$key]stays known to be set when$keyis narrowed insideif (isset($arr[$key])). (#13344, @jirkace)InvalidArrayOffsetis reported when an item is read again under an index narrowed to a key the array can't have. (#14767, @orklah)($a ?? null) !== nullassertsisset($a). (#14517, @jirkace)instanceofa parent class narrows to the parent class. (#14318, @jirkace)get_class()of a union of classes is the name of any of them. (#14366, @jirkace)V&object{x: string}) has the type of both. (#14546, @jirkace)ensureArray*OffsetsExist, an offset that may be one of several literals is set only when each of them is. (#14606, @jirkace)maxShapedArraySize. (#14641, @jirkace)"a\r\nb"). (#14600, @jirkace)'6e5212ed-…'in Symfony'sFormconstraint. (#14797, @leonardsimonse)pow()of two int literals is an int literal. (#14505, @MikeFTV)Control flow
continueorbreakis possibly undefined after the loop. (#14509, @jirkace)breakthat reassigned it. (#14456, @jirkace)&&are defined in the next operands of the enclosing&&. (#14409, @jirkace)throworexitin a branch returnsvoid, notnever. (#14793, @MikeFTV)return, so it is noUnusedFunctionCall. (#14562, @jirkace)Callables and nullsafe calls
?->in a chain are analysed with a non-null receiver, as PHP skips the whole chain when it is null. (#14608, @jirkace)?->apply where the call is truthy. (#14531, @jirkace)__invoke()is callable. (#14590, @jirkace)__call()is not anUndefinedMagicMethod. (#14411, @jirkace)staticin closure hints of calls in a trait on other objects resolves to that object. (#14446, @jirkace)Closureobject of unknown signature is aClosure. (#14599, @jirkace)yield fromforwards the send type of the inner generator. (#14340, @jirkace)Reported issues
nullorfalsewith the expected type isInvalidArgument, notPossiblyInvalidArgument, in closure params ofarray_map()and similar functions and in__set()calls on a@property. (#14742, @orklah)ParadoxicalConditionon a dead||operand next to other values of the same variable. (#14821, @orklah)ParamNameMismatchfor a name another overridden method uses. (#14536, @jirkace)MethodSignatureMismatchfor@no-named-argumentson parameterless methods. (#14799, @orklah)sethook is checked against the hook's param type. (#14538, @jirkace)array_column()reads are used. (#14560, @jirkace)@implementsnaming an interface the class doesn't implement gets the same message with or without type arguments. (#14650, @jirkace)@psalm-suppressbefore the expression ofechoor<?=is read. (#14527, @jirkace)Stubs
ini_get()of a core setting no longer includesfalse. (#14809, @alies-dev)intval(),floatval()anddoubleval()report what the casts report. (#14311, #14805, @jirkace)ArrayObject::offsetSet()andArrayIterator::offsetSet()accept anulloffset. (#14516, @jirkace)pgsqlextension stub with thePGSQL_*constants, and the classes of thegeosextension. (#14637, #14631, @jirkace)FILTER_THROW_ON_FAILUREis defined and has no failure value. (#14359, @jirkace)Redis::auth()andRedisCluster::__construct()accept phpredis ACL credentials. (#14800, @orklah)WeakMap,SoapClient,MemcachedandPDOStatementuse the PHP 8 param names. (#14353, #14367, @jirkace)Name::$partsand uses v5'sArrayItemfor array and list items. (#14514, @jirkace)CLI, config and tools
reportInfo="false"also dropsPossibly*issues that takeinfofrom their parent issue. (#14785, @alies-dev)console,phpstormandgithub, run statistics (--stats, the timing line, the--profilesummary) go to stderr. (#14745, @alies-dev)--update-baselinekeeps multi-line samples of CRLF files. (#14794, @ARAYN7011)MissingDependencyand four other issues. (#14649, @jirkace)--generate-stubskeeps the trait uses and the interfaces of a class with a parent. (#14564, @jirkace)@psalm-scope-thisis scanned. (#14565, @jirkace)psalm-refactorrejects reserved words as destinations. (#14552, @MohannadElemary)Internal changes
PluginTestworks with psalm/plugin-phpunit 1.3.3. (#14810, @orklah)FunctionLikeAnalyzer::getFunctionLikeNode()(#14635) andConfig::getPreloadedStubFiles()(#14633), @jirkace. Psalm now requires psalm/psalm-plugin-api 0.5.2. (#14846, @alies-dev)New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/7.17.0...7.18.0
v7.17.0Compare Source
What's Changed
Features
Fixes
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/7.16.0...7.17.0
v7.16.0: Star projectionCompare Source
Features
Foo<*>: Kotlin's syntax for a generic argument you don't know. Reads go through the template's bound (Box<*>::get()isobjectforT of object), writes through it expectnever, andBox<*>accepts anyBox. See Star projection. (#13139, #13493, #14619, #14598, @alies-dev)Performance
||chains ofstr_starts_with(). Important for WordPress projects (#14653, @alies-dev)**entry already matched: 60 to 85 % faster with**/vendor-style entries. (#14624, @alies-dev)@methodtags: scanning up to 5 % faster on classes with hundreds of them, such as AWS SDK clients and Laravel Facades. (#14620, @alies-dev)Fixes
Templates
@extends Base<list<U>>,@extends Base<Box<TModel>>, also across two@extendslevels). (#14487 @jirkace, #14558 @alies-dev)newon a@template-covariantclass infersneverfor a template nothing can constrain, sonew Coll()fitsColl<int>. (#14449, @jirkace)Callables and invokable objects
__invokeis callable. (#14610, @alies-dev)array_map()with an invokable object as the callback infers the return type of__invokeinstead oflist<mixed>. (#14654, @alies-dev)Closureis expected is anArgumentTypeCoercion, not anInvalidArgument. (#14657, @alies-dev)Other
--find-references-tofinds the calls of a function. (#14648, @jirkace)Docs
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/7.15.0...7.16.0
v7.15.0Compare Source
What's Changed
Features
Fixes
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/7.14.0...7.15.0
v7.14.0Compare Source
What's Changed
Features
Fixes
Docs
Internal changes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/7.13.2...7.14.0
v7.13.2Compare Source
What's Changed
Fixes
Full Changelog: https://github.com/vimeo/psalm/compare/7.13.1...7.13.2
v7.13.1Compare Source
What's Changed
Fixes
Full Changelog: https://github.com/vimeo/psalm/compare/7.13.0...7.13.1
v7.13.0Compare Source
What's Changed
Features
Fixes
Docs
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/7.12.0...7.13.0
v7.12.0Compare Source
What's Changed
Features
@optional-arguments-by-name,@arguments-by-nameand@stable-parameter-namesby @nicolas-grekas in #12389Fixes
sort()andarray_unique()when Psalm runs on PHP 8.6 by @alies-dev in #14201$xwhen$x ??= $yis compared with null by @orklah in #14282statickept on the union of $this and another object of its class by @shu-chen-dot-ca in #14078Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/7.11.0...7.12.0
v7.11.0Compare Source
What's Changed
Features
Fixes
Internal changes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/7.10.0...7.11.0
v7.10.0Compare Source
What's Changed
Features
falseoffset, which PHP turns into0by @jirkace in #12690--min-type-coverageto fail below a type coverage minimum by @alies-dev in #14075Fixes
non-empty-scalarand similar types in namespaces by @orklah in #14079empty-scalarandnon-empty-scalarno longer accept any scalar by @orklah in #14080do-while's first iteration, notPossibly*by @orklah in #14032foreachand references by @orklah in #14099mixedvariablemixedafter anifthat wrote its offsets by @orklah in #14039mixedvariablemixedafterelse,switch,matchand||by @orklah in #14063PossiblyUndefinedVariableafterisset($var[$k])by @orklah in #14065InvalidArrayOffseton nested writes by @orklah in #14062nullcomparisons toneverby @orklah in #14036instanceofchecks toneverby @orklah in #14048===between overlapping types by @orklah in #14037class_exists()narrows only inside itsifblock by @jirkace in #13391$a?->m() ?? falsenarrows$ato non-null by @jirkace in #12995__METHOD__and falseLessSpecificReturnTypeby @danog in #14066#[\Override]on class constants and enum cases by @alies-dev in #14038__toString()calls by @shu-chen-dot-ca in #13782filter_var(null)returns''by @orklah in #14124libxml_set_external_entity_loader()is not an unused call by @alies-dev in #14118pathinfo()may omitdirnameby @orklah in #14122proc_open()and others by @orklah in #14100SplObjectStoragevalue checks and param names by @orklah in #14121stream_get_meta_data()keys may be undefined by @orklah in #14095key-of<T>/value-of<T>instead of reporting contradictions by @orklah in #14041key-of<T>/value-of<T>in operations by @orklah in #14064key-of<T>/value-of<T>afterarray_key_exists()/in_array()by @orklah in #14034stringin anarray|scalarargument to astring|arraytemplate by @orklah in #14098Internal changes
ComplexMethodonIfElseAnalyzer::analyze()by @orklah in #14088unset()of an offset in anisset()branch by @jirkace in #13123New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/7.9.0...7.10.0
v7.9.0Compare Source
What's Changed
Features
Fixes
curl_multi_get_handles()returnsarray<array-key, mixed>instead oflist<CurlHandle>by @alies-dev in #14022socket_addrinfo_lookup(),socket_cmsg_space()andldap_free_result()by @alies-dev in #14023Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/7.8.0...7.9.0
v7.8.0Compare Source
What's Changed
Features
markAllNonInternalCodeAsApifor libraries, and make the code a project doesn't ship internal by @danog in #13939Fixes
Full Changelog: https://github.com/vimeo/psalm/compare/7.7.0...7.8.0
v7.7.0Compare Source
What's Changed
Features
Fixes
helpby @MrYamous in #13744object{}of an intersection makes method calls mixed by @alies-dev in #13876Internal changes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/7.6.0...7.7.0
v7.6.0Compare Source
What's Changed
Features
Codebase::addReportableFiles()to report issues in files Psalm doesn't analyze by @alies-dev in #13725Fixes
@mixinlookup order: own, traits, parents; first declared wins by @alies-dev in #13694$project_files) by @alies-dev in #13719__call()by @alies-dev in #13727Docs
addReportableFiles()in the plugin entry point by @alies-dev in #13728Internal changes
Other changes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/7.5.0...7.6.0
v7.5.0Compare Source
What's Changed
Features
Fixes
--monochromeoption by @alies-dev in #13669Internal changes
Other changes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/7.4.0...7.5.0
v7.4.0Compare Source
What's Changed
Features
Fixes
Other changes
Full Changelog: https://github.com/vimeo/psalm/compare/7.3.2...7.4.0
v7.3.2Compare Source
What's Changed
Fixes
Internal changes
Other changes
Full Changelog: https://github.com/vimeo/psalm/compare/7.3.1...7.3.2
v7.3.1Compare Source
What's Changed
Fixes
NAN,INFand out-of-range float literals on PHP 8.5+ (backport) by @alies-dev in #13584Internal changes
Other changes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/7.3.0...7.3.1
v7.3.0Compare Source
What's Changed
Features
Fixes
$this/staticparam types by @alies-dev in #13494|in docblock types drops union members or invalidates@methodby @alies-dev in #13457Internal changes
Other changes
MissingOverrideAttributecheck by @maximal in #11798Full Changelog: https://github.com/vimeo/psalm/compare/7.2.1...7.3.0
v7.2.1Compare Source
What's Changed
Fixes
Docs
Internal changes
Other changes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/7.2.0...7.2.1
v7.2.0Compare Source
What's Changed
Features
HiddenGeneratorReturnfor a value a generator returns through a type without Generator by @alies-dev & @azjezz in #13485Fixes
emptyandfalsyconditional conditions resolve to the else branch by @alies-dev in #12448staticin the parameters of a static method called by class name to that class #5535 by @jirkace in #13261count()/gettype()/get_class()conditions by @alies-dev & @azjezz in #13484Docs
Internal changes
psalm/plugin-sabre-eventand allowpsalm/plugin-phpunit1.0 by @alies-dev in #13478Full Changelog: https://github.com/vimeo/psalm/compare/7.1.0...7.2.0
v7.1.0Compare Source
What's Changed
Features
Fixes
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/7.0.5...7.1.0
v7.0.5Compare Source
What's Changed
Fixes
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/7.0.4...7.0.5
v7.0.4Compare Source
What's Changed
Fixes
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/7.0.3...7.0.4
v7.0.3Compare Source
What's Changed
Fixes
array_firstandarray_last(PHP 8.5) by @alies-dev in #12157array_find/array_any/array_allcallbacks by @alies-dev in #13245array_pop/array_shiftby @alies-dev in #13246Docs
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/7.0.2...7.0.3
v7.0.2Compare Source
What's Changed
Fixes
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/7.0.1...7.0.2
v7.0.1Compare Source
What's Changed
Fixes
__destructand other magic methods is reported unused by @alies-dev in #13069__callStaticand the code it uses reported unused by @alies-dev in #13073Docs
Internal changes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/7.0.0...7.0.1
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: https://github.com/vimeo/psalm/compare/6.20.3...7.0.0
v6.21.4Compare Source
What's Changed
Fixes
Full Changelog: https://github.com/vimeo/psalm/compare/6.21.3...6.21.4
v6.21.3Compare Source
What's Changed
Fixes
Full Changelog: https://github.com/vimeo/psalm/compare/6.21.2...6.21.3
v6.21.2Compare Source
What's Changed
Fixes
AmbiguousConstantInheritancefor a constant reached through a parent class and an interface by @Aerendir in #12663New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.21.1...6.21.2
v6.21.1Compare Source
What's Changed
Fixes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.21.0...6.21.1
v6.21.0Compare Source
What's Changed
Features
Fixes
curl_share_setopt,imap_timeout,imap_expungeby @ThomasLandauer in #11858Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/6.20.13...6.21.0
v6.20.13Compare Source
What's Changed
Fixes
Internal changes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.20.12...6.20.13
v6.20.12Compare Source
What's Changed
Fixes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.20.11...6.20.12
v6.20.11Compare Source
What's Changed
Fixes
NAN,INFand out-of-range float literals on PHP 8.5+ (backport) by @alies-dev in #13584Internal changes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.20.10...6.20.11
v6.20.10Compare Source
What's Changed
Fixes
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/6.20.9...6.20.10
v6.20.9Compare Source
What's Changed
Fixes
array_firstandarray_last(PHP 8.5) by @alies-dev in #12157array_find/array_any/array_allcallbacks by @alies-dev in #13245array_pop/array_shiftby @alies-dev in #13246Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/6.20.8...6.20.9
v6.20.8Compare Source
What's Changed
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/6.20.7...6.20.8
v6.20.7Compare Source
What's Changed
Docs
Full Changelog: https://github.com/vimeo/psalm/compare/6.20.6...6.20.7
v6.20.6Compare Source
What's Changed
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/6.20.5...6.20.6
v6.20.5Compare Source
What's Changed
Fixes
#[\DelayedTargetValidation](PHP 8.5) by @alies-dev in #12282@mixinis ignored for property fetches by @alies-dev in #12289@methodis not resolved by @alies-dev in #12206Internal changes
opcache.jitis already off by @alies-dev in #12705Full Changelog: https://github.com/vimeo/psalm/compare/6.20.4...6.20.5
v6.20.4Compare Source
What's Changed
Fixes
#[\Deprecated]on traits (PHP 8.5) by @alies-dev in #12277Internal changes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.20.3...6.20.4
v6.20.3Compare Source
What's Changed
Fixes
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/6.20.2...6.20.3
v6.20.2Compare Source
What's Changed
Fixes
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/6.20.1...6.20.2
v6.20.1Compare Source
What's Changed
Fixes
--set-baselineruns with--use-baselineby @alies-dev in #12385Internal changes
Other changes
selfandparentin@param-outagainst the declaring class by @alies-dev in #12391New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.20.0...6.20.1
v6.20.0Compare Source
What's Changed
Features
Internal changes
Other changes
Full Changelog: https://github.com/vimeo/psalm/compare/6.19.2...6.20.0
v6.19.2Compare Source
What's Changed
Features
Fixes
parent::first-class callables of@methodpseudo-methods by @alies-dev in #12148Docs
Internal changes
Other changes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.19.1...6.19.2
v6.19.1Compare Source
What's Changed
Fixes
$class::$propreads and assignments when the class is a variable by @HenkPoley in #12040new $cchecks when the class string has a leading backslash by @HenkPoley in #12039Full Changelog: https://github.com/vimeo/psalm/compare/6.19.0...6.19.1
v6.19.0Compare Source
What's Changed
Features
@param-closure-thisdocblock tag by @alies-dev in #11853#[\Override]on properties (PHP 8.5) by @alies-dev in #11891IdeDetector, auto-detect IDE when none specified by @alies-dev in #11802Fixes
extraFilesalso for language server by @susnux in #11919clone()withProperties keys by @alies-dev in #11999Other changes
TKeyedArray::make()factory to 6.x for cross-version plugin compatibility by @alies-dev in #11810ca15124by @HenkPoley in #11856New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.18.1...6.19.0
v6.18.1Compare Source
What's Changed
Features
@self-out/@this-outby @alies-dev in #11964Fixes
Other changes
TypeParseTreeExceptionfor an incomplete conditional type by @alies-dev in #11962New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.18.0...6.18.1
v6.18.0Compare Source
What's Changed
Features
#[\NoDiscard]attribute by @alies-dev in #11892Fixes
tracekey toerror_get_last()by @janedbal in #11975Internal changes
Other changes
selfin@propertytype tokens at scan time by @alies-dev in #11846New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.17.2...6.18.0
v6.17.2Compare Source
What's Changed
Fixes
Other changes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.17.1...6.17.2
v6.17.1Compare Source
What's Changed
Fixes
Full Changelog: https://github.com/vimeo/psalm/compare/6.17.0...6.17.1
v6.17.0Compare Source
What's Changed
Features
new Box(1)followed by$box->set('two')under@template T of int|string) and introduces the newIncompatibleTypeParametersissue (level 1), documented in https://psalm.dev/docs/annotating_code/type_variables/ by @muglug in #11875Fixes
$thisfailing to parse inside generic type parameters by @alies-dev in #11768PHPSTORMenv var on Darwin by @alies-dev in #11801covariant/contravariantkeywords in generic type parameters instead of reportingUndefinedDocblockClass(backport) by @alies-dev in #11836TLiteralFloatnow rendersNANvalues asfloat(NAN)in type keys and IDs instead of crashing by @danog in9d6db9eandca15124Docs
docs/annotating_code/type_variables.mdand theIncompatibleTypeParametersissue page by @muglug in #11875Internal changes
impure-Closure prefix in TypeParseTest by @alies-dev in #11834Overridein SuicidalAutoloader fixture by @alies-dev in #11835test-with-real-projects.shon macOS (usegsedwhen available, tolerate a missing phar) by @danog in9d6db9ea2892df7b50a17voidParamTypetest: nikic/php-parser 5.8 rejects void params at parse time by @danog in056992aOther changes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.16.1...6.17.0
v6.16.1Compare Source
What's Changed
Fixes
Full Changelog: https://github.com/vimeo/psalm/compare/6.16.0...6.16.1
v6.16.0Compare Source
What's Changed
Features
Fixes
Internal changes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.15.1...6.16.0
v6.15.1Compare Source
What's Changed
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/6.15.0...6.15.1
v6.15.0Compare Source
Note: GPG signatures for older releases will be regenerated shortly using the new
99BF4D9A33D65E1Ekey, since the old one expired.What's Changed
Features
Fixes
Other changes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.14.3...6.15.0
v6.14.3Compare Source
What's Changed
Fixes
curl_close()function by @theodorejb in #11626NoDiscardattribute as immutable by @Baptouuuu in #11611Internal changes
Other changes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.14.2...6.14.3
v6.14.2Compare Source
What's Changed
Fixes
Full Changelog: https://github.com/vimeo/psalm/compare/6.14.1...6.14.2
v6.14.1Compare Source
What's Changed
Features
Full Changelog: https://github.com/vimeo/psalm/compare/6.14.0...6.14.1
v6.14.0Compare Source
What's Changed
Features
Internal changes
Other changes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.13.1...6.14.0
v6.13.1Compare Source
What's Changed
Fixes
Full Changelog: https://github.com/vimeo/psalm/compare/6.13.0...6.13.1
v6.13.0Compare Source
What's Changed
Features
iterator_to_arrayby @andrew-demb in #11430arrayCacheconfiguration key that can be used to disable the newly introduced array cache: this will slightly slow down execution times while reducing RAM usage, avoiding OOM issues on bigger codebases by @danogFull Changelog: https://github.com/vimeo/psalm/compare/6.12.1...6.13.0
v6.12.1Compare Source
What's Changed
Fixes
Full Changelog: https://github.com/vimeo/psalm/compare/6.12.0...6.12.1
v6.12.0: - Cache refactoringCompare Source
This release features a major cache refactoring, improving stability, removing race conditions and adding a new feature called cache consolidation, which consolidates the cache, normally composed of split files, into one single file with the
--consolidate-cacheflag, for quicker runs when doing whole project scans!To use cache consolidation, simply run Psalm with the
--consolidate-cacheflag after running a normal analysis: running with this flag will skip analysis and only consolidate the cache.If you consolidate your cache in CI runs, sure to re-consolidate the cache again after running Psalm before re-saving the updated cache.
What's Changed
Features
Fixes
Docs
numericsupertype by @kylekatarnls in #11444New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.11.0...6.12.0
v6.11.0Compare Source
What's Changed
Features
ClassFilePathProviderInterfaceplugin hook to polyfill custom autoloaders by @danog in #11422Fixes
Subscribe to the brand new Psalm newsletter to stay up to date with all of Psalm's news!
Full Changelog: https://github.com/vimeo/psalm/compare/6.10.3...6.11.0
v6.10.3Compare Source
What's Changed
Fixes
Full Changelog: https://github.com/vimeo/psalm/compare/6.10.2...6.10.3
v6.10.2Compare Source
What's Changed
Fixes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.10.1...6.10.2
v6.10.1Compare Source
What's Changed
Fixes
Full Changelog: https://github.com/vimeo/psalm/compare/6.10.0...6.10.1
v6.10.0Compare Source
Join the new official Psalm news channel and the Psalm community!
The news channel will be used to share inside exclusive news about upcoming Psalm features (including property hook support, coming within the next few releases!), and the community group can be used to discuss and share the way you use Psalm!
What's Changed
Features
Full Changelog: https://github.com/vimeo/psalm/compare/6.9.6...6.10.0
v6.9.6Compare Source
Add git, ssh and composer to the docker image by @danog.
Full Changelog: https://github.com/vimeo/psalm/compare/6.9.5...6.9.6
v6.9.5Compare Source
What's Changed
Fixes
Full Changelog: https://github.com/vimeo/psalm/compare/6.9.4...6.9.5
v6.9.4Compare Source
What's Changed
Fixes
Full Changelog: https://github.com/vimeo/psalm/compare/6.9.3...6.9.4
v6.9.3Compare Source
What's Changed
Fixes
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/6.9.2...6.9.3
v6.9.2Compare Source
Fixes multiplatform builds for the
latesttag of the docker image ».Full Changelog: https://github.com/vimeo/psalm/compare/6.9.1...6.9.2
v6.9.1Compare Source
v6.9.0: - Docker image!Compare Source
Psalm now has an official docker image!
It uses a custom build of PHP built from scratch, running Psalm +30% faster on average than normal PHP (+50% faster if comparing to PHP without opcache installed).
To use it, simply run:
Issues due to missing extensions can be fixed by enabling them in psalm.xml and/or requiring them in composer.json, see here » for more info.
Extensions not stubbed by Psalm itself (and thus not available as a psalm config option) may be stubbed using traditional PHP stubs.
What's Changed
Features
Full Changelog: https://github.com/vimeo/psalm/compare/6.8.9...6.9.0
v6.8.9Compare Source
What's Changed
Fixes
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/6.8.8...6.8.9
v6.8.8Compare Source
What's Changed
Fixes
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/6.8.7...6.8.8
v6.8.7Compare Source
What's Changed
Fixes
list{0: int, 1?: int}etc. by @MoonE in #11150Full Changelog: https://github.com/vimeo/psalm/compare/6.8.6...6.8.7
v6.8.6Compare Source
What's Changed
Fixes
Full Changelog: https://github.com/vimeo/psalm/compare/6.8.5...6.8.6
v6.8.5Compare Source
What's Changed
Fixes
@danogFull Changelog: https://github.com/vimeo/psalm/compare/6.8.4...6.8.5
v6.8.4Compare Source
This release introduces fully reproducible builds (the composer.lock file is now added to phars).
Full Changelog: https://github.com/vimeo/psalm/compare/6.8.3...6.8.4
v6.8.3Compare Source
What's Changed
Fixes
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/6.8.2...6.8.3
v6.8.2Compare Source
What's Changed
Fixes
Full Changelog: https://github.com/vimeo/psalm/compare/6.8.1...6.8.2
v6.8.1Compare Source
What's Changed
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/6.8.0...6.8.1
v6.8.0Compare Source
What's Changed
Features
Fixes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.7.1...6.8.0
v6.7.1Compare Source
What's Changed
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/6.7.0...6.7.1
v6.7.0Compare Source
What's Changed
Features
allowBoolToLiteralBoolComparisonconfig (disabled by default), used to control emission ofRedundantIdentityWithTrueissues (previously, their emission was controlled by thestrictBinaryOperandsconfig) by @danog in #11283#[Override]attribute detection (automatic Psalter fixer available) by @danog in #11283@methodor@property, see here for more info by @danog in #11283@psalm-suppress allannotation (may be re-enabled manually with the disableSuppressAll config) by @danog in #11283Fixes
Internal changes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.6.2...6.7.0
v6.6.2Compare Source
What's Changed
Fixes
Full Changelog: https://github.com/vimeo/psalm/compare/6.6.1...6.6.2
v6.6.1Compare Source
What's Changed
Fixes
Docs
Full Changelog: https://github.com/vimeo/psalm/compare/6.6.0...6.6.1
v6.6.0Compare Source
What's Changed
Features
Fixes
Docs
Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/6.5.1...6.6.0
v6.5.1Compare Source
What's Changed
Fixes
symfony/filesystemby @weirdan in #11273Internal changes
Full Changelog: https://github.com/vimeo/psalm/compare/6.5.0...6.5.1
v6.5.0Compare Source
What's Changed
Features
disableVarParsingconfig by @danogFixes
Full Changelog: https://github.com/vimeo/psalm/compare/6.4.1...6.5.0
v6.4.1Compare Source
What's Changed
Fixes
Internal changes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/6.4.0...6.5.0
v6.4.0Compare Source
What's Changed
Features
Fixes
Full Changelog: https://github.com/vimeo/psalm/compare/6.3.0...6.4.0
v6.3.0Compare Source
This release adds the new psalm-review tool!
What's Changed
Features
Fixes
Full Changelog: https://github.com/vimeo/psalm/compare/6.2.0...6.3.0
v6.2.0Compare Source
This release was possible thanks to a Psalm support contract!
This release adds the new LiteralKeyUnshapedArray issue, controlled by the disallowLiteralKeysOnUnshapedArrays configuration flag (false by default), useful to enforce usage of shaped arrays instead of generic arrays.
What's Changed
Features
Fixes
Full Changelog: https://github.com/vimeo/psalm/compare/6.1.0...6.2.0
v6.1.0Compare Source
This release was possible thanks to a Psalm support contract!
This release greatly improves multithreaded mode, fixing some nasty issues and greatly improving efficiency, thanks to efficient task scheduling powered by amphp/parallel (& some custom code to allow usage of copy-on-write optimizations with forks instead of spawning new processes).
This release also adds a runtime check to prevent Psalm from running on Linux systems where VM overcommitting is disabled: Psalm makes heavy use of VM overcommitting (specifically during forking in multithreaded mode) to greatly reduce RAM usage and improve performance.
Note that in the vast majority of Linux systems, VM overcommitting is already enabled by default.
What's Changed
Features
Fixes
Internal changes
Other changes
Full Changelog: https://github.com/vimeo/psalm/compare/6.0.0...6.1.0
v6.0.0: Psalm v6Compare Source
This is the first release of Psalm v6!
Users are encouraged to switch to Psalm v6 right away, as v5 is not supported anymore.
Also announcing Psalm's new support model: you can support Psalm development by requesting a support contract from Daniil Gentili, the only active maintainer of Psalm.
Support contracts can cover full integration of Psalm into existing codebases, support for Psalm issues and development of additional Psalm features.
See here » for info, pricing and contact information.
Main highlights of Psalm v6:
ignoreInternalFunctionFalseReturnandignoreInternalFunctionNullReturnare nowfalseby default: this means Psalm now warns when a false/null return type of a native function is not explicitly checked.Plugin authors should consult the changelog for info about BC-breaking changes.
What's Changed
Features
DuplicatePropertyissue by @tuqqu in #10265Fixes
Docs
@psalm-internaldocumentation example by @still-dreaming-1 in #10467Internal changes
TLiteralFloat::$valueandTLiteralInt::$valuetyped by @weirdan in #9517initialized_methodsContext property by @theodorejb in #10610masterfrom5.xby @weirdan in #10775masterfrom5.xby @weirdan in #10803Typos
Other changes
New Contributors
Full Changelog: https://github.com/vimeo/psalm/compare/5.26.1...6.0.0
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, 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.
⚠️ Artifact update problem
Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.
♻ Renovate will retry this branch, including artifacts, only when one of the following happens:
The artifact failure details are included below:
File name: vendor-bin/psalm/composer.lock
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.