Changelog History
Page 5
-
v0.12.19 Changes
April 19, 2020๐ฑ Major new features ๐
- PHPStan has a new website with documentation, refreshed playground, and blog! Read more about it here
- Ignoring errors in code using comments : use
@phpstan-ignore-line
or@phpstan-ignore-next-line
to ignore errors locally. Examples in the documentation, original issue #786
๐ Improvements ๐ง
- Code around
class_exists()
does not complain about nonexistent classes (phpstan/phpstan-src@1605bb2), #3169, #2529, #265, #188, #146, #2359, #308 - Result cache - run full analysis after 7 days since the last full analysis (before it was 24 hours) (phpstan/phpstan-src@1b72fa1)
- ResultCacheManager - exclude XDebug from the list of loaded extensions (phpstan/phpstan-src@8ce9207) - to be able to debug result cache behaviour even if it was first saved without XDebug enabled
- ๐ Support single-quoted and double-quoted keys in array shapes (phpstan/phpstan-src@e210a6e)
- ConstantStringType - do not truncate existing class names (phpstan/phpstan-src@c5c49c1), #3145
- PHAR file is around 2 MB smaller and contains 500 less files (phpstan/phpstan-src@f31ee7c)
phpstan/phpstan
intentionally conflicts withphpstan-shim
- you should installphpstan/phpstan
only (#3139), thanks @szepeviktor!- ๐ Documentation URL showed with autoloading errors (phpstan/phpstan-src@836d227)
- โก๏ธ Update to nikic/php-parser 4.4.0 (phpstan/phpstan-src@2514514)
- ๐จ Print stacktrace when including bootstrap-files throws (#51), thanks @staabm!
- โ Added
is_countable()
to TypeSpecifyingFunctionsDynamicReturnTypeExtension (phpstan/phpstan-src@8a894c5)
๐ Bugfixes ๐
- Solve
timecop
extension issues by enabling static reflection forDateTime
classes (phpstan/phpstan-src@d59629b), #2801 - ๐ Fixed false-negative with
checkExplicitMixedMissingReturn: true
(phpstan/phpstan-src@08b4eab) - ๐ Fix issue in method return type override annotation on same class or from trait (#173), #3155, thanks @Korbeil!
- ๐ Fix overriding trait properties in PHPDocs (phpstan/phpstan-src@55a3444), #1216
- ๐ Checkstyle error formatter - always use file path, not file description (phpstan/phpstan-src@94dc8d2), #1872
- ๐ Fix SOAP extension issues (#182), #618
- Result cache gets invalidated with different
-a|--autoload-file
CLI option passed (phpstan/phpstan-src@37c29d5)
๐ฑ Function signature fixes ๐ค
strip_tags
2nd parameter accepts array on PHP 7.4 (phpstan/phpstan-src@7d3123d), #3125- More precise
Phar::getSignature()
signature (phpstan/phpstan-src@4b23061) - ๐ Fixed
DateInterval::$days
type (phpstan/phpstan-src@4e64f0d), #3127 - ๐ Fix return type of
IntlDateFormatter::parse()
(#172), thanks @ADmad! date_create_from_format()
: accepts null (#174), thanks @homersimpsons!- โก๏ธ Update ext-ds.stub (#180), thanks @enumag!
- ๐ Fix inferred union types for Ds
Map::get()
andMap::remove()
(#176), thanks @simPod! readlink()
may return false on error (#178), thanks @dktapps!hash_file()
returns false and emits E_WARNING on nonexisting file (#179), thanks @dktapps!
-
v0.12.18 Changes
March 22, 2020๐ Improvements ๐ง
Dedicated CLI option
--generate-baseline
with improved DX (phpstan/phpstan-src@f4a9d5f), #3082, #2703, #2776, #2695, #2534๐ Use it from now on instead of
--error-format baselineNeon
. Here are the advantages:- The current baseline file does not have to be commented-out nor emptied when generating the new baseline. It's excluded automatically.
0๏ธโฃ 2. Output no longer has to be redirected to a file, PHPStan saves the baseline to a specified path (defaults to
phpstan-baseline.neon
). - Baseline contains correct relative paths if saved to a subdirectory.
๐ Bugfixes ๐
- ๐ Fix reporting unmatched ignored error from path that wasn't analysed (phpstan/phpstan-src@c9df2f4), #3099
๐ฑ Function signature fixes ๐ค
- ๐ Fix
bcdiv
return (#167), thanks @BackEndTea! - ๐ Fix other
bc*
function types (#168), thanks @BackEndTea!
- The current baseline file does not have to be commented-out nor emptied when generating the new baseline. It's excluded automatically.
0๏ธโฃ 2. Output no longer has to be redirected to a file, PHPStan saves the baseline to a specified path (defaults to
-
v0.12.17 Changes
March 17, 2020- ๐ Fixed issue with arrow function type inference and TooWideArrowFunctionReturnTypehintRule (phpstan/phpstan-src@5581928)
- ๐ Fixed issue with ArrayAccess stub (phpstan/phpstan-src@ab85120)
-
v0.12.16 Changes
March 17, 2020๐ Improvements ๐ง
- Arrow function return type inference (phpstan/phpstan-src@19482b7), #3091
- Result cache - use lazy callback for errors array in case older PHPStan gets handed newer result cache (phpstan/phpstan-src@5a032f6)
๐ Bugfixes ๐
- ๐ Fix
is_numeric
issues (phpstan/phpstan-src@337fbee), #3094, #3092, #3090 - ๐ Fix
property_exists
issues (phpstan/phpstan-src@a44bad9), #2221 - ๐ Fixed
iterable<T>
vs. empty constant array (phpstan/phpstan-src@3b64b12), #3010, #3072
-
v0.12.15 Changes
March 16, 2020๐ Improvements ๐ง
- Result cache improvements:
- Use file hashes instead of modified times (phpstan/phpstan-src@be3e4fc). It's now possible to use result cache in all CI environments!
- Result cache contains all errors, filtering through
ignoreErrors
each time (phpstan/phpstan-src@9e10b4c), #3058. This means that the "report unmatched ignore errors" behavior is now deterministic, it doesn't matter if the cache is used or not. - Do not save the cache with non-ignorable errors (phpstan/phpstan-src@762277e), #3056
- Unmatched ignored error for a specific file reported in that file (phpstan/phpstan-src@3b0c6a2)
- โก๏ธ Update BetterReflection to v4.0 (phpstan/phpstan-src@d56c832)
- ๐ Windows - use logical CPU cores count (phpstan/phpstan-src@2f649fa)
- Detect calling static method and accessing static property on a trait (phpstan/phpstan-src@67fc8f3, phpstan/phpstan-src@e089754, phpstan/phpstan-src@88d2607)
๐ Bugfixes ๐
- ๐ป AutoloadSourceLocator - do not throw exception on nonexistent file (phpstan/phpstan-src@d0a9aa1), #3066
- ๐ Fixed
assert(is_numeric($x))
false positive (phpstan/phpstan-src@53a5171) phpstan/phpstan-beberlei-assert#11
๐ฑ Function signature fixes ๐ค
- โ Add missing parameter to
cropThumbnailImage
(#153), thanks @Riimu! - โ Add missing parameter to
thumbnailImage
(#154), #3055, #3057, #3054, thanks @Riimu! - Fix
gmp_random_seed()
signature (#156), thanks @simPod! - ๐ Fix
imageconvolution()
signature (#157), thanks @simPod! - ๐ Fix
iptcembed()
signature (#158), thanks @simPod! - Fix
libxml_get_errors()
andlibxml_get_last_error()
signatures (#155), thanks @simPod! RedisCluster::__construct
expects #1 parameter to be string or null (#162), thanks @dada-amater!
- Result cache improvements:
-
v0.12.14 Changes
March 02, 2020๐ Bugfixes ๐
๐ Result cache fixes:
- ๐ Fixed issue with files being analysed multiple times when result cache is used (phpstan/phpstan-src@349bd9e), #3041, #3042
- ResultCacheManager - skip deleted files in "files to analyse" list (phpstan/phpstan-src@1100202)
- Result cache - fix handling deleted files (phpstan/phpstan-src@ffb7796, phpstan/phpstan-src@b13181e), #3043
๐ Improvements ๐ง
- Error "Ignored error pattern is expected to occur N times but occured M times" can no longer be ignored (phpstan/phpstan-src@304d472)
- Report error "Ignored error pattern is expected to occur N times but occured only M times" even if only subset of project is analysed (phpstan/phpstan-src@4f53a82)
- Report error "Ignored error pattern is expected to occur N times but occured only M times" as file-specific (phpstan/phpstan-src@eec492e)
๐ฑ Function signature fixes ๐ค
-
v0.12.13 Changes
March 02, 2020๐ Fixed problem with result cache that caused it to not be invalidated when the main project configuration file is changed. (phpstan/phpstan-src@5b764c7), #3036
-
v0.12.12 Changes
March 01, 2020๐ฑ Major new features ๐
๐ Read more about this release at Medium.com!
Parallel analysis
๐ PHPStan runs in multiple threads! This leads to huge performance gain roughly equivalent to the number of your CPU cores! This works on all operating systems and does not require any special PHP extension. This is enabled by default.
Result cache
๐ PHPStan now analyses changed files only (since the last analysis) and the files depending on the changed files! This is enabled by default. Read more about it here.
๐ฑ Bleeding edge๐ช
- Rule for checking null-coalescing
??
operator issues - levels 1 and 4 (#36), thanks @leongersen! - Rule for checking additional issues like always-defined/never-defined properties, array offsets etc. in
isset()
- level 4 (phpstan/phpstan-src@25b61d9)
๐ 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.
๐ Improvements ๐ง
- Check for invalid
@phpstan-
PHPDocs (#146), thanks @BackEndTea! - Overridable static reflection class name patterns (phpstan/phpstan-src@f4e7ce8)
- ๐ Parameters schema - structured featureToggles to disallow unsupported keys (phpstan/phpstan-src@4f51382)
- PHAR - rename file extensions of PhpStorm stubs (phpstan/phpstan-src@e18b3b4)
๐ Bugfixes ๐
- StubValidator - set analysed files to correctly analysed stubbed traits (phpstan/phpstan-src@7cd1d70)
- DerivativeContainerFactory - fix missing parameters (phpstan/phpstan-src@b5ed37b)
๐ฑ Function signature fixes ๐ค
- ๐ Fix signature for
ReflectionProperty::isInitialized
(#144), thanks @leongersen! - โ Add
Vector::merge()
(ext-ds) (#145), thanks @enumag! stream_socket_enable_crypto
returns int|bool (#148), thanks @frederikbosch!
- Rule for checking null-coalescing
-
v0.12.11 Changes
February 16, 2020๐ Improvements ๐ง
- Parallel analysis improvements:
- Configurable process timeout (phpstan/phpstan-src@ebe779c), #2985
- Configurable maximum number of processes (threads to use) (phpstan/phpstan-src@71bda09)
- Configurable minimum number of jobs per process (phpstan/phpstan-src@7e28fb8)
๐ Bugfixes ๐
- ๐ Fixed three most common reported problems with parallel analysis:
- Fixing Windows & ARM Linux "child process error" issue (phpstan/phpstan-src@54eb9ce), #2993
- Do not use recursive
mkdir()
- it's not thread-safe (phpstan/phpstan-src@96d8202), #2982 - Use
php -d memory_limit=X for worker
processes (phpstan/phpstan-src@2905d86), #2981
- ๐ Fix Hoa prefixing (phpstan/phpstan-src@0464d0f)
- ๐ Fixed running parallel analysis via shortcut command (phpstan/phpstan-src@0a5cd64), #2986
- StubPhpDocProvider - cannot cache methods because of varying $positionalParameterNames (phpstan/phpstan-src@e8bb833), #2950
๐ฑ Function signature fixes ๐ค
- Parallel analysis improvements:
-
v0.12.10 Changes
February 12, 2020๐ Improvements ๐ง
- Build phpstan-src using GitHub Actions. Huge thanks to @localheinz for this one ๐ #128
- NeonAdapter: throw more meaningful error which contains the filename (#136), thanks @clxmstaab!
๐ฑ Bleeding edge๐ช
PHPStan runs in multiple threads! This leads to huge performance gain roughly equivalent to the number of your CPU cores! This works on all operating systems and does not require any special PHP extension.
๐ 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 ๐
- ๐ Use AutoloadSourceLocator to see existing classes in memory for static reflection (phpstan/phpstan-src@c0cb3a6), #2958
- ๐ Fix traits issue in parallel analysis (phpstan/phpstan-src@cedc99f), #2975
- {Inc,dec}rement operators did not change type of union of int ranges (#140), thanks @cs278!
- ๐ Fixed methods caching issue because of same cache key for implicit/explicit mixed (phpstan/phpstan-src@f83240f)
๐ฑ Function signature fixes ๐ค