Improvements 🔧
- Initial PHP 8 support!
- PHPStan can now analyse sources for PHP 7.x when running on PHP 8. Not all the new PHP 8 features are supported yet.
- Support for native union types (phpstan/phpstan-src@39f8909)
- Support for native
mixed
type (phpstan/phpstan-src@a9043e0)
- Set different PHP version than your runtime
- If you set different
phpVersion
parameter in yourphpstan.neon
, you can for example tell PHPStan to analyse source code like it's written for PHP 7.4 even if you're running PHP 8. ThephpVersion
config parameter is inPHP_VERSION_ID
format - for PHP 7.4, use70400
. - You can also set a newer PHP version. So you can run PHPStan on 7.4, but already test compatibility with PHP 8 by setting
phpVersion
to80000
.
- If you set different
- Check uninitialized typed properties that aren't set in the constructor (phpstan/phpstan-src@a1eb1f5), #2984
- Off by default, needs
checkUninitializedProperties: true
.
- Off by default, needs
- Show error on unescaped
()
in ignoreErrors (phpstan/phpstan-src@8479d40), #3602
Bleeding edge 🔪
- Detect unused and write-only/read-only private properties, methods, and constants (level 4)
config.platform.php
in project'scomposer.json
is respected and overrides the current runtime PHP version (phpstan/phpstan-src@d235195).
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.
Bugfixes 🐛
- Skip not deprecated methods (#267), thanks @malarzm!
- Type aliases cannot be used internally because they might clash with an existing class name (phpstan/phpstan-src@4d08280), #3569
- Fix covariant type check when template has bound (#272), thanks @hrach!
Function signature fixes 🤖
- Updated phpstorm-stubs (phpstan/phpstan-src@e1f492c), #3539, #3512, #3525
- Updated GD's
image*
functions (#265), thanks @javajawa! - PDOStatement::fetchColumn can return an int (#266), thanks @anthonyryan1!
- XMLReader::expand may return false on error (#273), thanks @taavit!
- SQLite3Stmt::execute to return false (#275), thanks @colinmo!
- mime_content_type can receive a stream too (#276), thanks @gnutix!
- Fix date_time_set function signature (#280), thanks @olivierchabert!