PHPStan 2.3.0 performance, bleeding-edge generics and unused-variable checks
PHPStan 2.3.0 was published on GitHub on 6 October 2026 at 06:33 UTC, the first minor release
after the 2.2.x series, which 2.2.17
closed. The release notes say it fixes 75 issues. The tagged composer.json still requires PHP
^7.4|^8.0, so the minimum PHP version for running PHPStan is unchanged.
Performance
The release blog post measures the
analysis of WordPress core on the author's M1 Pro laptop. It took 60.51 s with 2.1.33
(December 2025) and takes 19.47 s with 2.3.0 without PHPStan Turbo, or 7.93 s with it. PHPStan
Turbo is an optional C++ extension that first shipped in 2.2.6. Its binaries are bundled in the
phpstan/phpstan package, and PHPStan restarts itself with the extension enabled when a
matching binary exists. The blog says most users therefore get it automatically. In 2.3.0
Turbo shadows most of the analyser engine.
The result cache is now thrown away entirely only when PHPStan or the project's PHPStan
configuration changes. It used to be invalidated by any Composer dependency update or any change
to the Symfony DI container. Dependencies between analysed files and installed packages are now
tracked, and new extension APIs let extensions declare their own invalidation. The notes deprecate
ResultCacheMetaExtension.
Bleeding edge only
These features take effect only with vendor/phpstan/phpstan/conf/bleedingEdge.neon included.
The release notes say that file has no backward-compatibility guarantees.
- Bidirectional type narrowing for generics. PHPStan analyses how a
new Foo(...)object is used afterwards and uses that to infer its@templatetype. It no longer generalizes scalars, sonew Collection([1, 2, 3])can inferCollection<int<1, max>>rather thanCollection<int>. The blog estimates a 1–3% performance cost. - Unused-variable detection, with new identifiers including
variable.unused,assign.unused,assign.overwritten,assign.redundantandassign.unusedFlow, and array-offset variants such asarray.unusedOffset. - Closure signatures inferred from where the closure is passed, by-reference
useeffects applied where a closure is invoked, andstaticvariable types inferred from the function body.
Other changes
A non-bleeding-edge @pure-unless-parameter-passed PHPDoc tag was added. Scope::getPhpVersion()
now honours the require.php constraint in composer.json, and PHP-version-dependent checks use
it. Mutually exclusive flag groups are now declared for json_encode, json_decode,
filter_var, filter_input, openlog and ZipArchive::open. Rector
2.7.0, released the same day, requires
phpstan/phpstan ^2.3.0.
2.3.1 follow-up: smaller package
PHPStan 2.3.1 was published on 8 October
2026 at 21:10 UTC. Its notes say 2.3.0 was 104 MB to download and 268 MB unzipped in vendor/.
2.3.1 is just under 28 MB to download and 87 MB unzipped, because the Turbo extension now ships
as one shared core plus a thin extension per PHP version (#6703). Linux ZTS Turbo binaries are
now built for PHP 8.3–8.5, and phpstan/turbo (the PIE package) allows PHP 8.6. The other changes
are bug fixes (for example constructor throw points and result-cache handling of functions) and
three performance fixes, two of them for the result cache.
2.3.2 follow-up: PHP 8.6 support and Turbo notice
PHPStan 2.3.2 was published on 24 October
2026 at 11:37 UTC. PHP 8.6 items in its notes: ARRAY_FILTER_USE_VALUE accepted as the
array_filter() mode with a narrowed result (#6681), a dynamic return type extension for clamp()
(#6684), CURLINFO_SIZE_DELIVERED and the size_delivered key in curl_getinfo() return types
(#6683), and reading PHP 8.6 thread-safe EG()/CG() through exported offsets (#6785). Other
improvements: unused function parameters prefixed with _ are ignored (#6743), phpstan.phar tells
the user when it runs without the Turbo extension (#6719), @api is respected on class constants
and traits in the API rules, and BetterReflection moves from 6.73.0 to 6.75.0. Performance changes
include restarting the process when pcov or tideways is loaded (#6757), an own multi-extension
restart manager and lower memory and time for large array literals (#6778). In bleeding edge only,
BackedEnum::from()/tryFrom() parameter types take the backing type into account (#6790). The
remaining entries are type-inference and signature bug fixes.
2.3.3 follow-up: new regex parser
PHPStan 2.3.3 was published on 27 October 2026 at about
14:11 UTC. It replaces the Hoa-based parser used to infer preg_match()/preg_match_all() result shapes with a regex
parser generated by phplrt (#6851). The same change fixes several inferred shapes: regex assertions are zero-width,
groups in negative assertions are never set, conditional subpatterns and quantified atoms that can match an empty
string are handled, MARK with PREG_PATTERN_ORDER is an array keyed by match index, and no shape is inferred for
patterns with subroutine calls or for some duplicate group name and branch reset cases. The release notes also list
PHP 8.2 support in the Turbo extension (#6825), a phpdoc-parser update with printer fixes, literal types for word
date-format characters (#6838), and bug fixes including a bootstrap autoloader's exception no longer aborting the
analysis (#6294) and generic static types resolved inside the class, in properties and in class constants (#6826).
Evidence and limitations
- The timings are the maintainer's own benchmark on one machine and two codebases (WordPress cold, Drupal with a warm result cache). They are not independent measurements.
- The blog's benchmark table dates 2.3.0 to 1 October 2026; the GitHub release is dated 6 October. The earlier date may be when it was benchmarked, but the blog does not say.
- The inspector truncated the blog post at 18,000 characters, so its later sections were not read. Whether the unused-variable rules depend on a rule level was not checked.
- The 2.3.1 sizes are the maintainer's figures and were not measured here. The 2.3.2 and 2.3.3 sections list release-note entries only; PHP 8.6 itself is still a release candidate.
- This page paraphrases the release notes and does not test the behavior.
Related: package signals, PHPUnit 13.4.0.