| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| phpstan.phar | 2026-11-15 | 31.1 MB | |
| phpstan.phar.asc | 2026-11-15 | 833 Bytes | |
| 2.3.6 source code.tar.gz | 2026-11-15 | 31.2 MB | |
| 2.3.6 source code.zip | 2026-11-15 | 31.2 MB | |
| README.md | 2026-11-15 | 19.3 kB | |
| Totals: 5 Items | 93.5 MB | 0 | |
Highlights of this release π
- Full support for PHP 8.6, including Partial Function Application - RFC
- Float range types like
float<0, 1.5>,finite-float, orpositive-float- See docs - When analysing a project subset, like a single directory or a list of files, report is no longer flooded with unrelated
ignore.unmatched(phpstan.org) errors - Result cache previously used to reanalyse all files with errors (including the baselined errors) every time a new class or function appeared, in hope that some of the errors related to a before unknown symbol might disappear. Not anymore: the engine now precisely tracks which rules and other extensions asked about an unknown symbol, so the result cache knows what files need to be reanalysed when the said symbol appears. In practice, there's a lot less files being reanalysed between runs ->Β faster runs with the result cache.
- PHPStan is now continuously benchmarked with Tally - stable numbers in CI, regardless of how fast the runner is!
- If you're a Twig user, check out TwigStan - PHPStan for your templates!
Bleeding edge πͺ
- Check PHP language features support with the entire declared version range (#6991)
- Example: If you declare
^8.5in your composer.json or viaphpVersionin phpstan.neon, PHPStan will start telling you about PHP 8.6 deprecations right away - If you declare
^8.5, it will tell you you can't use#[Override]above class constants, because that requires PHP 8.6 - Report
str_replace()/str_ireplace()/preg_replace()/preg_filter()calls with fewer replacements than search values (#7007), [#3889], thanks @staabm and @SanderMuller!
If you want to see the shape of things to come and adopt bleeding edge features early, you can include this config file in your project's phpstan.neon:
includes:
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
Of course, there are no backwards compatibility guarantees when you include this file. The behaviour and reported errors can change in minor versions with this file included. Learn more
Improvements π§
- [PHP 8.6] Partial Function Application support (#7029, #7033), [#15364]
- [PHP 8.6] Allow
__debugInfo()in enums (#6682), [#15368], thanks @Amoifr! - [PHP 8.6] Support
#[\Override]on class constants and enum cases (#7077), [#15370] - Includes new
checkMissingOverrideConstantAttributeconfig parameter - [PHP 8.6] Reject objects for array parameters where deprecated (#7076), [#15369]
- [PHP 8.6] Report deprecated return in finally block (#7079)
- [PHP 8.6] Allow default values of
readonlyproperties (#7082), [#15363] - Narrow
intdiv()return type from integer ranges (#6925), [#15282], [#15347] - Add FloatRangeType for
float<min, max>(#6937), [#6963], [#13859] - Improve
min()/max()type precision for floats (#7050), thanks @zonuexe! - Keep a narrowed float bound when creating a template type (#7070), [#15714], thanks @zonuexe!
- Look up object class names in nullable and mixed unions and class-strings in restricted-usage rules (#7006), [#15681], thanks @VincentLanglet and @staabm!
- Keep the symbols of a file with a parse error in the result cache (#7027)
- Report unmatched ignoreErrors entries with a directory or pattern path only under the analysed paths (#7044)
- Do not report unmatched ignores when a rule on collected data skipped its errors in an analysis of only files (#7045), [#12328]
- Report unmatched ignoreErrors entries in a partial analysis only for files analysed together with their traits (#7046)
- Report unmatched ignoreErrors entries of the analysed files when analysing only files (#7047, #7052), [#14480], [#15704]
- Improve range() return type for invalid steps and long ranges (#6492), [#10022], thanks @zonuexe!
- Attest build provenance of the PHAR and the turbo extension binaries (#6893)
- Learn more
- Read
#[\Deprecated]of built-in functions and methods from php-8-stubs (#7054) - Result cache: Track every class, function and constant lookup instead of re-analysing the files with errors (#7032), [#15211], [#15453]
- Check property hooks, asymmetric visibility and all prototypes in overriding rules - [#7080] (#7080)
- Report readonly property overriding non-abstract get-only virtual property (#7081)
Bugfixes π
- Fixed many many PHPStan Pro bugs
- Pass xdebug, pcov and uopz startup switches on to workers and restarts (#6931)
- Move operator type inference to Type methods (#6930), [#11732]
- Pick the ternary's final scope from the native condition type when
treatPhpDocTypesAsCertainis off (#6822), [#15403], thanks @VincentLanglet and @staabm! - Strip the final-by-keyword override from the declaring class before comparing a method's return type with
$this(#6941), [#15320], thanks @VincentLanglet and @staabm! - Read remembered equivalent and complementary comparison forms when resolving
===,!==,==,!=,<,<=,>,>=(#6948), [#10583], [#5610], thanks @VincentLanglet and @staabm! - Resolve
staticin parameter and writable property types to the called-on type without thenew Foo()exactness (#6946), [#15235], thanks @VincentLanglet and @staabm! - Narrow loose comparisons by the values each side can loosely equal (#6938), [#8224]
- Pass only the right-hand side of
??=as the written expression toPropertyAssignNodeandVariableAssignNode(#6943), [#15228], thanks @VincentLanglet and @staabm! - Treat
match (true)as exhaustive when the arms' falsey narrowing leaves an expression typednever(#6956), [#11374], thanks @VincentLanglet and @staabm! - Know that numeric-string and decimal-int-string are non-empty-string (#6959)
- Keep a union benevolent when its members absorbed benevolent members (#6960), [#15667]
- Generalize mixed int and float constants to int|float instead of an error (#6962), [#15670]
- Narrow remembered
count()/sizeof()of an array when the array expression is narrowed (#6953), [#13750], thanks @VincentLanglet and @staabm! - Skip only built-in overridden methods with a tentative return type before PHP 8.1 (#6975)
- Ask
Scope::getPhpVersion()instead of the injected PhpVersion in rules and expression handlers (#6984), [#15673] - Turn a NAN float type into the 'NAN' string type without casting it (#6992)
- Type a float cast to string as a numeric string or 'INF', '-INF', 'NAN' (#6993)
- Do not attach the positional-arguments fix to the callback call synthesized from
call_user_func()/call_user_func_array()(#6966), [#15664], thanks @clxmstaab! - Add null to array_map() callback parameters of shorter arrays (#6874), [#13217], thanks @SanderMuller!
- Bind intrinsic callback-argument overrides to parameters by name, not by written argument position (#6954), [#15195], thanks @VincentLanglet, @staabm and @SanderMuller!
- Use rtrim() semantics for chop() on constant strings (#7012), [#15684], thanks @SanderMuller!
- Report dead catch in a trait only when it is dead in every using class (#7016), [#10315]
- Expand character ranges when trimming a numeric-string (#7013), [#15683], thanks @SanderMuller!
- Test a built-in enum from the reflection cache of a moved installation (#7021), [#15607]
- Fix inline ignores in traits: matching, reporting and
--fix(#7026), [#14993], [#15177], [#11013] - Re-analyse files with inline-ignored errors and after deleting a file declaring symbols (#7031)
- Fix rules missing named arguments (#7028, #7040), thanks @staabm!
- Accept unions of constant integers and integer ranges in
RandomIntParametersRule(#7037), [#15698], thanks @staabm! - Fix ImpossibleInArrayHaystackFiniteTypesRule local function confusion (#7041), thanks @staabm!
- Close result cache invalidation gaps in exported nodes and dependencies (#7055)
- Do not narrow a comparison operand whose counterpart can be NAN (#7058), [#15713], thanks @zonuexe!
- Read untracked fetch links of an isset chain from the asking scope's state (#7065), [#15722]
- Walk a while loop's exit condition instead of narrowing the body's scope by it (#7063), [#15722], [#15726]
- Narrow a mixed subject of a loose comparison to mixed~null (#7061), [#15725]
- Keep a variable whose native type allows null defined in
!isset()with uncertain PHPDoc types (#7060), [#15728] - Walk each isset() subject narrowed by the subjects before it (#7062), [#15729]
- Keep a merged call without a narrowable argument in the scope (#7064), [#15727]
- Keep only the current conditionals a replayed statement's recorded walk kept (#7075), [#15736]
- Load an ext-ds v2 stub overlay with
listreturn types when ext-ds 2 is selected (#6939), [#15645], thanks @VincentLanglet!
Performance ποΈ
- Stream collected data to the rules on CollectedDataNode (#6963), thanks @janedbal!
- Speed up the falsey
isset()fold over many optional offsets - [#6971] (#6971) - Avoid quadratic work when combining many same-shaped constant arrays (#6970)
- Resolve names added by fixes only when a fix adds names (#6967)
- Share resolved class constant type between native and PHPDoc variants when the constant has no PHPDoc type (#6968)
- Describe each array shape once while sorting a union (#6973)
- Memoize the loosely equal types of a union per PHP version (#6973)
- Look up already normalized union members by object identity (#6969)
- Remove a union from a value it does not hold with one lookup (#6969)
- Answer overwrite markers against the live set instead of per write (#6969)
- Fix unmatched baseline entries in time linear in the baseline size (#6977)
- Remember annotation method and property lookups that find nothing (#6978)
- Subtract constant-array members whole when deriving a conditional guard (#6981)
- Keep statement snapshots' lists in the walk state (#6982)
- Resolve loose comparison of two strings or two integers as identical (#6985)
- Decide sealed array shapes with disjoint required keys before comparing values (#6986)
- Do the per-key work of array shapes once per shared value type (#6987)
- Answer the questions every invocation asks about an inferred closure signature once (#6989)
- Skip the get_included_files() scan in the autoload trap while OPcache compiled nothing (#6979)
- Memoize CallableType::describe() per verbosity level (#6980)
- Fetch the exported nodes of non-analysed files only when the result cache is saved (#6988)
- Share the observed keys of whole-variable writes and walk the smaller set (#6990)
- Keep normalized paths that did not change once in the cache (#6983)
- Apply thousands of fixes in time linear in their number (#7001)
- Use faster
strspn()over regex matching (#7005), thanks @staabm! - Memoize Scope::getPhpVersion() per scope (#7014)
- Speed up types shared by nested arrays and loops (#7030)
- Fix exponential analysis slowdowns on deeply nested code (#7078)
Function signature fixes π€
- Widen
Redis::set()$options,Redis::sInter()/RedisCluster::sInter()$keyandRedis::zCount()bounds in functionMap to match phpredis signatures (#6940), [#15393], thanks @VincentLanglet and @staabm!
Internals π
- Use Tally for benchmarking (#7059, #7066), learn more about Tally
- Mark PhpDocEditor as non-experimental (https://github.com/phpstan/phpstan-src/commit/e9c40a296564fbfad00aa55e053ba5fb75c2a672)
- Simplify Assertions (#6950), thanks @staabm!
- Improve readability of ArgumentsHandler, FuncCallHandler (#6951), thanks @staabm!
- Describe the numbers a type holds with
Type::toNumberSet()(#6955) - Derive the values loosely equal to a scalar from its truthiness, number and strings (#6957), [#15388]
- Expose ClassMethod and Function_ on the return-statements nodes (#6958), thanks @janedbal!
- Run the E2E test scenarios as bashunit tests, sharded across runners (#6998)
- Extract magic 'isAttribute' string into constant (#7003), thanks @staabm!
- Allow restricted usage extensions to return a tip (#7010)
- Rewrite
@apirules as restricted usage extensions (#7010, #7023, #7024) - Call restricted class constant usage extensions for Foo::class (#7024)
- Test when the fixer writes new class names (#6934), thanks @SanderMuller!
- Assert the files the parse error tests re-analyse with
result-cache-info(#7027) - Simplify reflection handling in some rules (#7039), thanks @staabm!
- NullsafeOperatorRule: use ?-> instead of null checks around a call or property fetch (#7043)
- Prevent repetative
getArgs()calls in *Extension classes (#7051), thanks @staabm! - Add regression test for PHP 8.6 poll API and Duration stubs (https://github.com/phpstan/phpstan-src/commit/b847547fbfdae309b171d01f28ab1fc24522e418)