PHPStan v0.12.9 Release Notes
Release Date: 2020-02-04 // over 4 years ago-
๐ฑ Major new features ๐
๐ Support for custom type aliases (phpstan/phpstan-src@3151160)
๐ง Type aliases (also known as
typedef
) are a popular feature in other languages like TypeScript or C++. Using the following configuration inphpstan.neon
will allow you to reference these types in your PHPDocs:parameters: typeAliases: Name: 'string'NameResolver: 'callable(): string'NameOrResolver: 'Name|NameResolver' /\*\* \* @param NameOrResolver $arg \*/function foo($arg){// $arg is string|(callable(): string)}
The development of this feature was sponsored by @tslettebo.
๐ Several performance optimizations - you should see performance improvements between 10โ20%:
- Memoizing dependency injection container (phpstan/phpstan-src@3eb84e2), #2915
- โ add memoize cache on ClassReflection::isGeneric() (#115), thanks @bastnic!
- ๐จ Cache calls to prettyPrintExpr in MutatingScope (#122), thanks @bastnic!
๐ Improvements ๐ง
- Possibly-wrong "cannot access offset" should be reported on level 7, not level 3 (phpstan/phpstan-src@c36df00)
- Ignored error regex with unescaped '||' is an unavoidable error (phpstan/phpstan-src@3b71993)
๐ Bugfixes ๐
- ๐ Threaded (pthreads) objects have array syntax support without ArrayAccess (#116), thanks @dktapps!
- ๐ Fix issue with PHAR when the analysed projects also includes jetbrains/phpstorm-stubs (phpstan/phpstan-src@49314cb), #2938
- Invalidate
json_last_error{,_msg}()
type onjson_{en,de}code()
call (#118), thanks @cs278! - FileCacheStorage - atomic save() (phpstan/phpstan-src@65118a2, phpstan/phpstan-src@a672c89)
๐ฑ Function signature fixes ๐ค
- zlib_decode() may return FALSE on corrupted data (#113), thanks @dktapps!
- ๐ Fix ext-ds object diffing and merging (#95), thanks @simPod!
- ext-ds stubs improvements (#126), thanks @enumag!
- Correct Phar::decompress() return data type (#114), thanks @peter-gribanov!
- โ added generic stub for SplFixedArray (#117), thanks @dktapps!