Releases: phpstan/phpstan
1.10.28
Improvements 🔧
- Update BetterReflection to 6.12.0 (phpstan/phpstan-src@7c49c94)
Bugfixes 🐛
- Nullsafe operator on
null
results innull
(phpstan/phpstan-src@5c40c85), #9721 - Properties set in the native constructor are initialized in additional constructors (phpstan/phpstan-src@1b0c6a0), #9619
- Fix performance problem with nested BooleanOr and BooleanAnd (phpstan/phpstan-src@9adae6c), #9690, #9676
- CallableTypeHelper - copy variadic parameters if the accepting closure has more parameters (phpstan/phpstan-src@31ed326), #9699
Internals 🔍
- Simplify access to ClassReflection in ClassPropertyNode (#2565), thanks @mad-briller!
1.10.27
Bleeding edge 🔪
- More precise
stream_socket_client()
signature (#2519), thanks @staabm! - More precise
scandir()
signature (#2518), thanks @staabm! - More precise
extract()
signature (#2517), thanks @staabm!
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. Learn more
Improvements 🔧
- Report trait access to unititialized property in the trait instead of class (#2531), thanks @schlndh!
- Type projections, part 2: enforce elementary rules (#2481), thanks @jiripudil!
- Unify ignoring lines in traits with parser tokens (phpstan/phpstan-src@01294d8), #6175
Bugfixes 🐛
- Fix json method exception (#2524), #9568, thanks @VincentLanglet!
- Support of printf with dynamic width (#2543), #9674, thanks @kukulich!
- Support of printf with dynamic precision (and improved support of dynamic width) (#2544), #9677, thanks @kukulich!
- Fix types for conditional parameters after checks (#2548), #7915, thanks @rvanvelzen!
- Prevent
Call to end() on null
(phpstan/phpstan-src@a5e5719), #9722 - Fix internal error in SimpleXMLElementConstructorThrowTypeExtension (#2561), #9716, thanks @staabm!
- Method extensions class name is case-insensitive (#2562), #9716, thanks @staabm!
- InArrayFunctionTypeSpecifyingExtension - fix calls with less than 2 parameters (phpstan/phpstan-src@4d77e98), #9711
Function signature fixes 🤖
uopz_flags
- flags are optional (phpstan/phpstan-src@917750e), #9611- Add
base64_decode
overloads to PHP 8+ (#2529), #9428, thanks @dktapps! - Mark few Ds methods as impure (#2550), thanks @simPod!
Internals 🔍
- Avoid doing work before its necessary in mutating scope. (#2537), thanks @mad-briller!
- Changed
linesToIgnore
attribute format (phpstan/phpstan-src@2862a7b) - Prevent unnecessary work in MutatingScope (#2554), thanks @staabm!
- Validate parameters with parametersSchema each time after container creation (#2558)
1.10.26
Improvements 🔧
- More precise return type for trigger_error (#2526), thanks @paulbalandan!
Bugfixes 🐛
- Fix filtering default stub files on Windows (#2406), thanks @maryo!
- FileHelper absolutize and normalize: Fix path with scheme (#2506), thanks @mvorisek!
- Fix
array_keys()
and `array_values()`` on constant arrays (#2516), thanks @jlherren! - Fix access to uninitialized property via extension in additional constructor (phpstan/phpstan-src@218aad0), #9619
- Fix result cache bug with imported type aliases (phpstan/phpstan-src@553c4b1), #9622
- Fix result cache bug with imported type aliases in a trait (phpstan/phpstan-src@d8071d0)
- Fix PHP 8.3 deprecation (
$foo--
with a non-numeric string no longer allowed) (phpstan/phpstan-src@c6f4c4c) - Array shape with optional keys might be a list (phpstan/phpstan-src@97f0039)
- ArrayMapFunctionReturnTypeExtension - preserve array being a list (phpstan/phpstan-src@d55c4f2)
Function signature fixes 🤖
- More precise
ftp_*
mode parameter type (#2513), thanks @staabm! - Fix signature of
DOMNode::lookupNamespaceURI
(#2527), thanks @paulbalandan!
Internals 🔍
- Simplify access to class reflections in InClassNode rules (#2514), thanks @mad-briller!
- Simplify access to class reflections in ClassPropertiesNode (#2520), thanks @mad-briller!
- Simplify access to function reflection in FunctionReturnStatementsNode rules (#2522), thanks @mad-briller!
- Set class and method reflection in the MethodReturnStatementNode (#2515), thanks @mad-briller!
- Simplify access to class reflections in ClassConstantsNode and ClassMethodsNode rules (#2521), thanks @mad-briller!
- Introduce InTraitNode (phpstan/phpstan-src@657fc54)
- TrinaryLogic for
isList
in ConstantArrayType (phpstan/phpstan-src@158c61c, phpstan/phpstan-src@f0a9fd7) - Add polyfill for PHP 8.1 (phpstan/phpstan-src@a8818be, phpstan/phpstan-src@cda7e69)
1.10.25
Improvements 🔧
- Understand that promoted property can come from renamed trait constructor (phpstan/phpstan-src@eafba2e)
- Understand that methods called from constructor throwing exception cannot leave object in an uninitializad state (phpstan/phpstan-src@f4d060b)
Bugfixes 🐛
- Allow promoted properties in trait
__construct
even when renamed (phpstan/phpstan-src@4dd3f75), #9577 - IllegalConstructorStaticCallRule - fix for renamed trait constructor (phpstan/phpstan-src@65330d3), #9577
1.10.24
Improvements 🔧
- Evaluate uninitialized properties based on each execution end in constructor (phpstan/phpstan-src@b2d2a9d), #7649
- ConstructorReturnTypeRule (phpstan/phpstan-src@2ebbb53)
Bugfixes 🐛
- Fix
processCalledMethod
when anonymous classes are involved (phpstan/phpstan-src@3f52779) - Do not require return type for renamed trait constructor (phpstan/phpstan-src@f6ca9c8), #9571
- FileTypeMapper - fix PHPDocs for renamed trait methods (phpstan/phpstan-src@0bd48b4), #9571, #6856
- Register
json_validate
stub only on PHP 8.3+ (phpstan/phpstan-src@8f8c1af), #9574
Function signature fixes 🤖
1.10.23
Improvements 🔧
- Fix false positives and false negatives about uninitialized properties (phpstan/phpstan-src@348debc), #7198
- This leads to uninitialized properties being detected in more places
- Lazy initialization of
AnalyserResult::$errors
(#2400), thanks @takaram! - Check additional assign of promoted readonly property (phpstan/phpstan-src@8fe4401)
Bugfixes 🐛
- Fix readonly property assigned in if-else (phpstan/phpstan-src@ce3c164), #6402
- Fix ConstantArrayTypeBuilder's isList flag (#2408), thanks @jlherren!
- TypeSpecifier - handle AlwaysRememberedExpr in handling Identical (phpstan/phpstan-src@a769a1c), #9499
- Fix processing traits with renamed methods (phpstan/phpstan-src@c6035f3), #7198, #6039, #4758
Function signature fixes 🤖
Internals 🔍
- Cheap checks first in IgnoredRegexValidator (#2505), thanks @mad-briller!
- Do not use
instanceof ThisType
as it can be unreliable in case of intersection types (phpstan/phpstan-src@7935945)
1.10.22
Bleeding edge 🔪
- More precise
file()
flags args (#2476, #2482), thanks @staabm! - Non-static methods cannot be used as static callables in PHP 8+ (#2420), thanks @staabm!
- More precise
flock()
operation flags (#2477), thanks @staabm! - Rule for
call_user_func()
(#2479), thanks @staabm!
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. Learn more
Improvements 🔧
- Add return type extension for
constant()
(#2474), thanks @herndlm! - Dynamic
assert()
throw type extension (#2427), thanks @patrickkusebauch! - Update nikic/PHP-Parser (phpstan/phpstan-src@79b3034)
- PHP 8.3:
json_validate()
stub (phpstan/phpstan-src@828b269), thanks @staabm! - Implement
call_user_func()
DynamicFunctionReturnTypeExtension (#2479), thanks @staabm!
Bugfixes 🐛
- Add support for math with constant numeric string (#2209), #8803, #8827, thanks @VincentLanglet!
- Use case insensitive matching to detect usages of private methods (#2484), #8346, thanks @stof!
- fix array_splice with non-array replacement (#2457), thanks @schlndh!
- Resolve key and value type of partially non-iterable types when entering foreach (phpstan/phpstan-src@cb5a2b4), #9535, #4907, #8924, #5998
- Foreach can append to the array but it does not change the number of iterations (phpstan/phpstan-src@27085c5), #4612
- MutatingScope - process left side of BooleanAnd and BooleanOr before getting type of the whole expression (phpstan/phpstan-src@989dd6f), #5365, #6551, #7491, #4004, #2499
- MutatingScope - process ternary cond before getting type of the whole expression (phpstan/phpstan-src@faba805)
- Fix processing switch with complex case conditions (phpstan/phpstan-src@f6b34f2), #5326
- Fix ClassConstFetch Identical specification with Yoda conditions (#2498), #9542, thanks @herndlm!
Function signature fixes 🤖
- Update functionMap for ext-mongodb 1.16 (#2473), thanks @alcaeus!
- Add false to the
db2_num_rows()
return type (#2456), thanks @morozov! - More precise
ignore_user_abort()
return type (#2489), thanks @staabm!
Internals 🔍
- Type projections, part 1: call-site variance in GenericObjectType (#2471), thanks @jiripudil!
- Test PHP 8.3 (#2486)
- Cleanup NodeScopeResolver (#2499), thanks @staabm!
1.10.21
Bugfixes 🐛
- Fix defining variables in match condition (phpstan/phpstan-src@d6c2752), #9474
- Fix UnusedClosureUsesRule for already traversed match (phpstan/phpstan-src@a719486), phpstan/phpstan-phpunit#190, #9478
- Update BetterReflection (phpstan/phpstan-src@a540e44), #9477
- Fix newInstance on ReflectionAttribute adapter with enum argument (ondrejmirtes/BetterReflection@277b960)
Internals 🔍
- Cheap checks first in ObjectType (#2475), thanks @mad-briller!
1.10.20
Improvements 🔧
- PHPStan Pro: Change Cloudflare DNS for to family version (#2467), thanks @spaze!
- Add
non-zero-int
type (#2449), thanks @PrinsFrank! - Implement
gettype()
return type extension (#2437), thanks @staabm!
Bugfixes 🐛
- Allow to remember constant and impure expressions in
match
condition (phpstan/phpstan-src@0cdda0b), #4451, #6064, #9457 - Fix
gettype
inmatch
condition (phpstan/phpstan-src@e4ef00c, phpstan/phpstan-src@caa0a5b), #8614 - Fix
get_class
inmatch
condition (phpstan/phpstan-src@106526d), #1885, #8536, #8092 - Understand
get_class
compared withstatic::class
(phpstan/phpstan-src@590eb03), #1885 - Understand
gettype
when there's a union of strings on the other side (phpstan/phpstan-src@36e412f), #6294, #2580 - Treat ConstantArrayType as covariant in its keys and values (#2464), #9161, thanks @jiripudil!
- Treat ArrayType as covariant in its keys and values (#2465), thanks @jiripudil!
- Make
NonEmptyArrayType::toArray()
return$this
(#2349), #9208, thanks @zonuexe! - Retain list type via
array_push()
andarray_unshift()
(#2451), #8449, thanks @herndlm! - For
@var
above throw and return, change the type of expr only for the stmt callback (phpstan/phpstan-src@b551095), #9459
Internals 🔍
- Remove redundant conditions from RemoveUnusedCodeByPhpVersionIdVisitor. (#2459), thanks @mad-briller!
- Return early in CachingVistor to avoid always-false instanceof checks. (#2460), thanks @mad-briller!
- Introduce CombinationsHelper (phpstan/phpstan-src@175307e)
Type::getFiniteTypes()
(phpstan/phpstan-src@7912caf, phpstan/phpstan-src@fa9a951, phpstan/phpstan-src@b5cf52b)
1.10.19
Bleeding edge 🔪
- Analysis with zero files results in non-zero exit code (phpstan/phpstan-src@46ff440), #9410
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. Learn more
Improvements 🔧
- Detect invalid key in multi dimensional array fetch (#2445), #6315, thanks @schlndh!
- Support unions of scalars in
sprintf()
arguments (phpstan/phpstan-src@1f95570) - Update nikic/php-parser (phpstan/phpstan-src@51a284b)
- Update BetterReflection (phpstan/phpstan-src@ff8ad7e)
Bugfixes 🐛
- UnusedPrivatePropertyRule - recognize static properties fetched on expr (phpstan/phpstan-src@503978b), #9409, #8541
- Union of enum cases accepts the enum class type with negated cases (#2418), #8846, thanks @takaram!
- Fix key type of superglobal variables (#2446), #9306, thanks @schlndh!
- Do not treat definition of functions and class-likes as unreachable (#2263), #4002, #8966, #8319, thanks @takaram!
Function signature fixes 🤖
Internals 🔍
- StringAlwaysAcceptingObjectWithToStringType is supertype of Stringable objects (phpstan/phpstan-src@9de9efa)