0.12.9
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 in phpstan.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!