Releases: phpstan/phpstan
1.10.67
This is the last release, or one of the last releases, in 1.10.x series. The next one is going to be PHPStan 1.11, and it's going to be released at some point in May 2024.
Improvements 🔧
- Forbid PHPUnitPHAR prefixed classes (#3002), thanks @staabm!
- Improve error messages on unnamed parameters (#3010), #10814, thanks @takaram!
Bugfixes 🐛
- Improve
date()
return types (#2888), #10468, #6613, thanks @zonuexe! - Default value null does not make promoted property type nullable (phpstan/phpstan-src@b2177e3), #9839
- Fix socket_select array types after call (phpstan/phpstan-src@24c5249), #10285
- Fix conditional types in PHPDocs from stubs for native functions (phpstan/phpstan-src@8ae0b28)
- Fix env int key problem (phpstan/phpstan-src@e606fbe), #10833
- Fix false positives about uninitialized properties (#2897), #10523, #10822, thanks @staabm!
- Incremented numeric-string should change to int/float (#2797), #10122, #10187, thanks @staabm!
- Do not generalize big array when combined with empty array (#3003), #10834, thanks @RobertMe!
- Fix string concatenation with benevolent union type (phpstan/phpstan-src@4a4c739), #10863
- Treat
get_defined_vars()
as using constructor arguments (#3012), #10865, thanks @rvanvelzen! - Allow undefined variables passed into by-ref parameters only if the type is nullable (phpstan/phpstan-src@7f8f9cc, phpstan/phpstan-src@7961f7a), #1916
Function signature fixes 🤖
- More precise
gc_status()
signature for PHP8.3+ (#2996), thanks @staabm! - Add object shape for
mysqli_result::fetch_fields
(#3005), thanks @schlndh!
Internals 🔍
1.10.66
Improvements 🔧
- Detect mismatch between readonly/non-readonly class parent (phpstan/phpstan-src@986cbdf), #10789
- TypeInferenceTestCase - fix for performance problem with PHPUnit 11 (phpstan/phpstan-src@da87a65), #10757
Bugfixes 🐛
array_push
preserves list (phpstan/phpstan-src@5473b67)
Function signature fixes 🤖
- Fix
redis::get
signature (#2990), thanks @VincentLanglet!
Internals 🔍
1.10.65
Improvements 🔧
Bugfixes 🐛
- Update BetterReflection (#2988)
- Fix ReflectionSourceStubber compatibility before PHP 8.1 (ondrejmirtes/BetterReflection@94ca133), larastan/larastan#1882
- Fix trait method visibility (ondrejmirtes/BetterReflection@d6153d5?w=1)
Function signature fixes 🤖
Internals 🔍
1.10.64
Bleeding edge 🔪
- Fail build when project config uses custom extensions outside of analysed paths
- This will only occur after a run that uses already present and valid result cache
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 🔧
- Introduce
ForbiddenClassNameExtension
for append additional forbidden class prefixes (#2979), thanks @kamil-zacek! - Add
AlwaysUsedMethodExtension
(#2927), thanks @axlon! - Warn about possibly stale result cache with custom extensions (phpstan/phpstan-src@9338fdf)
- This is how it looks: https://twitter.com/OndrejMirtes/status/1770024563113390437
Bugfixes 🐛
Function signature fixes 🤖
- Fix
DOMDocument::load
return type (#2975), thanks @VincentLanglet! - Fix
SplObjectStorage::removeAll/Except
(#2892), thanks @schlndh!
1.10.63
Improvements 🔧
- Resolve PHPStan issue with deprecated parameter order in PHP 8.1 and 8.3 (#2963), thanks @sayuprc!
- Update nikic/php-parser (phpstan/phpstan-src@7ceeb21, phpstan/phpstan-src@063f6a8)
- Solve duplicates in UnionType description (#2973), thanks @VincentLanglet!
Bugfixes 🐛
- Revert "Update nette/di" (phpstan/phpstan-src@969ff31), #10727
- Fix password_hash algo constant passing on PHP <7.4 (phpstan/phpstan-src@fc4e589), #9246
- ArrayType - use
getIterableKeyType()
, it preserves array-key (phpstan/phpstan-src@d5bf23b), #9307
Function signature fixes 🤖
- Add false return type to
exec()
(#2974), thanks @VincentLanglet!
Internals 🔍
1.10.62
Improvements 🔧
- Too wide return type - report for conditional return types (phpstan/phpstan-src@de1c07e)
Bugfixes 🐛
- Constants deprecation depends on PHP version in comment (#2967), #10700, thanks @staabm!
- Make
@param-out
work even if it is the only conditional type in a function signature (phpstan/phpstan-src@787c1e2) - ParameterOutAssignedTypeRule - fix for conditional types (phpstan/phpstan-src@19497ba)
- ParameterOutExecutionEndTypeRule - fix for conditional types (phpstan/phpstan-src@27c73f7)
- Too wide
@param-out
- fix for conditional types (phpstan/phpstan-src@5a47893)
1.10.61
Improvements 🔧
- Update BetterReflection to 6.25.0
- Implement PHP Version dependent deprecations for constants (Roave/BetterReflection#1396), thanks @staabm!
- Support for
final
modifier in traits (Roave/BetterReflection#1383), thanks @kukulich!
- Support for conditional types in
@param-out
(phpstan/phpstan-src@effad95), #10699 - Check conditional types in
@param-out
(phpstan/phpstan-src@67f9420)
Bugfixes 🐛
- Too wide
@param-out
type - consider all execution ends at once (phpstan/phpstan-src@d1bcf78), #10687, #10684
Internals 🔍
- MethodReturnStatementsNode - use ExtendedMethodReflection (phpstan/phpstan-src@3cc1a54)
1.10.60
Learn more about this release in an article on phpstan.org!
Major new features 🚀
- Generic
@method
tags:@method T doFoo<T>(T $p)
, #6371- Learn more
- #2931, #2935, thanks @mad-briller!
- Generic callable types:
callable<T>(T): T
, #8964- #2938, #2945, #2946, thanks @mad-briller!
- Error on references of prefixed internal class names from PHAR files (#2932), thanks @staabm!
Bleeding edge 🔪
- Enhancements in Handling Parameters Passed by Reference
- Learn more on phpstan.org
- #2941, thanks @ljmaskey!
- Add option
reportAnyTypeWideningInVarTag
(#2840), thanks @janedbal!
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 support for constructor assertions (#2950), #10645, thanks @axlon!
- Report uses of deprecated constants (#2953), thanks @staabm!
Bugfixes 🐛
- Fix how union of callables is understood (#2902), #10442, thanks @mad-briller!
- Fix for inferring closure parameter type from callable union (phpstan/phpstan-src@c10476d)
- ArrayType - string offset might exist as integer offset (#2928), #10610, thanks @michalbundyra!
- Truncate description of huge UnionType (phpstan/phpstan-src@039a3dc), #10614
- fix type of
$a?->b::c()
and$a?->b::$c
(#2933), thanks @schlndh! - fix
fn() => __FUNCTION__
and__METHOD__
(#2934), thanks @schlndh! - Some sort functions do not preserve a list (phpstan/phpstan-src@034f731, phpstan/phpstan-src@0977a7b), #10627
- ArgumentsNormalizer - keep named arguments for unknown parameters (phpstan/phpstan-src@ad34452), #10628
- Check
T of mixed&Foo
andT of mixed|Foo
(#2940), thanks @schlndh! - Use narrowed conditional type if/else types for subtype checks (#2948), #10622, thanks @rvanvelzen!
- Fix
isSuperTypeOf
of callable/Closure when parameter count differ (#2949), #10594, thanks @takaram!
Function signature fixes 🤖
- Fix
ReflectionFunctionAbstract::getExtension
return type (phpstan/phpstan-src@2ece1f8) - Correct return type of
date_sun_info()
function (#2947), thanks @zonuexe! - Fix return values of
mysqli get_warnings
(#2929), thanks @janedbal!
Internals 🔍
1.10.59
Bleeding edge 🔪
array_values
rule (report when alist
type is always passed in) (#2917), thanks @kamil-zacek!
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 🔧
- ArrayFilterRule - tip message about
treatPhpDocTypesAsCertain
(phpstan/phpstan-src@f5b198c) - ArgumentsNormalizer - skip unused arguments in non-variadic signatures, still return a normalized call (phpstan/phpstan-src@17e5bac)
- Methods in fluent interfaces are considered impure (phpstan/phpstan-src@b026126)
- Add type-specifying extension for
settype()
(#2920), thanks @ChrisBrenton!
Bugfixes 🐛
- MethodAssertRule - do not report implicitly inherited assert tags (phpstan/phpstan-src@299df51), #10573
- Gets rid of the annoying error "Asserted type ... with type ... does not narrow down the type."
- ConstantArrayType - string offset might exist as integer offset (phpstan/phpstan-src@2fb6632), #10577
Internals 🔍
- Parallelize levels tests (#2916), thanks @staabm!
FunctionReflection::isPure()
andExtendedMethodReflection::isPure()
(phpstan/phpstan-src@03d01ea)
1.10.58
Improvements 🔧
- Verify property type after
unset
(phpstan/phpstan-src@aeadbe2), #10506, #6773
Bugfixes 🐛
- InvalidThrowsPhpDocValueRule: support
@phpstan-require-extends
(#2890), #10475, thanks @RobertMe! sort()
,rsort()
andusort()
convert an array to list (#2891), #6467, #10423, #3312, thanks @takaram!- Fix stale result cache with imported type aliases (#2894), #10449, thanks @staabm!
- Avoid internal error with
T<X>
whereT
bound consist of intersection type (phpstan/phpstan-src@778b569), #10509 - Recognize
[1 => 'method', 0 => $obj]
as callable (#2896), #10502, thanks @staabm! - SprintfFunctionDynamicReturnTypeExtension - limit combinatorial explosion (phpstan/phpstan-src@51cffd4), #10538
- Fix implicit
@phpstan-assert
PHPDoc inheritance with generics (#2909), #10037, #9123, thanks @RobertMe!