This is the last pre-release before Psalm 5 official release
What's Changed
Removed
- Php version consistency by @orklah in #6898
- Removed TEmpty by @orklah in #6662
- remove support for allowPhpstormGenerics by @orklah in #6705
- remove exitFunctions for Psalm5 by @orklah in #6808
- Drop legacy procedural files by @weirdan in #7270
- Dropped removed config entries by @weirdan in #7272
- Dropped legacy plugin API by @weirdan in #7275
- Dropped deprecated
CodeIssue
methods by @weirdan in #7276 - Dropped deprecated
DocComment
methods by @weirdan in #7278 - Dropped
THtmlEscapedString
by @weirdan in #7285 - Drop orphaned token by @weirdan in #7290
- Bump PHP version to 7.4 by @weirdan in #7291
- Remove forbidEcho by @orklah in #7420
- remove TPositiveInt by @orklah in #7473
- Lock event classes by @weirdan in #7491
- [TASK] Add AfterFunctionLikeAnalysisEvent::getFunctionlikeStorage by @ohader in #7526
- Finalize (and internalize) more classes by @weirdan in #7578
- Finalize issues by @weirdan in #7595
- Finalize storages by @weirdan in #7597
- Finalize virtual nodes by @weirdan in #7598
- Finalize types nodes by @weirdan in #7623
- remove totallyTyped by @orklah in #7651
Features
- Support PHPStan notation for empty-arrays by @orklah in #7312
- Try to provide literal int types when possible (fixes #6966) by @ricardoboss in #7071
- Allow config to define thread count by @M1ke in #7442
- Contextual type inference for high order function arg by @klimick in #7417
- feat: Handle native intersection types by @petewalker in #7454
- improve support for enum_exists by @orklah in #7404
- Support type annotations for class consts (fixes #942). by @AndrolGenhald in #7123
- Improve class constant static analysis by @AndrolGenhald in #7154
- Add support for references and improve UnusedVariable checks (fixes #7254). by @AndrolGenhald in #7339
- InternalTaintSinkMap: Add
getimagesize
as SSRF sink by @mal-tee in #7504 - Enable extensions based on composer.json instead of those loaded at runtime (fixes #5482). by @AndrolGenhald in #7107
- Dynamic function storage provider by @klimick in #7471
- ❗Allow plugins to modify Config::$fileExtensions early by @ohader in #6789
- [FEATURE] Introduce BeforeStatementAnalysisEvent by @ohader in #7535
- [FEATURE] Allow to intercept adding issue in IssueBuffer by @ohader in #7530
- Ensure all template parameters are specified in all extended|used classlikes by @danog in #7492
- feat: make key-of/value-of usable with non-const arrays by @Patrick-Remy in #7396
- More class const improvements. by @AndrolGenhald in #7666
- Add
@psalm-check-type
and@psalm-check-type-exact
. by @AndrolGenhald in #7686 - feat(types): add properties-of type by @Patrick-Remy in #7359
- Invert meaning of dupe_key by @danog in #7475
- Feature: allow non-union assertion types by @boesing in #8077
- Allow
value-of
to work with backed enums (fixes #7874). by @AndrolGenhald in #8283 - Add capability to use inclusion files in a different directory (fix) by @gmessier in #8402
- Add dirname return type provider by @mcaskill in #8611
- Add stubs for ext-ffi by @LeSuisse in #8614
- add basename return type provider by @kkmuffme in #8620
- Add stubs for ext-random (PHP 8.2) by @lptn in #8649
- Add support for strict arrays, fix type alias intersection, fix array_is_list assertion on non-lists by @danog in #8395
- Add support for phpstan-param-out by @VincentLanglet in #8678
- add --no-progress to psalter by @kkmuffme in #8709
- Allow
new
on objects by @weirdan in #8723
Fixes
- Use InvalidScalarArgument only when we can be sure PHP attempts coercion by @muglug in #7188
- Trim baseline selection by @weirdan in #7279
- Prevent NoValue when there is no phpdoc by @orklah in #7399
- create a return type provider for mb_internal_encoding by @orklah in #7437
- Array key exists assert both ways by @orklah in #7449
- [TypeProvider] Provide argument types during FunctionParamsProviderEvent by @veewee in #7394
- Fix stub parent class not loaded. by @AndrolGenhald in #7110
- fix code where the offset was wrong by @orklah in #7463
- reconcile two arrays by intersecting them by @orklah in #7470
- fix error with 0 being considered positive by @orklah in #7487
- Fix crash due to unresolvable constant. by @AndrolGenhald in #7490
- Fix failing case for const analyzer. by @AndrolGenhald in #7503
- Fix side effect when loading config by @AndrolGenhald in #7506
- improve literal inequality with ranges and rework GreaterThan/LessThan assertions by @orklah in #7511
- Remove mic-drop hack from if analysis by @muglug in #7484
- fix some iterator stubs by @orklah in #6970
- Fix empty array by @orklah in #7517
- add back empty keyword by @orklah in #7533
- Fix crash when assigning reference to unknown array offset by @AndrolGenhald in #7583
- Fix #6683 by improving simplification of CNF by @muglug in #7631
- Enum collapsing by @orklah in #7655
- Enum assertions by @orklah in #7662
- Consistency for empty reconciliations by @orklah in #7663
- fix count with match on arrays by @orklah in #7665
- Prevent unnecessary filter_var() warnings on primitive types by @mmcev106 in #7677
- Improve bool to int casting. by @AndrolGenhald in #7696
- Fix issues with int range unpacking and with min/max by @AndrolGenhald in #7699
- Fix some minor issues with references. by @AndrolGenhald in #7684
- restore callable-string Id by @orklah in #7787
- fix refining lowercase string and non-empty-string together by @orklah in #7844
- Remove
@psalm-generator-return
annotation by @jrmajor in #7853 - Resolve #7855 remove false from return type, in php8.0 and further ve… by @dkemper in #7859
- Fix class const issue when using floats declared in future consts (fixes #7973). by @AndrolGenhald in #7992
- Improve handling of unsupported references (fixes #8018). by @AndrolGenhald in #8022
- Bring back disableVarParsing option by @danog in #8058
- Skip native classlike aliases by @danog in #8080
- Fix nasty parameter storage corruption bug by @danog in #8098
- Change return type of createFromInterface() on DateTime and DateTimeImmutable to static by @bitwise-operators in #8102
- Update DOM stub and add separate SimpleXML stub by @AndrolGenhald in #8140
- Track taints in static properties by @muglug in #8150
- Fix type reconciliation breaking Context::$references_in_scope (fixes #8289). by @AndrolGenhald in #8306
- Update
CachingIterator::getCache
stub. by @drupol in #8282 - Fix various array spread issues. by @AndrolGenhald in #8044
- Fix union assertions by @danog in #8324
- Add BitwiseNot and BooleanNot operators to SimpleTypeInferer by @bitwise-operators in #8360
- fix: Fix template resolution of complex extended types by @danog in #8418
- Fix mixed type hole when sending Foo to Foo by @muglug in #8481
- Fix type widening when
Any
assertion is used by @pvandommelen in #8494 - Fix callmap for DOMNode methods by @tvdijen in #8566
- Fix #8562 by @danog in #8571
- Fix #8569 by @danog in #8570
- Fix #6983 #8564 by @danog in #8578
- Fix template param for SplDoublyLinkedList by @ADmad in #8579
- Fix #8560 by @danog in #8586
- keep literal string for simple str_replace by @kkmuffme in #8619
- Mark hash_update functions as impure by @aboks in #8658
- Fix #8664 by @danog in #8665
- Fix #8669 by @danog in #8670
- Fix return type of ReflectionExtension::getVersion by @come-nc in #8655
- Making
json_encode()
always produce anon-empty-string
, when successful by @Ocramius in #8681 - Emit
DeprecatedInterface
when interface is referenced in a generic by @weirdan in #8687 - Prevent array{a: Foo} going cleanly into array by @muglug in #8691
- Allow enum cases to reference constants by @weirdan in #8694
- Mark inferred mutation-free constructor as such by @weirdan in #8692
- Make
stringable-object
equivalent toStringable
by @weirdan in #8688 - Flag invalid enum case value types by @weirdan in #8693
- Add extra types to Memcache::getExtendedStats and Memcached::getStats by @bram123 in #8700
- Make array shapes strict by default by @muglug in #8701
- Add support for type aliases in @psalm-assert(-*) annotations by @annervisser in #8705
- Fix DateTimeZone::listAbbreviations return type by @franmomu in #8717
- Reject
@psalm-consistent-constructor
in function docblocks by @weirdan in #8713 - Allow using imported types in other types within the same file by @annervisser in #8708
- Argument 1 of curl_unescape by @kamil-tekiela in #8730
- Allow parameter types to be contained by a class template type by @danog in #8731
- Fix dictionary for strip_tags by @lptn in #8729
- Fix #8735: IntlDateFormatter CallMaps. by @niconoe- in #8739
Docs
- Dropped
html-escaped-string
docs by @weirdan in #7281 - Document BC breaks in #7358 by @weirdan in #7360
- Added documentation for baseline files by @ricardoboss in #7429
- Fix documentation for config. by @AndrolGenhald in #7564
- Fix bullet indentation in documentation by @AndrolGenhald in #7565
- doc about property initialization by @orklah in #7593
- Fix issue documentation links. by @AndrolGenhald in #7687
- Improve documentation for InvalidGlobal to explain that it's sometimes valid by @AndrolGenhald in #7693
- Fix int-mask-of doc example by @Seldaek in #7812
- Documented the allowMissingFiles attribute for ignoreFiles by @mmcev106 in #7867
- Fix a typo in MissingConstructor.md by @MidnightDesign in #8023
- PossiblyNullArgument: Adding common problem cases and possible solutions by @ThomasLandauer in #8135
- Adding note about referencedMethod by @ThomasLandauer in #8408
- Docs: Fix minor php syntax issues in code examples by @pchapl in #8601
- Update PossiblyFalseReference.md by @webmaster777 in #8622
- Last-minute docufix by @danog in #8685
- Fixing code formatting by @ThomasLandauer in #8696
- Fix formatting by @danog in #8689
- Removing list by @ThomasLandauer in #8698
Internal changes
- Disable PSL (not yet compatible with Psalm 5) by @weirdan in #7269
- Require
@internal
annotation onPsalm\Internal
symbols by @weirdan in #7268 - Dropped deprecated
TypeAnalyzer
methods by @weirdan in #7277 - Moved
getPsalmHelpText()
toCli\Psalm
by @weirdan in #7280 - Replaced deprecated
webmozart/path-util
by @weirdan in #7292 - Indent heredoc by @weirdan in #7294
- Dropped dead code based on PHP_VERSION_ID by @weirdan in #7300
- Apply literal number separator rector by @weirdan in #7299
- Applied NullCoalescingOperatorRector by @weirdan in #7302
- Applied JsonThrowOnErrorRector by @weirdan in #7303
- Applied ListToArrayDestructRector by @weirdan in #7310
- replace
array<never, never>
as a way to detect empty arrays by a dedicated method by @orklah in #7313 - Applied ClosureToArrowFunctionRector by @weirdan in #7315
- Simplify object comparison by @muglug in #7340
- Rename was_static property to is_static to be more accurate by @muglug in #7358
- Add explicit
resolveSymlinks
option for project directories by @dvz in #7163 - Ensure that all entries in test arrays have explicit keys by @muglug in #7386
- TCallableString is non-falsy (0 can't be a functionlike name) by @orklah in #6521
- fix tests by @orklah in #7446
- Use objects, not strings, for assertions by @muglug in #7410
- Nitpicks by @orklah in #7448
- refactor description of types in Atomic by @orklah in #7409
- remove TPositiveInt usage for TIntRange by @orklah in #7472
- Fix ExceptionCodeTest provider shape by @weirdan in #7538
- Fix extension capitalization issue, add extensions to version message. by @AndrolGenhald in #7574
- Added backward compatibility check by @weirdan in #7576
- Allow mocking final classes by @weirdan in #7591
- Fixed composer branch-alias by @sasezaki in #7594
- No longer require declare reflection-docblock:^5 as dependency by @sasezaki in #7612
- Bump up phpunit,prophecy, and introduced phpspec/prophecy-phpunit by @sasezaki in #7617
- consistency in AssertionFinder by @orklah in #7622
- skip a test because we removed the feature for now by @orklah in #7642
- Adjust for composer-require-checker check. by @sasezaki in #7632
- Removed .scrutinizer.yml by @sasezaki in #7652
- Use
array_fill_keys()
by @weirdan in #7661 - Fixed PSR-4 warnings by @weirdan in #7683
- chore: enable psl tests again by @azjezz in #7596
- Make callbacks marked as static by @SCIF in #6695
- Update master by @weirdan in #8024
- Run method call prohibition analyzer when cloning by @danog in #8155
- Avoid re-parsing template types by @danog in #8181
- Fix namespace of test by @danog in #8191
- update property map by @discordier in #8000
- Merge 4.x to master. by @AndrolGenhald in #8222
- Remove special handling for elseifs that breaks for else if by @muglug in #8273
- Applied ArraySpreadInsteadOfArrayMergeRector (take 2) by @weirdan in #8345
- Merge 4.x by @danog in #8591
- Immutable readonly atomics by @danog in #8525
- Immutable unions by @danog in #8627
- Merge 4.x and documentation fixes by @danog in #8684
- Fix PSL e2e tests by @danog in #8697
- Cleanup documentation by @danog in #8702
- safe delete cache directory files by @kkmuffme in #8710
- improve cache flush debug info and code if cache disabled by @kkmuffme in #8707
- Fix cache race condition due to missing repopulation of lock files cache by @kkmuffme in #8714
- include CLI args in PHP errors to more quickly identify run issues in CI by @kkmuffme in #8724
- Enforce arrow function formatting by @weirdan in #8737
- Simplify issue sorting by @weirdan in #8736
- Correct
Clause::$hash
type by @weirdan in #8742
Typos
- fix mapped property type for DOMNode childNodes by @cristianobaptista in #8577
- Fix typo by @zenahirsch in #8605
- Cleanup outdated comment by @andrew-demb in #8699
Other changes
- Address flaw in type reconciliation on array references by @ohader in #8290
- Fix if propagation by @danog in #8326
- Begin immutable refactoring by @danog in #8143
- Fix properties-of on generic objects&intersections + immutable atomic refactoring by @danog in #8442
- Immutable assertions by @danog in #8443
New Contributors
- @petewalker made their first contribution in #7454
- @mal-tee made their first contribution in #7504
- @Seldaek made their first contribution in #7812
- @dkemper made their first contribution in #7859
- @discordier made their first contribution in #8000
- @pvandommelen made their first contribution in #8494
- @cristianobaptista made their first contribution in #8577
- @pchapl made their first contribution in #8601
- @zenahirsch made their first contribution in #8605
- @mcaskill made their first contribution in #8611
- @webmaster777 made their first contribution in #8622
- @come-nc made their first contribution in #8655
- @bram123 made their first contribution in #8700
- @annervisser made their first contribution in #8705
Full Changelog: 4.30.0...5.0.0-rc1