chore(deps): update dependency phpstan/phpstan to v2 #31
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "renovate/major-phpstan-packages"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR contains the following updates:
^0.12.29
->^2.0.0
Release Notes
phpstan/phpstan (phpstan/phpstan)
v2.1.18
Compare Source
Bleeding edge 🔪
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
: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 🔧
@phpstan-sealed
support (#4095), thanks @VincentLanglet!f375a814c4
)--fail-without-result-cache
when the error formatter returns 0 (df9fa6e04b
)count()
return type inObjectType::getArraySize()
(#4072, #4078), thanks @vojtech-dobes!PDO::connect
dynamic method return type extension (#4015), #12359, thanks @VincentLanglet!PhpVersion::__construct
to BC promise (#4022), #8582, thanks @VincentLanglet!switch
on::class
(#4011), #13069, thanks @VincentLanglet!array_keys
return type (#3590), #11928, thanks @staabm!Bugfixes 🐛
ClosureType::equals()
for pure/impure closures (02066c7350
), #13067c0f2e9e923
), #13171in_array()
always true (#4073), #13151, #8818, #12755, #12412, thanks @VincentLanglet!MixedType->equals(ErrorType)
(#3934), thanks @staabm!unset()
with nested dim fetch (#3964), #12927, #12330, #11171, #8282, #12754, thanks @staabm!Function signature fixes 🤖
7534ee1a37
)posix_getpwnam()
(#4091), #12254, thanks @zonuexe!SimpleXMLElement::xpath
return type (#4096), thanks @VincentLanglet!locale_get_display_x()
return types (#4085), thanks @cfahner!DOMElement::$attributes
stub (#4029), #13076, thanks @VincentLanglet!Internals 🔍
parametersSchema.neon
(72c2a8da27
)vendor/attributes.php
.AutowiredService
AutowiredParameter
NonAutowiredService
GenerateFactory
RegisteredRule
RegisteredCollector
676ad27fc1
)35fbc87a4b
#[Override]
for methods overriding 3rd party (98ed73222b
)??=
(#4084), thanks @zonuexe!$var === const
within_array()
(#4098), thanks @zonuexe!24436631a3
)assertSuperType
testing utility (#4066), thanks @vojtech-dobes!Type::spliceArray()
, improvesplice_array()
array type narrowing (#3952), thanks @herndlm!v2.1.17
Compare Source
Major new features 🚀
74b909aedc
)Bleeding edge 🔪
new static()
in static method of abstract class - level 0 (a5f7c060c8
)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
: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 🔧
Bugfixes 🐛
array_column()
with explicit null$index_key
(#3970), #12945, thanks @herndlm!getNativeExprType
(222676e94a
)dff492e14c
,268d7c6388
)0ad2a6a6f2
)e33a560c71
)Function signature fixes 🤖
libxml_get_errors()
(#3973), thanks @jack-worman!Internals 🔍
ProcessPromise::cancel()
from deferred canceller (df4c1f39e9
)e1e8302327
)d88e2fece5
)2ac0a171e6
)aaa1424c0f
)getPhpDocReturnTypeWithUnresolvableTemplateTypes
fromResolvedFunctionVariantWithCallable
(e3c76ade59
)2f66ec60f9
)v2.1.16
Compare Source
Improvements 🔧
@final
PHPDoc tag above properties (#3990), #12999, thanks @lpd-au!Bugfixes 🐛
preg_split()
function return type (#3757), thanks @malsuke!Function signature fixes 🤖
v2.1.15
Compare Source
Improvements 🔧
8edfa9fa88
)__toString
methods in(string)
cast (ce257d9acf
)Bugfixes 🐛
new UnionType
(1044f1112a
), #12512{min,max}()
(#3928), #12731, thanks @cs278!IterableType::equals()
withTemplateIterableType
(#3991), thanks @staabm!4a907f16f0
), #12951Function signature fixes 🤖
DOMNode::hasAttributes
(#3800), thanks @Niklan!Internals 🔍
instanceof *Type
in Rules classes (#3858), thanks @zonuexe!v2.1.14
Compare Source
Bugfixes 🐛
strict_types=0
(#3965), #12946, #12940, #12950, #12947, thanks @staabm!array_slice()
edge cases (#3959), thanks @herndlm!non-falsy-string
cannot be converted to0
(#3971), thanks @staabm!Internals 🔍
$parentNode = $parentNode
(#3938), thanks @samsonasik!3854cbc574
)v2.1.13
Compare Source
Major new features 🚀
Bleeding edge 🔪
@internal
symbols usage from outside their top namespace, #1178If 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
: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 🔧
array_splice()
(#3947), thanks @herndlm!array_slice()
for normal arrays (#3946), #12880, thanks @herndlm!ConstantArrayType::sliceArray()
with non constant integer args (#3949), thanks @herndlm!Bugfixes 🐛
7c1ee34aa0
), #12891Scope::rememberConstructorScope()
should not remember the function scope (#3944), https://github.com/spaze/phpstan-disallowed-calls/issues/323, thanks @staabm!session_set_cookie_params
call with named arguments (72e37dcf29
), #12934Internals 🔍
4f5a63a5f5
)3024c02e84
)ConstantArrayType::shuffle()
(#3948), thanks @herndlm!ExtendedPropertyReflection::getName()
(ff198c9d12
)v2.1.12
Compare Source
Improvements 🔧
fdd5ad933d
,a2834bcc68
)c5cf14ba60
,a2834bcc68
)discoveringSymbols
tip (#3929), https://github.com/phpstan/phpstan/discussions/12859, thanks @herndlm!Bugfixes 🐛
count()
(#3902), #12787, thanks @herndlm!3d52930753
)ae5562fc29
), #12793matches[0]
type for regexes containing\K
(#3920), #12792, thanks @mvorisek!non-empty-array
for union ofisIterableAtLeastOnce()->yes()
(#3937), #12847, thanks @staabm!Function signature fixes 🤖
getopt()
function stub (#3655), #12103, thanks @janedbal!Internals 🔍
v2.1.11
Compare Source
Improvements 🔧
Bugfixes 🐛
a3039ef58e
), #12778Function signature fixes 🤖
SessionHandlerInterface::read
return type (#3884), #12748, thanks @sayuprc!v2.1.10
Compare Source
Bugfixes 🐛
72d2f3b5b1
), #12767v2.1.9
Compare Source
Improvements 🔧
7d4dcb5e48
,0df0c6f34b
), #123988bb0670cff
)51a867f439
)244093e4f4
)2fe4e0f94e
)count()
narrowing of constant arrays (#3709), #12190, #3631, thanks @herndlm!#[Pure(true)]
in PhpStorm stubs ashasSideEffects => true
(#3880), #6345, #12577, #10342, thanks @zonuexe!Bugfixes 🐛
count()
regression (#3895), thanks @staabm!count()
narrowing handling of empty array (#3896), thanks @herndlm!count()
(#3898), thanks @herndlm!Internals 🔍
shouldPolluteScopeWithLoopInitialAssignments
to true which is PHPStan's default behaviour (1b56b0c1e0
)v2.1.8
Compare Source
Improvements 🔧
@readonly
property cannot be passed by-ref (#3850), #12676, thanks @staabm!ed4ea0a3b5
)ClassReflection::isSubclassOf(string $className)
in favour ofClassReflection::isSubclassOfClass(ClassReflection $class)
string $className
instead ofClassReflection
and you are too lazy to get ClassReflection via ReflectionProvider, you can still useClassReflection::is(string $className)
Bugfixes 🐛
9bb2ed5b90
)unset.possiblyHookedProperty
(#3855), #12695, thanks @staabm!da737711e4
,12185abf06
), #12702Internals 🔍
TrinaryLogic::and()
(#3860), thanks @staabm!MutatingScope::mergeWith()
(#3861), thanks @staabm!v2.1.7
Compare Source
Improvements 🔧
IgnoreErrorExtension
(#3783), thanks @ruudk!new Foo()
cannot be a subclass (#3853)$a::class
andget_class($a)
cannot be a subclass (772f297942
)d56d0842ca
)unset()
(#3827), #12421, thanks @staabm!unset()
(#3842), #12336, thanks @staabm!Integer
class before resolving toint
(#3848), #12660, thanks @stepo2!Bugfixes 🐛
ClassLike::$namespacedName must not be accessed before initialization
(948f79d2da
), #12627%env%
inincludes
(d4d7e116a2
), #126068de182dbde
), #12621189a4cc4c3
)Function signature fixes 🤖
ResourceBundle::getLocales
(#3840), #12579, thanks @mat-se!scandir()
argument and return type (#3808), thanks @zonuexe!mysqli_fetch_all()
(#3778), thanks @oxan!Internals 🔍
instanceof ConstantString
(#3780), thanks @staabm!new
(#3852)v2.1.6
Compare Source
Improvements 🔧
924a7a2f64
)73d7b88d60
)//
(https://github.com/phpstan/phpdoc-parser/pull/264), https://github.com/phpstan/phpdoc-parser/issues/184, thanks @shmax!Bugfixes 🐛
Internals 🔍
d3909c7fbf
)v2.1.5
Compare Source
Improvements 🔧
6c45175093
,8a5bfb9208
)array<value-of<MyEnum::FIRST>, X>
to create an array shape where the key is backed enum case valued25a815b10
)Bugfixes 🐛
GenericStaticType
in@phpstan-self-out
, use@phpstan-self-out
type when returning$this
(dab99cba7b
), #12575, #12548, #8439, #8316, #8275@phpstan-self-out
with GenericStaticType when method is called on$this
(cf6476188b
)0c8e9d2905
), #12586v2.1.4
Compare Source
Improvements 🔧
Bugfixes 🐛
3816597f86
97d994e9f3
ad610cf827
b82230a482
), #12547e664bed7b6
Function signature fixes 🤖
false
to alltrader_*
functions return type (#3815), thanks @rabol!v2.1.3
Compare Source
If you're using
larastan/larastan
PHPStan extension, please update to version 3.0.4 alongside PHPStan 2.1.3 for improved compatibility with the new genericstatic<...>
type. Thank you.This release includes fixes and improvements from PHPStan 1.12.17. Most impportantly it introduces GenericStaticType - support for
static<...>
(#1289), #12485, #11398, #10417, #9807, #9449, #8623, #5512Improvements 🔧
b3ca610fb4
)a387fa3278
), #10443, #9618->getAttributes()
on any thinkable reflection object, including$scope->getFunction()
and you'll get a new PHPStan's AttributeReflection class: https://apiref.phpstan.org/2.1.x/PHPStan.Reflection.AttributeReflection.htmlBugfixes 🐛
1cc534759f
), #1246650f8e49121
), #12466ReflectionClass::isSubclassOf()
with invariant@template T
(4f2af3bcdf
), #12473array_combine()
args must have the same number of elements (36f3291bd5
), #12327Function signature fixes 🤖
Imagick::getConfigureOptions()
returns array instead of string (#3801), thanks @blankse!Internals 🔍
phpstanPlayground.configParameter
errors (71d0327619
)0b28f6001b
)v2.1.2
Compare Source
Improvements 🔧
eb0e0bcfe2
,bed30a79f4
), #12438, #1239325ec5eb2db
), #12435Bugfixes 🐛
Function signature fixes 🤖
false
to the return type (#3730), thanks @sreichel!samesite
cookie argument precision (a54cdb0675
)Internals 🔍
5d35811a87
)ConstantArrayType::findTypeAndMethodNames()
used only once (30b9cd86c5
)v2.1.1
Compare Source
Improvements 🔧
getNextStatements
in UnreachableStatementNode (#3745), thanks @samsonasik!@phpstan-consistent-constructor
(#3687), #12137, thanks @herndlm!checkUninitializedProperties
is enabled (ca86412b4c
)Bugfixes 🐛
b614f70e01
)Internals 🔍
propertyName
attributev2.1.0
Compare Source
Read all about this release on PHPStan's blog!
Major new features 🚀
#[Deprecated]
attribute (RFC)Bleeding edge 🔪
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
: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 🔧
#[AllowDynamicProperties]
(#3738), #12281, thanks @staabm!parent::
(41837b490b
)Bugfixes 🐛
preg_match()
group containing start/end meta characters (#3740), #12297, thanks @staabm!Internals 🔍
In*Node
virtual nodes for more precise Scope90e48fa876
)Scope::getConstant
instead (#3666), thanks @staabm!v2.0.4
Compare Source
This release includes improvements and fixes from PHPStan 1.12.13.
Improvements 🔧
strictRulesInstalled
parameter (#3729), thanks @staabm!Bugfixes 🐛
htmlspecialchars
andhtmlentities
beingnon-empty-string
without ENT_SUBSTITUTE flag (#3710), #12021, thanks @jack-worman!Function signature fixes 🤖
fgetcsv
return type; never returns null (#3712), thanks @janedbal!apcu_cache_info
andapcu_sma_info
signatures (#3726,e7e8093402
), thanks @vindic!Internals 🔍
7b4c9afd09
)v2.0.3
Compare Source
This release includes improvements and fixes from PHPStan 1.12.12.
Bleeding edge 🔪
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
: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 🔧
Bugfixes 🐛
in_array
(#3646), #12083, thanks @janedbal!Function signature fixes 🤖
Internals 🔍
Scope::getPhpVersion()
(#3642), thanks @staabm!Printer::__construct()
(#3680), thanks @samsonasik!v2.0.2
Compare Source
Improvements 🔧
diagnose
command (#3609), thanks @staabm!phpVersion.min
andmax
in VersionCompareFunctionDynamicReturnTypeExtension (#3631), thanks @staabm!Internals 🔍
v2.0.1
Compare Source
Bugfixes 🐛
753fc4d98f
)v2.0.0
Compare Source
Read more about PHPStan 2.0.
Check out the UPGRADING guide!.
Buy the PHPStan elephpant and T-shirts!
Major new features 🚀
mixed
types strictly, not just explicitmixed
list
type (#1751), #3311, #8185, #6243, thanks @rvanvelzen!@readonly
rule that disallows default values (#1391), thanks @herndlm!@phpstan-consistent-constructor
(#1296), thanks @canvural!is_a()
orclass_parents()
(c4a662ac6c
)new ReflectionMethod()
(536306611c
)instanceof
of classes not covered by backward compatibility promise (ff4d02d62a
)instanceof
of classes covered by backward compatibility promise but where the assumption might change (996bc69fa9
)9e007251ce
)@phpstan-self-out
(6838669976
)2485b2e9c1
)5f7d12b2fb
)5a2d4416d9
)@param-out
(30c4b9e80f
), #10260@param-closure-this
(2fa539a39e
), #10933@var
tag type against native type (a69e3bc2f1
)reportWrongPhpDocTypeInVarTag
totrue
to have all types validated, not just native onesreportAnyTypeWideningInVarTag: true
for stricter behaviour (#2840), thanks @janedbal!0264f5bc48
)@phpstan-pure
above functions and methodsPHPStan\Type\Type
interface via@var
(713b98fb10
), https://github.com/nunomaduro/larastan/issues/1567#issuecomment-1460445389@mixin
PHPDoc tag above traits (0d0de94690
)@extends
,@implements
,@use
for unresolvable types (2bb528233e
), #11552@method
tags (5b7e474680
)@method
@template
tags above traits (aadbf62d3a
)@property
tags (55ea2ae516
), #10752, #93567453f4f75f
)3a12724fd6
,3b011f6524
), #7539c4d05276fb
)var_export
without$return=true
(#3225), #11320, thanks @staabm!6ebf2361a3
)new
/function call/method call/static method call on a separate line without any side effects even without@phpstan-pure
PHPDoc tag on the declaration side281a87d1ab
565fb0f6da
)call_user_func()
(#2479), thanks @staabm!array_filter()
calls (#1077), #6840, thanks @leongersen!array_values()
calls (#2917), thanks @kamil-zacek!@no-named-arguments
(74ba8c2369
), #5968@phpstan-self-out
(892b319f25
)ce7ffaf02d
)@mixin
(3175c81f26
)polluteScopeWithBlock
(defaults totrue
,false
inphpstan-strict-rules
) (946cf180c9
)@readonly
property and@immutable
class PHPDoc (#1295, #1335), #4082, thanks @herndlm!instanceof *Type
in favour of new methods onType
interface, (436e6d3015
), learn more: Why Is instanceof *Type Wrong and Getting Deprecated?Improvements 🔧
fc66c24113
)exceptions.check.tooWideThrowType
made true by default (1b1da3e2ce
)implicitThrows
to only look for explicit throw points in too-wide@throws
rules when set tofalse
(a0e688c1d1
)d7798d7f2c
)f38addda2b
,c8b7ea9e8f
)97786ed837
)a04e0be832
)e19e6e5f8c
), #102999718c14f1f
)GenericObjectType
(#2818, #2821)46ff440648
), #9410969e6fa31d
)RuleLevelHelper::accepts()
behaviour (941fc815db
), #11119, #4174089d4c6fb6
), #6398Throw_
(22eef6d5ab
), #4912@param-out
(56b2002438
)04f8636e65
)5fd8cee591
)ca2c66cc4d
)@final
method in OverridingMethodRule, #9135ddf8d5c385
,17e4b74335
)a6470521b6
), #10389@param-out
(7ceb19d3b4
), https://github.com/phpstan/phpstan/issues/8880#issuecomment-1426971473skipCheckGenericClasses
(28c2c79b16
)??
/isset
/empty
with different message (#1253), thanks @rajyan!is_array
(#1191), thanks @herndlm!c30e9a484c
)124b30f98c
,0c82c96f2a
)9780d352f3
)9c2552b7e7
)b116d25a6e
)939a715a06
)isset()
, not just on PHP 8.2+ (#3476), thanks @ondrejmirtes!950a491485
)Collection<...>|Foo[]
being resolved to Collection of Foo (fff8f09598
)1d3f431395
)bf19914cac
)f680629bc9
)6cf223840f
)67fbfaee65
)PhpMethodReflection
andPhpFunctionReflection::isVariadic()
(#3534), thanks @staabm!466ad51740
)57c65888e6
)Bugfixes 🐛
mixed
type based on config (#2885), thanks @schlndh!Function signature fixes 🤖
0|positive-int
(#1027), thanks @staabm!Imagick
parameter types (#2334), thanks @zonuexe!max()
/min()
should expect non-empty-array (#2163), thanks @staabm!Closure::bind
$newScope
param (#2817), thanks @mvorisek!error_log
errors withmessage_type=2
(#2428), #9380, thanks @staabm!FILE_NO_DEFAULT_CONTEXT
infile()
(#2482), thanks @staabm!file()
flags args (#2476, #2482), thanks @staabm!flock()
operation flags (#2477), thanks @staabm!stream_socket_client()
signature (#2519), thanks @staabm!scandir()
signature (#2518), thanks @staabm!extract()
signature (#2517), thanks @staabm!RecursiveIteratorIterator::__construct()
parameter types (#2835), thanks @staabm!Locale
signatures (#2880), thanks @devnix!$mode
parameter for thecount()
(#3190), thanks @kuma3!filter_input*
type param type (#2271), thanks @herndlm!curl_setopt
function signature based on 2nd arg (#1719), thanks @staabm!count_chars()
(#3596), thanks @u01jmg3!Internals 🔍
7e366e08f9
)2c4c0cde75
)f17cf9ec43
)$templateTags
is required (5b58f83e6d
)$usePathConstantsAsConstantString
made required (f88d9ba7f5
)PhpMethodReflectionFactory::create()
- all parameters are required (8bfbf8f254
)$nodeType
and$acceptsNamedArguments
made required (493752737c
)$ignorable
ofcompare()
method made required (f85a500288
)$dateTimeClass
of DateTimeModifyReturnTypeExtension constructor made required (a8cd423e84
)64ff598cd4
)51de9032c6
)PhpVersion
parameter to variousType
methods (#3478), thanks @VincentLanglet!5651bec661
)db02a30ca1
)f302c90692
)392f090066
)f0a629685d
)getClass()
return types in extension interfaces (#1754), thanks @staabm!38cb5a315e
)b5accb3f6b
)b0858332ef
)778af2ed74
,cb6ab5544a
)FunctionCallParametersCheck::check()
parameters (710e09c416
)instanceof self
inConstantArrayType
(#3552), thanks @herndlm!bashunit -a
exit_code to check for errors (#3533), thanks @Chemaclass!v1.12.28
Compare Source
Improvements 🔧
7644bd0160
)Bugfixes 🐛
@property
referencing other class and then back in recursive manner (33c2cb1965
), #13057@var
PHPDoc type inheritance for class constants (#4008), #10911, thanks @VincentLanglet!getenv(null)
for PHP 8.0+ (#4007), #13065, thanks @VincentLanglet!43c44ee47d
)400ba6d71a
), #13218$
(#4006), #12095, thanks @VincentLanglet!0
in key type is not a list (#4018), #9487, thanks @VincentLanglet!Function signature fixes 🤖
bzdecompress()
(#4088), thanks @jlherren!mb_convert_encoding
return type (#4010), thanks @VincentLanglet!Internals 🔍
v1.12.27
Compare Source
Major new features 🚀
74b909aedc
)Improvements 🔧
bd6fc4e266
)275d3b5a85
,572e0e8f26
)80b40f2177
)Bugfixes 🐛
0536d1148d
), #11788408692e22c
), #12381, #73397e3639b228
), #12465e5db864362
)v1.12.26
Compare Source
Improvements 🔧
Bugfixes 🐛
is_subclass_of
andis_a
(#3788), #3979, #8464, thanks @VincentLanglet!numeric-string
toarray-key
(#3326), #4163, #4671, #8592, #11390, #12413, thanks @VincentLanglet!callable-string
must benon-empty-string
(#3983), #12979, thanks @aivchen!Function signature fixes 🤖
v1.12.25
Compare Source
Consider comparison as strict when type is the same (#3942), #12884, thanks @VincentLanglet!
v1.12.24
Compare Source
Bugfixes 🐛
8a6f7e9a1c
), #12803DateTime::format('u')
return type (#3919), thanks @mvorisek!Function signature fixes 🤖
v1.12.23
Compare Source
Fix condition of fall-through case not used for exhaustive checks (#3900), #11064, #3488, #8719, #12722, thanks @rvanvelzen!
v1.12.22
Compare Source
Improvements 🔧
implode()
return type (#3774), thanks @staabm!Bugfixes 🐛
[]
on array with constant-integer offset will add one to the offset (fe595cba71
), #9328, #9850, #10650791e708efd
), #126714111d0f595
)v1.12.21
Compare Source
Bugfixes 🐛
5920c9861a
), #126910e10531bb0
), #12691, #6828, #11942, #11861, #6828, #91678734057fed
), #12658, #8030Function signature fixes 🤖
MongoCollection::findOne()
return type (#3854), thanks @aivchen!v1.12.20
Compare Source
Bugfixes 🐛
@var
PHPDoc type fromType::toPhpDocNode()
before reporting it as wrong (#3797), #12458, #11015, #10861, #11535, thanks @VincentLanglet!Internals 🔍
FileTypeMapper::getNameScope()
(bca8902dc4
)v1.12.19
Compare Source
Improvements 🔧
ClassReflection::hasMethod()
method (#3825), thanks @canvural!Function signature fixes 🤖
MongoLog::setCallback()
return type (#3829), thanks @aivchen!MongoCollection::save()
return type (#3829), thanks @aivchen!v1.12.18
Compare Source
Bugfixes 🐛
Function signature fixes 🤖
setproctitle
function from the functionMap (f5627dcc02
), #12573v1.12.17
Compare Source
If you're using
larastan/larastan
PHPStan extension, please update to version 2.9.14 alongside PHPStan 1.12.17 for improved compatibility with the new genericstatic<...>
type. Thank you.Improvements 🔧
static<...>
(#1289), #12485, #11398, #10417, #9807, #9449, #8623, #5512, thanks @canvural!Bugfixes 🐛
2f74584b83
)b57bcadc27
), #10240, #10488, #1207349c631a5a6
), #10914, #9657eded2c3a3b
), #12501Internals 🔍
ebcb5dabec
,10388a9b6c
)v1.12.16
Compare Source
Bugfixes 🐛
8b2794326f
), #12379implode()
(#3772), #11854, thanks @staabm!d38ed503c5
), #12182hash()
return type (#3665), thanks @VincentLanglet!OpenSslEncryptParameterOutTypeExtension
(#3753), thanks @paulbalandan!24cdeac08c
), #12443new
from parent constructor - reject types that would fail bound check of the child class (d06f792a9f
), #12386Function signature fixes 🤖
stream_context_get_params
(ff1feeebbd
), #11796Internals 🔍
instanceof ConstantScalarType
(#3773), thanks @staabm!v1.12.15
Compare Source
Bugfixes 🐛
new
with generic type with constructor in parent class (a063119ee4
), #8219, #2735array_merge
(#3770), #7857, #8632, #9559, thanks @herndlm!Internals 🔍
instanceof ConstantBooleanType
checks (#3771), thanks @staabm!v1.12.14
Compare Source
Fix
preg_match()
group containing start/end meta characters (#3740), #12297, thanks @staabm!v1.12.13
Compare Source
Improvements 🔧
get_defined_vars()
return type contains known variables (#3624), #11948, #11740, thanks @MartinMystikJonas!UnionType->isSuperTypeOfWithReason()
(#3692, #3713), thanks @staabm!IntersectionType->getEnumCases()
(#3695), thanks @staabm!MixedType::toArrayKey()
returnsBenevolentUnionType
(#3696)621e168298
)ClassAsClassConstantRule
(#3697), #10859, thanks @paulbalandan!FunctionCallParametersCheck
(#3734), thanks @staabm!MutatingScope::getNodeKey()
(#3736), thanks @staabm!Bugfixes 🐛
iterator_to_array
return type with generators (#3652), thanks @paulbalandan!#
comments in regex withx
modifier (#3735, #3739), #12242, thanks @staabm!Function signature fixes 🤖
DOMDocument::create*()
return types (#3737), #12278, thanks @staabm!Internals 🔍
Rule
andRuleTestCase
(#3698), thanks @paulbalandan!v1.12.12
Compare Source
Improvements 🔧
uppercase-string
PHPDoc type (#3613), thanks @pmjones!Bugfixes 🐛
sprintf
dynamic return type (#3640), #12065, thanks @VincentLanglet!f61d3247db
), #12076static
return type in php-8-stubs (162f774858
), #12077non-empty-list
(#3682), #12131, thanks @herndlm!Function signature fixes 🤖
Closure::bind
andbindTo
return benevolent union with null (b049d8d7d7
)sha256
function definition (#3664), thanks @VincentLanglet!v1.12.11
Compare Source
Improvements 🔧
fidry/cpu-core-counter
(#3632), https://github.com/phpstan/phpstan/discussions/12026TypeCombinator::removeTruthy()
method (#3633), thanks @canvural!$a != ''
(#3304), thanks @thg2k!Bugfixes 🐛
self::
in a class attribute argument (3447391001
), #12011, #10314f158d5bf32
), #12015null
toarray_map(null, $a, $b)
(#3562), thanks @schlndh!ArrayType<mixed, X>
withcheckImplicitMixed
(level 10 in 2.0) (#3636), #12051, thanks @VincentLanglet!Function signature fixes 🤖
extract()
signature (#3512), thanks @VincentLanglet!get_defined_constants()
(#3635), thanks @thg2k!fgetcsv
acceptsnull
for$length
(#3077), thanks @staabm!v1.12.10
Compare Source
Bugfixes 🐛
for
endless loop detection (#3622), #11992, thanks @herndlm!379b9a230e
)v1.12.9
Compare Source
Improvements 🔧
@readonly
PHPDoc on the class as alternative to@immutable
(#3523), #11775, thanks @herndlm!Bugfixes 🐛
for
endless loops (#3573), #6807, #8463, #9374, thanks @herndlm!preg_match
greater than0
(#3612), #11293, thanks @staabm!5f0b1ccfa4
), #11980void
return type in a union when the returned expr is originallyvoid
(80c1df2d73
), #11980@phpstan-ignore
with trait in the same file (381c1370e7
), #11981Internals 🔍
ccfb4ab7a1
)v1.12.8
Compare Source
Improvements 🔧
a07996a9ca
)537c12c0c3
), #1191316f63b3a48
),c04555b938
)4dfbe16ed9
)deef919837
)Bugfixes 🐛
$this
in return type even in final classes (#3599), #11857, thanks @calebdw!E_DEPRECATED
from error_reporting (277e34b23a
), #11937filterTypes()
(#3535), #11663, thanks @VincentLanglet!Function signature fixes 🤖
Imagick::writeImage(s)File
supportingformat
parameter (#3588), thanks @kingjia90!Internals 🔍
instanceof ConstantBooleanType
in loop analysis (#3577), #11913, thanks @herndlm!1a0099dc61
)@api
to TypeExpr (#3601), thanks @ruudk!UnionType::filterTypes
(#3607), thanks @VincentLanglet!v1.12.7
Compare Source
Major new features 🚀
Improvements 🔧
-vvv
) to very verbose (-vv
) mode (#3345), thanks @janedbal!non-empty-array
andnon-empty-list
array shape kind (107a7e38e2
)34bacd7441
)dc5d8f4d3e
), #11799, #10421Bugfixes 🐛
c4ba43462c
), #11819array_reverse()
with optional keys (#3406), #11549, thanks @herndlm!dcd69eba14
), #1182640e461d2e8
)Function signature fixes 🤖
get_defined_vars()
(#3546), thanks @janedbal!getAttributes
returnslist
(#3548), thanks @ManuelHu!Internals 🔍
5b43d50046
)PHPStan\dumpPhpDocType()
(#3559), #11561, thanks @zonuexe!a815d575dc
)v1.12.6
Compare Source
Bleeding edge 🔪
@phpstan-assert
PHPDoc tags (ca0a7e9955
), #11780If 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
: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 🔧
0b9ce98cfa
)ClassConstFetch::$class
when it's a Name node (712c33e02e
)ClassConstFetch::$name
(b38c852c7c
)Bugfixes 🐛
lowercase-string
IntegerRangeType::toString()
(#3475), thanks @staabm!3cdac94e67
), #11786Function signature fixes 🤖
spl_autoload_functions
on PHP8.0+ (#2810), thanks @ManuelHu!Internals 🔍
3a83f6bec7
)Scope::getMaybeDefinedVariables()
(#3521), #11772, thanks @ruudk!Type::sliceArray()
(#3514) (#3514), thanks @herndlm!v1.12.5
Compare Source
Improvements 🔧
ParametersAcceptorSelector::selectSingle()
(23c53a2210
)lowercase-string
(#3438), thanks @VincentLanglet!toInteger()
(#3434), thanks @staabm!MixedType::toString()
with subtracted type (#3420), thanks @staabm!MixedType::toBoolean()
with subtracted type (#3471), thanks @staabm!isset($arr[$k])
should narrow$k
(#3453), #11716, #8559, thanks @staabm!isset()
narrows string-key in int-keyed-array to numeric-string (#3472), thanks @staabm!Bugfixes 🐛
098fb94167
), #11738sprintf()
inference for constant values with format-width in pattern (#3474), thanks @staabm!filter_var()
(#2656), thanks @mvorisek!Function signature fixes 🤖
iptcparse
return type (#3483), thanks @ManuelHu!Internals 🔍
0e2587fae6
)1bea5c79d5
)selectSingle()
when analysing function body in rules (41916ba39d
)selectSingle()
in MutatingScope (865c618f82
)ParametersAcceptorSelector::selectFromArgs()
instead ofselectSingle()
wherever possible (e283d3a6df
)7e216a274f
)selectSingle()
in ParametersAcceptorSelector (1322aaf1d0
)@internal
getOnlyVariant()
method on FunctionReflection/ExtendedMethodReflection to use instead ofselectSingle()
(714877be8c
)Type::chunkArray()
(#3408), thanks @herndlm!5677025877
)v1.12.4
Compare Source
Improvements 🔧
475a18ce8e
), #11641argument.named
are ignorable now (193b4f518d
)composerAutoloaderProjectPaths
on Windows (#3451), thanks @staabm!05630e67fa
)treatPhpDocTypesAsCertain
tip (#3452), #11689, thanks @ruudk!Bugfixes 🐛
array_map()
return value (#3425), #10715, #11056, #10685, thanks @rvanvelzen!fd25c2779c
), #11665, thanks @VincentLanglet!range()
on PHP 7.x (#3424), thanks @staabm!d3a2a92fcd
), #11667, #878100d2caf395
), #11617, #5077, #9361, #7251, #2313, #11655, #2634range()
with float step should return an array of floats (#3447), #11692, thanks @staabm!*strlen()
with positive-int (#3407), #11558, thanks @staabm!cb8f9103f4
)Function signature fixes 🤖
9d9fb56090
)Internals 🔍
d047c7f8ef
)paratest
(#3440), thanks @schlndh!Output::isDecorated
andOutput::isVeryVerbose
(#3436), thanks @ruudk!2d613997f5
)v1.12.3
Compare Source
Improvements 🔧
9815bbba45
)Bugfixes 🐛
6973519742
), #11638ArrayFilterFunctionReturnTypeReturnTypeExtension
and support first-class callable (#3329), #11337, thanks @takaram!list<T>
toarray{T}
(#3412), #11642, thanks @staabm!052f6b130f
), #11649e3e80f6c9c
), #11657Function signature fixes 🤖
curl_init()
false returns (#3409), #11640, thanks @tscni!Internals 🔍
COMPOSER_ROOT_VERSION
hack should no longer be necessary (#3414)v1.12.2
Compare Source
Improvements 🔧
9bd027c563
), #11413Bugfixes 🐛
@mixin
class reflection extensions after all other class reflection extensions (c889baa9ec
), #11624, #11342, #10159, https://github.com/larastan/larastan/issues/2032count()
withpositive-int
(#3389), thanks @staabm!Type::reverseArray()
(#3344), thanks @herndlm!Function signature fixes 🤖
version_compare()
operator arg can be null (#3399), #4457, thanks @staabm!Internals 🔍
v1.12.1
Compare Source
Bleeding edge 🔪
@method
@template
tags above traits (aadbf62d3a
)@mixin
PHPDoc tag above traits (0d0de94690
)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
: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 🔧
(bool) $expr
like$expr != false
(#3380), #8881, #7685, #6006, #10528, thanks @staabm!(string) $expr
like$expr != false
(#3387), thanks @staabm!(int) $expr
like$expr != false
(#3384), thanks @staabm!(float) $expr
like$expr != false
(#3391), thanks @staabm!085fcf40fe
)@mixin
above traits (f5e2e32932
)Bugfixes 🐛
array_filter
with callback optional persistance (#3366), #11570, thanks @robotomarvin!strlen() ==
and===
comparison with integer range (#3342), #11548, thanks @staabm!get_debug_type
produces wrong type for anonymous classes with parent (#3374), #11562, thanks @patrickkusebauch!preg_replace()
return type (#3338), #11547, thanks @staabm!static
in PHPDoc tags above traits as an error (777a82a0dc
), #11591$
-only case (#3394), #11622, thanks @staabm!c50b71fd96
), #11592@param-out
variable after assignment (5892e8debf
), #11580, #6642Internals 🔍
PHPStan\debugScope()
(5909fb2dc7
)47a85bf145
)c47730f1f9
)57ccd8c4d4
)ba591420c2
)v1.12.0
Compare Source
Read all about PHPStan 1.12 on phpstan.org »
Major new features 🚀
$matches
frompreg_match
generally available, out of bleeding edge (bd2cec1185
)Bleeding edge 🔪
@no-named-arguments
(74ba8c2369
), #59687453f4f75f
)22eef6d5ab
)@param-out
(30c4b9e80f
), #10260@param-closure-this
(2fa539a39e
), #10933@param-closure-this
(95c0a5806c
), #10932@param-immediately-invoked-callable
and@param-later-invoked-callable
(580a6add42
), #10932@phpstan-self-out
(6838669976
)@phpstan-self-out
(892b319f25
)ce7ffaf02d
)2485b2e9c1
)5f7d12b2fb
)5a2d4416d9
)@mixin
(3175c81f26
)@property
tags (55ea2ae516
), #10752, #9356@method
tags (5b7e474680
)@extends
,@implements
,@use
for unresolvable types (2bb528233e
), #11552If 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
: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 🔧
final
,@api
classes made@final
(#3264,5baa146510
)PhpParser\Node\Stmt\Class_::isAnonymous()
(#3343), thanks @tscni!curl_init()
return type analysis (#3346), thanks @tscni!7fc5ab8dfb
)@phpstan-self-out
above static method (0dfd821769
)@phpstan-self-out
(e182c0662d
)@phpstan-self-out
(9ebc315589
)3e51899dd7
) - allowed in default parameter values in@method
Bugfixes 🐛
6c4477c9fc
)strlen()
on integer range (#3337), thanks @staabm!count()
with integer range (#3335), thanks @staabm!4ffbb3b126
)Internals 🔍
7d1bde44af
)d631120bea
)fe503cad77
)d65138a11f
)highlight_string()
stub with a return type extension (#3350)v1.11.11
Compare Source
Improvements 🔧
58d202fddc
)Bugfixes 🐛
in_array()
(#3319), #9436, thanks @VincentLanglet!9439bba420
), #11506AccessoryLiteralStringType::setOffsetValueType()
(93c5226cb5
)AccessoryNonFalsyStringType::setOffsetValueType()
(c28c936237
)07d6405883
), #11518count()
(#3309), thanks @staabm!Function signature fixes 🤖
Internals 🔍
v1.11.10
Compare Source
Bleeding edge 🔪
preg_replace_callback()
$matches
(#3281), thanks @staabm!9718c14f1f
)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
: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 🔧
(?)
(39649c2b9d
,be65babffe
), #11436reportUnmatchedIgnoredErrors: false
(b7fe9900d5
), #11436count()
with array size (#3302), thanks @staabm!Bugfixes 🐛
ConstantArrayType::isSuperTypeOf()
for empty array (ed6bc0b934
)Function signature fixes 🤖
Internals 🔍
9246976958
)preg_match()
array shape tests (#3290), thanks @staabm!v1.11.9
Compare Source
Bleeding edge 🔪
e19e6e5f8c
), #10299preg_match_all()
$matches (#3256), 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
: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 🔧
582a0f8a74
), #11393Bugfixes 🐛
abs()
return type (#3263), #11367, thanks @julienfalque!Internals 🔍
v1.11.8
Compare Source
Bleeding edge 🔪
var_export
without$return=true
(#3225), #11320, thanks @staabm!04f8636e65
)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
: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 🔧
$matches
frompreg_match()
improvements:(\d*)
can be empty-string (#3257), thanks @staabm!diagnose
command to run DiagnoseExtensions (22c84d2e64
)db71f04aa1
)76464eed45
)c7c9689cd8
)09fbc92c41
), #11297sprintf()
inference (#3232), thanks @staabm!-v
(#3239, #3242), thanks @janedbal!sprintf()
format arg-based return type (#3192), #11248, #10493, thanks @staabm!Bugfixes 🐛
44e40f0545
), #11313pathinfo()
return type for union type flags (#3120), #10760, thanks @staabm!2cc6cda696
)pow()
lead to error (#2796), #10125, thanks @staabm!f1abacddb3
), #11361c9a6d2e61e
), #6585Function signature fixes 🤖
Internals 🔍
1245ea73e5
)@api
(#3240), thanks @janedbal!bacb3c6d11
)e71cff468a
)27e0f91efa
)v1.11.7
Compare Source
Improvements 🔧
match
expression analysis with enum with performance in mind (b98abe01ca
), #11263d55933fa0c
)-vvv
CLI option.979055fcee
)-vv
for unignorable errors when generating the baseline (d931c89875
), #39732c08dfa8d0
), #11283MutatingScope::resolveType()
- cache closure body analysis data (fd3115652b
), #11283Bugfixes 🐛
@no-named-arguments
above class (815270d893
), #11275count()
narrowing on $matches (#3210), #11277, thanks @staabm!25658f64f0
), #11269, #11251Function signature fixes 🤖
getimagesize
,getimagesizefromstring
: zero is a possible value for height and width (#3207), thanks @mfruehauf!Internals 🔍
ObjectType::getEnumCases()
(#3203, #3204), #11263, thanks @staabm!v1.11.6
Compare Source
Bleeding edge 🔪
preg_match()
for$matches
by-ref parameter (#2589), thanks @staabm!$mode
parameter for thecount()
(#3190), thanks @kuma3!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
: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 🔧
a99c71e3be
)6e700418d6
)30f68ba755
)4f75ba6bdc
,9967f48574
)Bugfixes 🐛
%s
format (#3167), #11201, thanks @pilif!UnitEnum::cases()
return type (32f351a24c
), #11244, #1123307995276ab
), #11246, #9879, thanks @jdecool!Function signature fixes 🤖
WeakMap::offsetGet()
(#3165), #11194, thanks @sonnymilton!getimagesize*
return type (#3183), thanks @staabm!Internals 🔍
Type::isSuperTypeOf()
(#3164), #11194, thanks @staabm!v1.11.5
Compare Source
Bleeding edge 🔪
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
: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 🔧
aa921137be
)Bugfixes 🐛
get_debug_type()
DynamicFunctionReturnTypeExtension (#3128), thanks @patrickkusebauch!Function signature fixes 🤖
gnupg_init()
options
parameter is optional (#3129), thanks @yphoenix!RedisCluster::__construct
signature (#3130), #11158, thanks @wolfgangzwiauer!AMQPQueue::unbind()
routingKey type (#3143), thanks @ben-challis!AMQPQueue::consume()
callback (#3144), #9445, thanks @ben-challis!IntlDateFormatter
methods (#3149), thanks @chosten!Exception::getTrace()
return type (492cd89932
)Internals 🔍
PrepareCommand::fixComposerJson()
(4537ef1445
)7cd03f02a5
)f76d836d13
)f6b989881e
)lint >=
andPHP_VERSION_ID
in NodeScopeResolverTest (b530b0d53d
)TypeInferenceTestCase::gatherAssertTypesFromDirectory()
(595de78d35
)v1.11.4
Compare Source
Improvements 🔧
--generate-baseline
combined with--pro
(dd028cb4cc
), #110937af14fbfc0
)phpstan/extension-installer
v1.4 (1d005ef1e7
)Bugfixes 🐛
numeric-string
types after string concat (#3117), thanks @staabm!count()
(#2812), thanks @staabm!array_slice()
returnsnon-empty-array
for existing offsets and positive limit (#3124), #10721, thanks @staabm!ClosureType()
as maybe impure by default when no$impurePoints
array provided (#3125), #11135, thanks @jf-m!Function signature fixes 🤖
tempnam()
andtmpfile()
to benevolent union (#3111), thanks @zonuexe!gnupg_init
function (#3118), thanks @pistej!Internals 🔍
react/promise
(da754e2294
)v1.11.3
Compare Source
Improvements 🔧
*ParameterClosureTypeExtension
(#3089), thanks @canvural!get_debug_type
function (#2910), #10558, #10585, thanks @patrickkusebauch!explode
return type precision (#3096), thanks @staabm!Bugfixes 🐛
array_map
argument take into account unpack (#2901), #10527, thanks @ryium!parse_url
(#2918), #4754, thanks @ChrisBrenton!$http_response_header
is alist<string>
(#2959), thanks @Seldaek!str_repeat()
(#2914), #10572, thanks @staabm!in_array
is not strict (#2539), #9662, #10228, thanks @staabm!substr()
type narrowing for possibly single char result (#3081), #11035, #9804, thanks @staabm!$this
cannot be reassigned when passed by reference (#3097), #10477, thanks @takaram!constant('')
(#3013), #10867, thanks @staabm!Function signature fixes 🤖
SplFileObject::fgets()
(#3103), thanks @DanielSiepmann!Locale
signatures (#2880), #7855, #8149, thanks @devnix!fread()
length parameter type and return type (#3105), thanks @thg2k!dae9335075
), #10839non-falsy-string
(#3108), thanks @schlndh!Internals 🔍
TemplateTagValueNode::$name
cannot be empty string (fcaefacf2d
), thanks @staabm!v1.11.2
Compare Source
Improvements 🔧
@phpstan-ignore
identifiers parser (#3079, #3090, #3091), thanks @janedbal!@phpstan-ignore identifier (comment), identifier2 (comment2)
$passedToType
frominFunctionCallsStack
(ca41b7d8c2
,da4fd7a412
), #5508, #10254, #107327e9cd45701
), #9086Function signature fixes 🤖
Internals 🔍
nette/di
(2ab647e12f
)array_filter
callbacks (754b7b8e17
)@api
annotation toAcceptsResult::__construct
(#3092), thanks @canvural!v1.11.1
Compare Source
Improvements 🔧
sprintf()
constant result inference (#3075), thanks @staabm!Bugfixes 🐛
impure(Function|Method).pure
if it has@phpstan-assert
tags (9544f8a6b5
)d603c7b676
), #11000reportPossiblyNonexistentConstantArrayOffset: true
(5277630459
), #10997bb3da26d56
), #110271d02c4f276
)fe3895ada9
), #11026702ddcd780
), #1100135ff6895f4
), #110011116e03389
), #10985self
andstatic
in@phpstan-closure-this
from trait stub file (93402494ee
), #11009ee33f1e48b
), #11011Function signature fixes 🤖
uri
instream_get_meta_data
calls is always present on PHP 8.3+ (885d46bc8d
), #11024, #10999v1.11.0
Compare Source
Read the article about PHPStan 1.11 on phpstan.org »
Major new features 🚀
@phpstan-ignore
comment (uses current or next line automatically)ignoreErrors
section of your configuration file (phpstan.neon)-v
@phpstan-ignore-line
and@phpstan-ignore-next-line
to the new@phpstan-ignore
comment style with error identifiers. The old comment style is dangerous because it ignores all errors, current and future, on that line.ignoreErrors
, from your baseline and also ignored locally in source code using comments--pro
CLI option@param-immediately-invoked-callable
,@param-later-invoked-callable
@phpstan-pure
@param-closure-this
to describe what$this
is bound to in a passed closurereportPossiblyNonexistentGeneralArrayOffset
reportPossiblyNonexistentConstantArrayOffset
Bleeding edge 🔪
@phpstan-pure
above functions and methodsnew
/function call/method call/static method call on a separate line without any side effects even without@phpstan-pure
PHPDoc tag on the declaration side281a87d1ab
a6470521b6
), #10389@param-out
(56b2002438
)b116d25a6e
)969e6fa31d
)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
: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 🔧
9a3ed85178
)checkMissingIterableValueType: false
andcheckGenericClassInNonGenericObjectType: false
in favour of ignoring via identifiers (a64998108b
)109083571d
)dc3b75ab4a
)new
type (#3050), #9704, thanks @ruudk!d004c23967
)3e498e1592
)f66cf5badd
), #12054b32cac2d1
)RuleErrorBuilder::file()
- file path needs to exist (c453f29f60
)b5dd34e492
)$this
and used variables after invoking closure (#2980)@phan-
prefixes on recognized PHPDoc tags (#3000), thanks @anomiex!pure-callable
andpure-Closure
PHPDoc types (cdaff5f00d
)highlight_string()
flips side-effects depending on $return (#3021), thanks @staabm!Bugfixes 🐛
AccessoryNonFalsyStringType::toInteger()
returnIntegerType
instead of non-zero (#3018), #10893, thanks @zonuexe!polluteScopeWithAlwaysIterableForeach
(#3029), #10922, thanks @VincentLanglet!count($x) > $n === true
negation (#3037), #10952, thanks @rvanvelzen!new
with wrong name case (59ac31a554
)b5c63c2967
)preg_match_all
behaviour with no flags (a856ec7ab5
)file_get_contents
is an impure function (2b5b3174c7
)ClosureType::equals()
(29c35b584a
)70a75f6889
)exceptions.implicitThrows: false
(#3016), thanks @janedbal!ConstantArrayType::hasOffsetValueType()
for offset union type where all types are valid (26e949b0d0
)non-empty-list
always has offset 0 (f4d1d48147
)non-empty-string
/non-falsey-string
aftermb_strlen()
(#3038), thanks @staabm!Type::isOffsetAccessLegal()
to detect offset access that crashes even inisset()
(#3045), #8393, #10926, thanks @rajyan!match()
condition correctly (#3053), #10974, #9694, thanks @rvanvelzen!json_decode
with force array flag: subtract all objects, not just stdClass (#3052), thanks @rajyan!strlen($x) > $n === true
negation (#3040), thanks @staabm!Continue_
points should not be used forwhile (true)
(#3057), #10980, thanks @greew!Function signature fixes 🤖
stream_get_meta_data()
optional (#3024), #10887, thanks @hirokinoue!Closure::bind
$newScope
param (#2817), thanks @mvorisek!Imagick::identifyImage()
return type (#3017), thanks @SVillette!Internals 🔍
c476a8611d
)017d321f47
)ClassReflection::getClassTypeDescription()
(dec9e435a7
)e7ab4f741c
)d1834e69d0
)38e2c96ee4
)d026655260
)RuleErrorBuilder::treatPhpDocTypesAsCertainTip()
for a bit more DRYness (#3035), thanks @axlon!39ce042573
), #10979v1.10.67
Compare Source
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 🔧
Bugfixes 🐛
date()
return types (#2888), #10468, #6613, thanks @zonuexe!b2177e350f
), #983924c52494be
), https://github.com/phpstan/phpstan/discussions/102858ae0b28a5c
)e606fbedae
), #108334a4c739f9f
), #10863get_defined_vars()
as using constructor arguments (#3012), #10865, thanks @rvanvelzen!7f8f9cce7f
,7961f7ae1f
), #1916Function signature fixes 🤖
gc_status()
signature for PHP8.3+ (#2996), thanks @staabm!mysqli_result::fetch_fields
(#3005), thanks @schlndh!Internals 🔍
v1.10.66
Compare Source
Improvements 🔧
986cbdfb2f
), #10789da87a6541f
), #10757Bugfixes 🐛
array_push
preserves list (5473b6701c
)Function signature fixes 🤖
redis::get
signature (#2990), thanks @VincentLanglet!Internals 🔍
v1.10.65
Compare Source
Improvements 🔧
Bugfixes 🐛
94ca1336c5
), https://github.com/larastan/larastan/pull/1882d6153d513e
)Function signature fixes 🤖
Internals 🔍
TrinaryLogic::describe()
in test (222a66cdbf
)v1.10.64
Compare Source
Bleeding edge 🔪
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
: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 🔧
ForbiddenClassNameExtension
for append additional forbidden class prefixes (#2979), thanks @kamil-zacek!AlwaysUsedMethodExtension
(#2927), thanks @axlon!9338fdfe16
)Bugfixes 🐛
Function signature fixes 🤖
DOMDocument::load
return type (#2975), thanks @VincentLanglet!SplObjectStorage::removeAll/Except
(#2892), thanks @schlndh!v1.10.63
Compare Source
Improvements 🔧
7ceeb21950
,063f6a866c
)Bugfixes 🐛
969ff31ab2
), #10727fc4e5891f7
), #9246getIterableKeyType()
, it preserves array-key (d5bf23b18f
), #9307Function signature fixes 🤖
exec()
(#2974), thanks @VincentLanglet!Internals 🔍
AnalyserIntegrationTest->runAnalyse()
(#2960), thanks @staabm!ReflectionProvider::hasClass()
narrows$className
arg (#2976), thanks @staabm!v1.10.62
Compare Source
Improvements 🔧
de1c07ea68
)Bugfixes 🐛
@param-out
work even if it is the only conditional type in a function signature (787c1e2b46
)19497ba031
)27c73f7f67
)@param-out
- fix for conditional types (5a4789339e
)v1.10.61
Compare Source
Improvements 🔧
final
modifier in traits (https://github.com/Roave/BetterReflection/pull/1383), thanks @kukulich!@param-out
(effad95da5
), #10699@param-out
(67f9420cba
)Bugfixes 🐛
@param-out
type - consider all execution ends at once (d1bcf786ee
), #10687, #10684Internals 🔍
3cc1a54564
)v1.10.60
Compare Source
Learn more about this release in an article on phpstan.org!
Major new features 🚀
@method
tags:@method T doFoo<T>(T $p)
, #6371callable<T>(T): T
, #8964Bleeding edge 🔪
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
: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 🔧
Bugfixes 🐛
c10476d268
)039a3dc135
), #10614$a?->b::c()
and$a?->b::$c
(#2933), thanks @schlndh!fn() => __FUNCTION__
and__METHOD__
(#2934), thanks @schlndh!034f731306
,0977a7b025
), #10627ad34452cb1
), #10628T of mixed&Foo
andT of mixed|Foo
(#2940), thanks @schlndh!isSuperTypeOf
of callable/Closure when parameter count differ (#2949), #10594, thanks @takaram!Function signature fixes 🤖
ReflectionFunctionAbstract::getExtension
return type (2ece1f82b0
)date_sun_info()
function (#2947), thanks @zonuexe!mysqli get_warnings
(#2929), thanks @janedbal!Internals 🔍
Type::isNull()
inNullsafe(MethodCall|PropertyFetch)Rule
(#2942), thanks @takaram!v1.10.59
Compare Source
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
: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 🔧
treatPhpDocTypesAsCertain
(f5b198c980
)17e5bac093
)b0261263e2
)settype()
(#2920), thanks @ChrisBrenton!Bugfixes 🐛
299df5130a
), #105732fb66328fd
), #10577Internals 🔍
FunctionReflection::isPure()
andExtendedMethodReflection::isPure()
(03d01eae4a
)v1.10.58
Compare Source
Improvements 🔧
unset
(aeadbe28e0
), #10506, #6773Bugfixes 🐛
@phpstan-require-extends
(#2890), #10475, thanks @RobertMe!sort()
,rsort()
andusort()
convert an array to list (#2891), #6467, #10423, #3312, thanks @takaram!T<X>
whereT
bound consist of intersection type (778b569999
), #10509[1 => 'method', 0 => $obj]
as callable (#2896), #10502, thanks @staabm!51cffd49dc
), #10538@phpstan-assert
PHPDoc inheritance with generics (#2909), #10037, #9123, thanks @RobertMe!Internals 🔍
isSuperTypeOf()
calls (#2895), thanks @staabm!ClassPropertiesNode->getUninitializedProperties()
(#2899), thanks @staabm!v1.10.57
Compare Source
Bleeding edge 🔪
mixed
type based on config (#2885), thanks @schlndh!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
: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 🔧
ClassReflection::getConstant()
return type (8d4ea60a57
)ClassConstantReflection
with BC promise (8f82b799c5
)Bugfixes 🐛
8342785e39
), #10445array_filter
callback return type (59ae706f13
)2d364d781c
), #86296363932c56
)@template
type in method call (11268e5eeb
), #10473Function signature fixes 🤖
curl_multi_init()
cannot return false (#2882), thanks @staabm!error_log()
is impure (#2884), thanks @staabm!v1.10.56
Compare Source
Major new feature 🚀
@phpstan-require-extends
,@phpstan-require-implements
, #10302, #9899, #8550, thanks @staabm!@property
PHPDoc above interfaces work on PHP 8.2+Improvements 🔧
b87e5c4c7e
), https://github.com/phpstan/phpstan-deprecation-rules/issues/107Bugfixes 🐛
match
arm condition before analysing the body (2b74aa85b8
), #10418Function signature fixes 🤖
Yaf_Response_Http::__clone
(#2863), thanks @PrinsFrank!transliterator::listIDs
return type (#2865), thanks @PrinsFrank!strtok()
always returns anon-empty-string
when it does not return false (#2869), thanks @staabm!Internals 🔍
Type::getConstantArrays()
(#2864), thanks @staabm!Scope::getFunctionType()
(#2872), thanks @staabm!v1.10.55
Compare Source
Improvements 🔧
@phpstan-ignore-next-line
works for first line below the PHPDoc even in bleeding edge (8b6260c21b
), #10383, https://github.com/phpstan/phpstan/discussions/10374open-resource
type (bbd9a68478
), #103999dac90dfd5
), #10401, thanks @zonuexe!Bugfixes 🐛
22700511d9
), #10377Internals 🔍
@phpstan-require-extends
and@phpstan-require-implements
(#2856), thanks @staabm!Scope::getFunctionCallStack()
(9be137675e
), https://github.com/phpstan/phpstan-deprecation-rules/issues/106v1.10.54
Compare Source
Bleeding edge 🔪
02f66df2a2
), #10385If 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
: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 🔧
Bugfixes 🐛
a81df66485
)af14d50e2b
), #10373v1.10.53
Compare Source
Improvements 🔧
str_increment
/str_decrement
return type extension (#2776), thanks @zonuexe!Bugfixes 🐛
3e7c7c7c63
), #10387array_udiff()
comparator return type is too strict (#2822), #9697, thanks @staabm!Internals 🔍
v1.10.52
Compare Source
Improvements 🔧
78ea9a6210
)c997ea9eef
)Bugfixes 🐛
21df2d347a
), #10375v1.10.51
Compare Source
Bleeding edge 🔪
25d15526db
), #10298RecursiveIteratorIterator::__construct()
parameter types (#2835), 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
: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 🔧
0359ebc78f
)402024091b
)816be99361
)Bugfixes 🐛
ReflectionEnum::getBackingType()
afterReflectionEnum::isBacked()
(#2830), #10167, thanks @staabm!??
type inference (d801919e35
), #10327Internals 🔍
ondrejmirtes/simple-downgrader
436bd791bf
,7eb66f6bd6
,bf0b138fbe
), #5086str_starts_with()
andstr_contains()
instead ofstrpos()
(#2841), thanks @zonuexe!995de26a4b
)ParametersAcceptorSelector::combine()
(#2851), thanks @staabm!v1.10.50
Compare Source
Improvements 🔧
nikic/php-parser
to 4.18.0 (24f92cc2a6
)Bugfixes 🐛
VoidType
- acceptnull
(40c8fb2266
), #10291Internals 🔍
InvalidPromotedPropertiesRule
- useFunctionLike
as node type (#2823), thanks @paulbalandan!39fe102d23
)v1.10.49
Compare Source
Bleeding edge 🔪
GenericObjectType
(#2818, #2821)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
: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 🔧
void
return tonull
after call (#2778), #6720, thanks @herndlm!Bugfixes 🐛
count(list)
regression (#2813), thanks @staabm!01aabcff33
)Function signature fixes 🤖
SimpleXMLElement
method return types benevolent (when they returnstatic|null
) (fb76c9f7d3
)v1.10.48
Compare Source
Bleeding edge 🔪
c30e9a484c
)3a12724fd6
,3b011f6524
), #7539xor
because that's probably not what the user intended to do (a1fffb3346
), #10267and
andor
(1d8fff637d
)9664f7a9d2
)&&
and||
(cf2c8bbd9e
)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
: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 🔧
ReflectionEnum::getName()
afterReflectionEnum::isBacked()
(#2806), #10192, thanks @franmomu!0a3a968b86
), https://github.com/phpstan/phpstan/discussions/10252Bugfixes 🐛
942afbf060
)e0eb85028d
)count()
results in type loss (#2811), #10264, thanks @staabm!fa5d5f958b
)Function signature fixes 🤖
SimpleXMLElement::addChild
(#2808), #10269, thanks @DaveLiddament!v1.10.47
Compare Source
Improvements 🔧
ExpressionTypeResolverExtension
(#2789), thanks @janedbal!ExpressionTypeResolverExtension
in API ReferenceBugfixes 🐛
array_filter
- handle error types (#2794), #10189, thanks @mglaman!if ($var ?? null)
(c2ba3415a8
), #102244c4f22f131
), #10184Function signature fixes 🤖
Redis::hMset
(#2793), thanks @Vaalyn!v1.10.46
Compare Source
Improvements 🔧
isset()
and ternary operator handling (#2710), #3632, #8190, #8366, #8659, #9580, #10064, #10088, thanks @staabm!b17d529076
)Bugfixes 🐛
8234dc0b34
), #10212aec0406811
)758e5f118a
), #7890Internals 🔍
isSuperTypeOf()
(#2788), thanks @staabm!v1.10.45
Compare Source
Improvements 🔧
enum_exists()
arg to UnitEnum (#2764), #10169, thanks @staabm!Bugfixes 🐛
isSuperTypeOf()
(#2772, #2787), #9778, #9723, #6407, thanks @staabm!c238fe77f7
)in_array
- simulate Identical/Equal handling from TypeSpecifier for literal arrays (0177e332f2
), #10201Function signature fixes 🤖
Redis::restore
(#2765), thanks @Vaalyn!str_increment
andstr_decrement
into functionMap (#2777), thanks @zonuexe!ext-mongodb
1.17 (#2768), thanks @alcaeus!Internals 🔍
in_array()
instead of redundant property (#2770), thanks @zonuexe!MethodVisibitiliyInInterfaceRule
(#2781), thanks @staabm!return null
(#2782), thanks @zonuexe!v1.10.44
Compare Source
Improvements 🔧
02b2e3d088
)list<array{id: int}>
tomixed[]
(#2760), thanks @janedbal!Bugfixes 🐛
Carbon
PHPStan extension (#2762), thanks @CalebDW!SoapClient
old-style constructor (7765768fd5
), #10165be2b415283
(85fcd5f35e
), #10166Function signature fixes 🤖
setcookie
/setrawcookie
(#2752), #10171, thanks @schlndh!v1.10.43
Compare Source
Improvements 🔧
phpstan/phpdoc-parser
ReflectionEnum
generic (9ce8faf53c
)Bugfixes 🐛
??=
with scope before the expression (846f44ee6e
), #10151, #10131stdClass
does not have__get
method (baf359ea3c
), #10149be2b415283
), #10153universalObjectCratesClasses
allow dynamic properties (2ec416e112
)93af41bf52
), #10147Internals 🔍
v1.10.42
Compare Source
This release closes 25 issues! 🎉
Major new features 🚀
#[\Override]
attribute (e9a563993f
) (RFC)checkMissingOverrideMethodAttribute
(https://phpstan.org/config-reference#checkmissingoverridemethodattribute) (ac4d3de8df
)Bleeding edge 🔪
@final
method in OverridingMethodRule, #91355fd8cee591
)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
: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 🔧
f94a3c365e
)dynamicConstantNames
(cb9571b5c0
)4b2ffb82f1
), #10101, #7541, #10043, #7859, #8081, #8500, #90142df14af6e1
)--debug
(c534f8cc79
)394064bb33
), #10039Bugfixes 🐛
non-empty-string
instr_shuffle()
(#2717), thanks @staabm!ReturnTypeWillChange
or not (eb0c7a1308
), #961500adfaa7d1
,00a9d94685
)Function signature fixes 🤖
mailparse_msg_get_part()
(#2722), thanks @jlherren!iptcparse
return type (#2727), thanks @ManuelHu!Internals 🔍
8cd239e1fb
)#[\Override]
attribute in error messages (#10136), thanks @TimWolla!f384b43c91
)v1.10.41
Compare Source
Bugfixes 🐛
a849f06ff5
), #10071, #9394, #6922===
andmatch
condition (01deed63e0
), #10084e705f09a6a
)bab47eacdc
)Function signature fixes 🤖
Internals 🔍
MutatingScope::debug()
- add info about conditional expressions (80782fb84d
)v1.10.40
Compare Source
Improvements 🔧
self
because they're not usable (c6fad644c7
), #10049Bugfixes 🐛
!==
with union of constants (#2700), #10002, thanks @schlndh!declare(ticks=...)
(eb39381d2a
), #100591308c520e7
), #10049Function signature fixes 🤖
\
from DateTimeZone in functionMap (#2693), thanks @simPod!Redis::pconnect
to have 7 parameters (#2695), thanks @Vaalyn!Internals 🔍
TypeSpecifier::resolveIdentical
(#2700), thanks @schlndh!in_array()
(#2698), thanks @zonuexe!v1.10.39
Compare Source
Improvements 🔧
d6a576adcd
)pro.tmpDir
config parameter (4a952068df
,7c4ef6b2aa
)Bugfixes 🐛
??=
with=== null
(f407ac69ba
)b9d9626647
), #9974isset
check (6fbd6e48b8
), #9991749126094d
)array_filter
(0228643a90
), #9994d5c599c962
), #10023Function signature fixes 🤖
SQLite3::openBlob
(#2668), thanks @rodrigoq!number_format
return fromstring
tonon-empty-string
(#2678), thanks @devnix!v1.10.38
Compare Source
Improvements 🔧
Bugfixes 🐛
4dd0f2bb17
)0b8dca74e5
), https://github.com/phpstan/phpstan/discussions/9927c45d42dd1d
)746de74c5c
), #9985Internals 🔍
isset
checks (#2664), thanks @staabm!processArgs
(52eb6f8e5f
)adbc35a1c7
)v1.10.37
Compare Source
Bugfixes 🐛
__invoke
method (#2502), #6233, thanks @VincentLanglet!135a394e2f
), https://github.com/nunomaduro/larastan/issues/1749v1.10.36
Compare Source
Improvements 🔧
--json
option (91a0002402
)reportUncheckedExceptionDeadCatch
option (defaults totrue
) (#2648), #9921, thanks @VincentLanglet!array_chunk()
(#2635), thanks @staabm!2b9af363a3
)Bugfixes 🐛
Function signature fixes 🤖
connection_*
functions are impure (#2555), thanks @staabm!mysqli
andmysqli_result
classes (#2295), thanks @phansys!Internals 🔍
980ab5bba4
)getFiniteTypes()
(#2636), thanks @staabm!v1.10.35
Compare Source
Major new features 🚀
Bugfixes 🐛
value-of<...>
lazier (234f77d652
), #9881ReflectionAttribute::newInstance()
with nested class using named arguments (8d751dd38f
), thanks @enumag!Internals 🔍
c3cb573c59
)phpstan/phpstan-php-parser
(#2632), thanks @staabm!v1.10.34
Compare Source
Improvements 🔧
$this
type assertions (#2609), #8904, thanks @ekisu!$this
(https://github.com/phpstan/phpdoc-parser/pull/209), thanks @ekisu!--fail-without-result-cache
CLI option (#2611), thanks @staabm!in_array()
(#2618), thanks @zonuexe!b87db6233f
)Function signature fixes 🤖
inotify_read
(#2605), thanks @taka-oyama!Internals 🔍
95cdbe5775
)v1.10.33
Compare Source
Improvements 🔧
2be81ac1cf
)3e03e9d7c1
)Bugfixes 🐛
checkBenevolentUnionTypes: true
along with@template
witharray-key
bound (#2587), #9766, thanks @VincentLanglet!array_sum()
(#2591), #9808, thanks @zer0-star!dfcaa3082c
), #8538Function signature fixes 🤖
inotify
related function signatures (#2599), thanks @thg2k!Internals 🔍
$parentPhpDocBlock->getClassReflection()->isBuiltin()
calls (#2585), thanks @staabm!spl_object_id()
(#2592), thanks @staabm!nette/di
(#2597)v1.10.32
Compare Source
Improvements 🔧
nesbot/carbon
)379008a6a6
)v1.10.31
Compare Source
Improvements 🔧
b66210f114
)NonAcceptingNeverType
(#2540), #9133, #6485, thanks @jiripudil!--xdebug
option (3befb53be3
)Internals 🔍
4e37a2d78b
)0fbf0eed7b
)v1.10.30
Compare Source
Improvements 🔧
5f59d58b62
)Bugfixes 🐛
mixed
(cbdb30d596
), #97650501aaf259
), #9776c09be9ec0e
), #9753polluteScopeWithAlwaysIterableForeach
istrue
(853a1e693e
), #9784Internals 🔍
onlyFiles=true
(6c941aecbf
)implicitThrows
in tests (#2576), thanks @janedbal!2171717879
)v1.10.29
Compare Source
Improvements 🔧
Bugfixes 🐛
PHP_BINARY
needs to be escaped (2c7cfd8b82
)Function signature fixes 🤖
v1.10.28
Compare Source
Improvements 🔧
7c49c944c7
)Bugfixes 🐛
null
results innull
(5c40c853ff
), #97211b0c6a0166
), #96199adae6c4f8
), #9690, #967631ed326fb1
), #9699Internals 🔍
v1.10.27
Compare Source
Bleeding edge 🔪
stream_socket_client()
signature (#2519), thanks @staabm!scandir()
signature (#2518), thanks @staabm!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
: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 🔧
01294d86b8
), #6175Bugfixes 🐛
Call to end() on null
(a5e5719bcb
), #97224d77e98e15
), #9711Function signature fixes 🤖
uopz_flags
- flags are optional (917750efd8
), #9611base64_decode
overloads to PHP 8+ (#2529), #9428, thanks @dktapps!Internals 🔍
linesToIgnore
attribute format (2862a7bf79
)v1.10.26
Compare Source
Improvements 🔧
Bugfixes 🐛
array_keys()
and `array_values()`` on constant arrays (#2516), thanks @jlherren!218aad0804
), #9619553c4b141b
), #9622d8071d0904
)$foo--
with a non-numeric string no longer allowed) (c6f4c4ceb7
)97f0039fe5
)d55c4f2c20
)Function signature fixes 🤖
ftp_*
mode parameter type (#2513), thanks @staabm!DOMNode::lookupNamespaceURI
(#2527), thanks @paulbalandan!Internals 🔍
657fc54b7d
)isList
in ConstantArrayType (158c61c677
,f0a9fd796e
)a8818be2f3
,cda7e69587
)v1.10.25
Compare Source
Improvements 🔧
eafba2e091
)f4d060b688
)Bugfixes 🐛
__construct
even when renamed (4dd3f753b1
), #957765330d3be7
), #9577v1.10.24
Compare Source
Improvements 🔧
b2d2a9d08d
), #76492ebbb5303a
)Bugfixes 🐛
processCalledMethod
when anonymous classes are involved (3f5277975a
)f6ca9c88d6
), #95710bd48b4ae0
), #9571, #6856json_validate
stub only on PHP 8.3+ (8f8c1af790
), #9574Function signature fixes 🤖
session_status()
return type (#2509), thanks @staabm!v1.10.23
Compare Source
Improvements 🔧
348debc5c3
), #7198AnalyserResult::$errors
(#2400), thanks @takaram!8fe4401489
)Bugfixes 🐛
ce3c164192
), #6402a769a1c90c
), #9499c6035f3ca1
), #7198, #6039, #4758Function signature fixes 🤖
null
inmysqli*real_connect
arguments (#2508), thanks @staabm!Internals 🔍
instanceof ThisType
as it can be unreliable in case of intersection types (79359450f3
)v1.10.22
Compare Source
Bleeding edge 🔪
file()
flags args (#2476, #2482), thanks @staabm!flock()
operation flags (#2477), thanks @staabm!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
: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 🔧
constant()
(#2474), thanks @herndlm!assert()
throw type extension (#2427), thanks @patrickkusebauch!79b3034acf
)json_validate()
stub (828b269c0d
), thanks @staabm!call_user_func()
DynamicFunctionReturnTypeExtension (#2479), thanks @staabm!Bugfixes 🐛
cb5a2b4575
), #9535, #4907, #8924, #599827085c5516
), #4612989dd6fab8
), #5365, #6551, #7491, #4004, #2499faba805605
)f6b34f2ac8
), #5326Function signature fixes 🤖
db2_num_rows()
return type (#2456), thanks @morozov!ignore_user_abort()
return type (#2489), thanks @staabm!Internals 🔍
v1.10.21
Compare Source
Bugfixes 🐛
d6c2752b4e
), #9474a719486548
), https://github.com/phpstan/phpstan-phpunit/issues/190, #9478a540e44a36
), #9477277b96077b
)Internals 🔍
v1.10.20
Compare Source
Improvements 🔧
non-zero-int
type (#2449), thanks @PrinsFrank!gettype()
return type extension (#2437), thanks @staabm!Bugfixes 🐛
match
condition (0cdda0b210
), #4451, #6064, #9457gettype
inmatch
condition (e4ef00c057
,caa0a5b524
), #8614get_class
inmatch
condition (106526db8b
), #1885, #8536, #8092get_class
compared withstatic::class
(590eb03e0c
), #1885gettype
when there's a union of strings on the other side (36e412ffed
), #6294, #2580NonEmptyArrayType::toArray()
return$this
(#2349), #9208, thanks @zonuexe!array_push()
andarray_unshift()
(#2451), #8449, thanks @herndlm!@var
above throw and return, change the type of expr only for the stmt callback (b55109537d
), #9459Internals 🔍
175307e12d
)Type::getFiniteTypes()
(7912caf4b6
,fa9a951f80
,b5cf52b916
)v1.10.19
Compare Source
Bleeding edge 🔪
46ff440648
), #9410If 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
: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 🔧
sprintf()
arguments (1f955703ee
)51a284b8a8
)ff8ad7e9b3
)Bugfixes 🐛
503978b05e
), #9409, #8541Function signature fixes 🤖
Redis::connect()
to have 7 parameters (#2442), #9413, thanks @thbley!Internals 🔍
9de9efa67f
)v1.10.18
Compare Source
Implicit throw point is enough to no longer mark multi-catch as dead (
c587dd1d87
), #9406v1.10.17
Compare Source
Improvements 🔧
8bb45376ca
)Bugfixes 🐛
in_array
issues (#2432), #6959, thanks @schlndh!__debugInfo
with covariant return type (#2435), #9391, thanks @staabm!Map::remove()
@throws
inference (#2434), #9066, thanks @baci266!array_is_list
narrows the type even when not on Bleeding Edge (de2566adea
), #938132b889dd29
), #796004af510e56
), #9402array_push()
(564f79f96c
), #9403d09401df45
,ffc0495d89
), #8412, #8958, #8563, thanks @takaram!Function signature fixes 🤖
getimagesize*
return type (#2438), thanks @staabm!Internals 🔍
empty()
and typehint helper (#2430), thanks @mad-briller!v1.10.16
Compare Source
Bleeding edge 🔪
error_log
errors withmessage_type=2
(#2428), #9380, 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
: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 🔧
CallableType
andClosureType::describe()
- use phpdoc-parser Printer for better precision (30f60c18f5
), #9268OffsetAccessType::describe()
uses toPhpDocNode and phpdoc-parser printer (347fdbf2ca
)extract()
with constant arrays (#2417), #9331, thanks @MartinMystikJonas!Bugfixes 🐛
SplDoublyLinkedList::offsetGet
return type (#2373), #9274, thanks @takaram!get_called_class()
tostatic::class
(188acf4407
), #7574, #5252, #4061Internals 🔍
toPhpDocNode
without keys if they are not necessary (413079d807
)@var
in and out of function (4e1934796a
), #9331v1.10.15
Compare Source
Bleeding edge 🔪
a04e0be832
)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
: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 🔧
$this
in return type1036d199c8
), #9249__serialize()
and__unserialize()
return types (#2372), thanks @staabm!?->
call on always-null (74d1c9a1ca
), #9284Bugfixes 🐛
f199980c3c
)ConstantFloatType::toPhpDocNode()
for whole numbers ending with 0 (#2355), thanks @rvanvelzen!8d0c032d19
)3a4cd59e46
), #9283CURLOPT_HTTPHEADER
should not accept a dictionary (#2369), #9263, thanks @staabm!Function signature fixes 🤖
intval()
andfloatval()
should handle non-scalar values (#2351), thanks @dravnic!strval()
family function signatures (#2354), thanks @dravnic!Internals 🔍
670d04d817
)v1.10.14
Compare Source
Bleeding edge 🔪
filter_input*
type param type (#2271), thanks @herndlm!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
: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 🔧
Bugfixes 🐛
BackedEnum::tryFrom
not being nullable (#2302), thanks @schlndh!never
forarray_combine
with different number of elements (#2303), thanks @herndlm!equals()
(e01ce6865f
)fc673ee996
)get_parent_class()
on interfaces (#2336), #4302, thanks @staabm!Function signature fixes 🤖
Memcache/MemcachePool::get
method signature (#2344), thanks @dravnic!Internals 🔍
Type::toPhpDocNode()
(8633125f66
)symfony/polyfill-php72
(8ff8fb0bfb
)v1.10.13
Compare Source
mixed
input (#2338), #9178, thanks @zonuexe!v1.10.12
Compare Source
Major new features 🚀
Bleeding edge 🔪
06b746d8e7
, #2163), #7239, thanks @staabm!Imagick
parameter types (#2334), thanks @zonuexe!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
: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 🔧
filter_*
array handling, supportFILTER_REQUIRE_ARRAY
(#2318), thanks @herndlm!@property
types (#2327, #2328, #2329), #9062, thanks @jtojnar!filter_input()
(#2010), #6261, thanks @herndlm!filter_input
with invalid first args (#2333), thanks @herndlm!@property
and@method
to override above the same class (3467a215cf
)FilterVarArrayDynamicReturnTypeExtension
(#2257), thanks @zonuexe!Bugfixes 🐛
TypeSpecifierContext::truthy()
(#2230), #3013, #7686, thanks @VincentLanglet!1017dc7bc7
), https://github.com/phpstan/phpstan-doctrine/issues/333treatPhpDocTypesAsCertain
(#2250), #8937, thanks @VincentLanglet!b85a9613be
)d1c4c6d014
)Function signature fixes 🤖
Internals 🔍
cweagans/composer-patches
(#2307), thanks @herndlm!bddf57352f
)assert*
functions in TypeInferenceTestCase (#2326), thanks @staabm!v1.10.11
Compare Source
Bleeding edge 🔪
ca2c66cc4d
)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
: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 🔧
template-type
(callingType::getTemplateType()
method) (b6d0c87db5
), https://github.com/phpstan/phpstan/discussions/9053387ebd5059
)enum-string
empty-scalar
non-empty-scalar
non-empty-literal-string
pure-callable
closed-resource
non-empty-mixed
callable-array
e06c529ffc
)a327965dc5
,9850ea7e98
)fc5515a516
), #9077, #8473bfec8729f7
d3753fcb3a
Bugfixes 🐛
6c32371f7c
), #9131, #8900, #8222StaticType::isSuperTypeOf()
for subtypes ofObjectType
(b439fed7b1
), #9142TypehintHelper::decideTypeFromReflection()
should accept correct ancestor's ClassReflection, not just class name (297a9feca4
)Function signature fixes 🤖
IntlPartsIterator
(#2324), thanks @zonuexe!v1.10.10
Compare Source
Improvements 🔧
6910be2321
)e6e2d1a634
)--xdebug
when Xdebug is enabled (1d4ede19f6
)Bugfixes 🐛
treatPhpDocTypesAsCertain
for variables (5b7a1153dd
), #9126treatPhpDocTypesAsCertain
in more places (49d2aa6fd0
)Function signature fixes 🤖
Imagick::profileImage()
type (#2312), thanks @zonuexe!v1.10.9
Compare Source
Improvements 🔧
ea2670a086
), https://github.com/phpstan/phpstan/discussions/9070treatPhpDocTypesAsCertain
(40400aeb28
)treatPhpDocTypesAsCertain
(72472dd441
)treatPhpDocTypesAsCertain
(d892c34e9b
)f3711a2598
), #9106Function signature fixes 🤖
pg_pconnect
function signature (#2300), thanks @dravnic!NumberFormatter::parseCurrency
(#2309), thanks @rovansteen!v1.10.8
Compare Source
Improvements 🔧
.php
baseline file in analysed paths and warn about possible PHPStan slowdown (d6d9ef72d7
)Bugfixes 🐛
@var
afterclass_exists()
(#2292), #9055, thanks @staabm!Ds\Map::get()
@throws
inference (#2297), #9066, thanks @simPod!sprintf
/printf
(#2301), #9072, #2342, thanks @kukulich!Internals 🔍
23d29aba97
,f67a3729dc
,cbfb23d842
)v1.10.7
Compare Source
Improvements 🔧
from()
andtryFrom()
(edcaaba2ad
)Function signature fixes 🤖
XMLReader::XML
return type (195cb7bf83
)Internals 🔍
e73523da35
)v1.10.6
Compare Source
Bleeding edge 🔪
PHPStan\Type\Type
interface via@var
(713b98fb10
), https://github.com/nunomaduro/larastan/issues/1567#issuecomment-14604453899780d352f3
)9c2552b7e7
)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
: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 🔧
d943d58c21
)Bugfixes 🐛
array_combine()
on PHP 8+ (#2276), #9011, thanks @staabm!v1.10.5
Compare Source
Improvements 🔧
4654c1651f
)Bugfixes 🐛
c926144c2e
), #900860021c2857
), #50910dbe3ab24d
), #9006f64b27cf83
), #9005b79751221e
)v1.10.4
Compare Source
Improvements 🔧
aed93193ae
)dda95b4fa7
)Bugfixes 🐛
array_column
(#2244), #8917, thanks @VincentLanglet!filter_var()
handling of a couple of simple scalars and null (#2262), thanks @herndlm!value-of
for multiple enums (3adc91d78b
), #8983->value
on unions of enums (05b85bad07
), #9000Function signature fixes 🤖
Ds\Sequence::copy()
(#1954), thanks @MidnightDesign!password_hash()
return type (#2260), #5978, thanks @VincentLanglet!v1.10.3
Compare Source
Improvements 🔧
@not-deprecated
annotation (#2255), https://github.com/phpstan/phpstan/discussions/7422, thanks @stof!Bugfixes 🐛
f882eff78a
), #8938array_chunk()
(e4a6d2026e
), #895653c643de13
), #8957eb00fd21cc
), #8828, #8486v1.10.2
Compare Source
Improvements 🔧
8260032bc6
), #8870Function signature fixes 🤖
object
returned bydb2_*()
functions are always instances ofstdClass
(#2249), thanks @phansys!v1.10.1
Compare Source
Bugfixes 🐛
treatPhpDocTypesAsCertain: false
(#2248), #8932, thanks @VincentLanglet!7331bc5141
)in_array
and enums (7d6f0f6a4c
)v1.10.0
Compare Source
Read the article about this release: PHPStan 1.10 Comes With a Lie Detector
Major new features 🚀
elseif
branch and last match expression arm are not reported by default (#2105), #8042, #8485, #7721, #4242, #8240, thanks @staabm!reportAlwaysTrueInLastCondition
totrue
to have them reported againelseif
branch and last match expression arm.instanceof *Type
in favour of new methods onType
interface, (436e6d3015
), learn more: Why Is instanceof *Type Wrong and Getting Deprecated?phpstan-deprecation-rules
installedBleeding edge 🔪
@var
tag type against native type (a69e3bc2f1
)reportWrongPhpDocTypeInVarTag
totrue
to have all types validated, not just native ones0264f5bc48
)RuleLevelHelper::accepts()
behaviour (941fc815db
)@param-out
(7ceb19d3b4
), https://github.com/phpstan/phpstan/issues/8880#issuecomment-1426971473If 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
: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 🔧
7380ed0e48
)MutatingScope::getNativeType()
(#1943), #4689, #7578, #6260treatPhpDocTypesAsCertain
in NumberComparisonOperatorsConstantConditionRule (649eb70ba3
), #6776, #70756419da745a
)InClassMethodNode
- addgetClassReflection()
(c4ee0b8449
)8107179681
)e46b0b4aaf
)Type::getTemplateType()
and deprecateGenericTypeVariableResolver
(b73a8aacc1
,01b4d4e9b8
)Bugfixes 🐛
bc2828669f
)c015e47f40
), #8925Function signature fixes 🤖
PDO::sqliteCreateFunction
(#2208), #8802, thanks @VincentLanglet!db2_autocommit()
(#2239), thanks @phansys!Internals 🔍
TypeUtils::getDirectClassNames()
andinstanceof TypeWithClassName
, useType::getObjectClassNames()
instead (#1924), thanks @herndlm!isSuperTypeOf()
instead ofaccepts()
in the right places (ddb9dc5adc
)IncompatibleDefaultParameterTypeRule
(a79ad03836
)01a789713c
)e864b24a85
)c3da6a911a
)b736ddcecd
)Type::acceptsWithReason()
(b763bd9631
), #3281testEditorUrlWithRelativePath()
test on PhpStorm console (#2229), thanks @staabm!7da13f7de0
)61fa3a14e2
)Type::isEnum()
(93113cbca6
)Type::getObjectClassReflections()
(4c7046ef68
)v1.9.18
Compare Source
Improvements 🔧
f843feed8b
)Bugfixes 🐛
07e32cdbe4
,cf2107dd5c
), #88801f608dc6a5
), #8879, #8888Internals 🔍
ConstantArrayType::hasOffsetValueType()
(#2238), thanks @herndlm!v1.9.17
Compare Source
Bugfixes 🐛
6d61d3dd33
), #8850list{}
parsing (https://github.com/phpstan/phpdoc-parser/pull/177), thanks @zonuexe!ThisType
(d3e3292d73
), #8857v1.9.16
Compare Source
fbdf0da9b7
)v1.9.15
Compare Source
Improvements 🔧
ignoreErrors
entries for same message and path are summed together (fa70062df0
)Bugfixes 🐛
ce65e05373
), #87729334ff395d
), #8769filter_var()
with float input and FILTER_VALIDATE_INT (#2206), #8797, thanks @herndlm!method_exists()
onclass-string&literal-string
(#2193), #8752, thanks @staabm!filter_var()
range edge cases (#2207), #8776, thanks @herndlm!$this instanceof X will always be false
in traits (#2045), #3632, thanks @staabm!Function signature fixes 🤖
forward_static_call_array
for named arguments on PHP 8 (fb5c1119b7
), https://github.com/phpstan/phpstan/discussions/8761Internals 🔍
FilterFunctionReturnTypeHelper
(#2190), thanks @herndlm!FilterFunctionReturnTypeHelper
(#2198), thanks @herndlm!$otherTypes
inFilterFunctionReturnTypeHelper
(#2205), thanks @herndlm!v1.9.14
Compare Source
Bugfixes 🐛
filter_var()
narrowing with unknown options (#2146), #8516, thanks @herndlm!ctype_digit()
with cast parameter (#2189), #8736, thanks @staabm!Function signature fixes 🤖
Redis::connect()
signature to upstream changes (#2187, #2188), #8733, thanks @greg0ire!Internals 🔍
598f17ee70
), #8738v1.9.13
Compare Source
Bugfixes 🐛
#[AllowDynamicProperties]
might still have dynamic properties (051b06ea5b
), #8727, #8474v1.9.12
Compare Source
Improvements 🔧
0aa7f41fde
)pow()
(#1904), #5614, thanks @staabm!02e1a14b4c
), (#2012)nikic/php-parser
(e2956f04ed
)array_key_exists
type-specifying extension (#1941), #2970, thanks @VincentLanglet!Internals 🔍
v1.9.11
Compare Source
Bugfixes 🐛
7bdfdd4c40
)@phpstan-
prefixed tags (#2177), #8697, thanks @zonuexe!v1.9.10
Compare Source
8ef5163f90
)v1.9.9
Compare Source
Improvements 🔧
Type::getEnumCases()
to use instead ofinstanceof EnumCaseObjectType
(a0242e0f72
)Bugfixes 🐛
elseif
can be exhaustive and noelse
branch is needed (94e6e466f4
), #7547__CLASS__
,__NAMESPACE__
in traits (#2043), #3019, thanks @staabm!class_implements
dynamic return type extension (#2023), #4335, thanks @VincentLanglet!Function signature fixes 🤖
ReflectionClass::newInstanceArgs()
type fix for named arguments (#2176), #8679, thanks @s3b4stian!Internals 🔍
TrinaryLogic::lazyAnd()
andlazyOr()
if current instance allows it (#2173), thanks @herndlm!MissingTypehintCheck
(#2174), thanks @herndlm!v1.9.8
Compare Source
Improvements 🔧
Bugfixes 🐛
b13ce59ac3
), https://github.com/phpstan/phpstan/discussions/8502array_shift
et al. have side effects (6276ce1c3e
), #8084get_class()
in traits always evaluate to true (#2044), #3633, thanks @staabm!v1.9.7
Compare Source
Bleeding edge 🔪
skipCheckGenericClasses
(28c2c79b16
)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
: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 🔧
UnionType::pickTypes
overriden inBenevolentUnionType
for a more benevolent behaviour (480626ecb5
)Bugfixes 🐛
091fcafb07
), #86436debffdb58
)Function signature fixes 🤖
min()
andmax()
do not returnfalse
on PHP 8 (#2161), thanks @staabm!Internals 🔍
v1.9.6
Compare Source
Improvements 🔧
Bugfixes 🐛
dc77608ee9
), #8635cde53d19e9
), #8625, #8621v1.9.5
Compare Source
Improvements 🔧
MutatingScope::shouldInvalidateExpression()
(#2139), thanks @staabm!ReturnStatementsNode::hasNativeReturnTypehint()
(#2141), thanks @janedbal!lowercase-string
andnon-empty-lowercase-string
are known (884ceb015c
)Bugfixes 🐛
pathinfo($s, PATHINFO_ALL)
return type (#2014), thanks @staabm!MixedType::hasOffsetValueType()
for subtracted types (#2135), #6705, thanks @herndlm!parent::__set_state()
method is only object (#2138), thanks @blankse!80b5cdd3ec
)Internals 🔍
db2de6f174
)FilterVarDynamicReturnTypeExtension
(#2120), thanks @herndlm!Type::isScalar()
(#2149), thanks @herndlm!GenericsIntegrationTest
(#2147), thanks @herndlm!v1.9.4
Compare Source
Improvements 🔧
checkArgumentTypes=true
(#2106), thanks @staabm!TypeCombinator::intersect()
(#2112), thanks @staabm!InitializerExprTypeResolver
(#2114), thanks @staabm!TypeCombinator::removeFalsey()
(#2003), thanks @axlon!usePathConstantsAsConstantString
(#2050), thanks @MartinMystikJonas!Bugfixes 🐛
unset
(#2107), #7805, thanks @rajyan!array_search()
with constant array type haystack (#1806), #3789, thanks @takaram!parse_str()
might return nested arrays by-ref (#1994), #8356, thanks @staabm!for
loop (a8975b1800
), #8520a7fed03bbf
), #85434025209062
), #8537Internals 🔍
getConstantStrings()
on Type (#1979), thanks @staabm!v1.9.3
Compare Source
Bleeding edge 🔪
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
: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 🔧
DateTimeZone::__construct
throw type extension (#2034)deprecationRulesInstalled
configuration (#2062), thanks @villfa!treatPhpDocTypesAsCertain
(#2065), thanks @VincentLanglet!c760b1f7a4
)da8413c493
), #8499, #8497Scope::getType()
. Cheap checks first. (#2071), thanks @staabm!30e6d19496
)Bugfixes 🐛
@param-out
on methods (#2028), #8421, thanks @staabm!mixed
on annotation assignment (#2017), thanks @herndlm!$nativeExpressionTypes
in MutatingScope (#2021), thanks @herndlm!.php
(bff85e27cd
), #8480Function signature fixes 🤖
Internals 🔍
NodeScopeResolverTest
cases (#1992), thanks @herndlm!UnionTypeHelper
(#1988), thanks @herndlm!$expressionTypes
and$nativeExpressionTypes
in Scope creation methods (#2022), thanks @herndlm!96e4443d94
)getLevelValue()
(4f7e20b6ff
)TypeTraverser
inArrayChunkFunctionReturnTypeExtension
(#2082), thanks @herndlm!TypeTraverser
inArraySliceFunctionReturnTypeExtension
(#2085), thanks @herndlm!TypeTraverser
inArrayReverseFunctionReturnTypeExtension
(#2084), thanks @herndlm!TypeTraverser
inStrSplitFunctionReturnTypeExtension
(#2087), thanks @herndlm!v1.9.2
Compare Source
Bugfixes 🐛
NeverType
(#1968), #8277, thanks @herndlm!Function signature fixes 🤖
json_encode()
always produce anon-empty-string
, when successful (#1980), thanks @Slamdunk!sodium_crypto_generichash*
always produce anon-empty-string
(#1981), thanks @Slamdunk!sodium_crypto_sign*
always producenon-empty-string
(#1985), thanks @Slamdunk!Internals 🔍
Type::isVoid()
(#1982), thanks @herndlm!v1.9.1
Compare Source
Improvements 🔧
AccessoryArrayListType
is part of BC promise (#1967), thanks @enumag!object
tostring
result in an error (#1948), thanks @rvanvelzen!checkBenevolentUnionTypes
config (#1940), thanks @VincentLanglet!Bugfixes 🐛
mt_rand
return type (#1956), #8272, thanks @enumag!strtr
returnsnon-empty-string
(#1963), thanks @staabm!v1.9.0
Compare Source
Check out the article about this release!
Major new features 🚀
@phpstan-assert
,@phpstan-assert-if-true
,@phpstan-assert-if-false
(#1317), #7110, #8186, thanks @rvanvelzen!@phpstan-self-out
/@phpstan-this-out
support (#1799), thanks @rvanvelzen!@param-out
support (#1804), #7231, #6871, #6186, #4372, #5785, thanks @staabm!ClassReflection::getAllowedSubTypes()
(#1477), thanks @jiripudil!checkBenevolentUnionTypes
to strictly check BenevolentUnionType (#1930), #8223, thanks @VincentLanglet!Bleeding edge 🔪
list
type (#1751), #3311, #8185, #6243, thanks @rvanvelzen!97786ed837
)ddf8d5c385
,17e4b74335
)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
: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 🔧
non-negative-int
andnon-positive-int
(#1803), thanks @rvanvelzen!NonexistentOffsetInArrayDimFetchCheck
(#1801), thanks @herndlm!@method
extension to look at@throws
in __call (#1842), #8163, thanks @VincentLanglet!$this
/static
in conditional return types (#1863), thanks @rvanvelzen!mb_convert_case()
andmb_convert_kana()
(#1866), thanks @zonuexe!callable-object
andcallable-string
(#1906), thanks @rvanvelzen!FunctionReflection
/ExtendedMethodReflection::returnsByReference()
(#1899), #6005, thanks @staabm!1cc337acc8
)MutatingScope::enterNamespace()
is part of BC promise (92732ca8de
)Bugfixes 🐛
Scope
orFunctionReflection
in userland class (2796f8dd8f
)no-named-arguments
implies variadic argument is alist
(#1796), thanks @herndlm!9260584915
), #8071Countable
incount()
(#1876), thanks @staabm!RuleLevelHelper::accepts()
for constant arrays (#1911), #8209, thanks @rvanvelzen!get_object_var()
as private property read (#1902), #3654, thanks @vovochka404!@param-out
(cf40007c00
)29690576ea
)$this
in nativeExpressionTypes (#1936), thanks @rajyan!471265fc62
)@phpstan-self-out
(#1949), thanks @staabm!Function signature fixes 🤖
mb_check_encoding()
acceptsarray<string>
in PHP 7.2+ (#1867), thanks @zonuexe!Internals 🔍
Type::getConstantArrays
as successor forTypeUtils::getOldConstantArrays
(#1684), thanks @herndlm!TypeUtils::getArrays()
andTypeUtils::getAnyArrays()
(#1687), thanks @herndlm!Type::getLastIterableValueType()
(#1811), thanks @herndlm!Type::getFirstIterableValueType()
(#1811), thanks @herndlm!Type::getFirstIterableKeyType()
andType::getLastIterableKeyType()
(#1812), #8152, thanks @herndlm!JustNullableTypeTrait
(#1821), thanks @herndlm!Type::isConstantArray()
(#1822), thanks @herndlm!getConstantArrays()
usage withisConstantArray()
(#1827), thanks @herndlm!Type::getArraySize()
(#1828), thanks @herndlm!Type::flipArray()
(#1832), thanks @herndlm!Type::getKeysArray()
andType::getValuesArray()
(#1851), thanks @herndlm!FunctionReflection::getDocComment()
(#1834), thanks @staabm!Type::popArray()
andType::shiftArray()
(#1847), thanks @herndlm!Type::shuffleArray()
(#1853), thanks @herndlm!ConstantArrayType::generalizeToArray()
(#1856), thanks @herndlm!array_pop
/array_shift
arg (#1864), thanks @herndlm!ArrayType::castToArrayKey()
withType::toArrayKey()
(#1841), thanks @rvanvelzen!Type::fillKeysArray()
(#1869), thanks @herndlm!ErrorType
for invalid keys (#1869), thanks @herndlm!is_(int,object,resource,scalar)
extensions with stubs (#1884), thanks @BackEndTea!pow()
return type extension to re-useBinaryOp\Pow
type inference (#1900), thanks @staabm!Type::getArrays()
usage inInvalidKeyInArrayDimFetchRule
(#1872), thanks @herndlm!Type::searchArray()
(#1874), thanks @herndlm!variableTypes
to save byexprString
(#1909), thanks @rajyan!variableTypes
andmoreSpecificTypes
(#1919), thanks @rajyan!::set-*
in GitHub Actions (#1917), thanks @rez1dent3!Type::intersectKeyArray()
(#1916), thanks @herndlm!aaf4b7df44
)v1.8.11
Compare Source
Improvements 🔧
f15cd6deea
,4cdb8060b7
)dcd8bac24f
)Bugfixes 🐛
@mixin
result cache issue (7228d4d5c6
), #7831@template
tags in the result cache (4c0cb98c84
)bc9301d983
)e1c1366949
)be6e7ced22
)@method
,@property
,@extends
,@implements
tags (ec5b6331e9
)@use
(08703d1dac
)9e4e93b48c
)615c6a1d62
)8369197775
)v1.8.10
Compare Source
Improvements 🔧
Bugfixes 🐛
9febf1db4b
), #8139ecc3076769
)Function signature fixes 🤖
CURLOPT_*
parameter types (#1836), #8152, #8157, thanks @jlherren!v1.8.9
Compare Source
Improvements 🔧
TypeCombinator::reduceArrays()
even more (#1814), thanks @rvanvelzen!array_search()
type specifier performance (#1818), #8147, thanks @rvanvelzen!b1b0dc9218
)8e55decc78
)Bugfixes 🐛
key_exists
be treated likearray_key_exists
(#1800), #8091, thanks @takaram!32b3c67729
)76bd347d22
), #8158Function signature fixes 🤖
SoapFault
constructor datatype (#1798), thanks @ahmedash95!IntlDateFormatter::create
return signature (#1776), thanks @Kleinast!RedisCluster::del
(#1829), thanks @ostrolucky!fpm_get_status
function signature (#1771), thanks @mad-briller!connection_status
function signature (#1774), thanks @mad-briller!headers_list()
returns a list of headers as strings. (#1770), thanks @johnbillion!v1.8.8
Compare Source
Improvements 🔧
ExprPrinter
by BC promise (#1794), thanks @staabm!isset
specification in falsy scope (#1781), thanks @herndlm!sphpstan/phpdoc-parser
to 1.9.0 (fd94186ee2
)Bugfixes 🐛
MutatingScope::generalizeType
(#1732), #8015, thanks @herndlm!get_parent_class()
(#1383), #5552, thanks @staabm!Composer\InstalledVersions
to parse PHPStan version (acbb55baee
), #8117Function signature fixes 🤖
zadd
argument order (#1779), thanks @araab!zscan
return types (#1780), thanks @araab!XMLWriter::startElementNS()
$namespace
arg is nullable (#1772), thanks @staabm!v1.8.7
Compare Source
Improvements 🔧
c52eb5792c
)TypeCombinator::reduceArrays()
performance with retained type completeness (#1741), thanks @rvanvelzen!@readonly
property allows private mutation (#1610), #7778, thanks @zonuexe!3e383fc962
)877835002a
)@property
annotations (#1786), thanks @mad-briller!tip
message to JSON error formatter (#1727), thanks @staabm!Bugfixes 🐛
namespace {}
) (#1758), thanks @rvanvelzen!ignoreErrors
(#1769), thanks @MartinMystikJonas!ignoreErrors
: fixreportUnmatched
withoutpath
/paths
(#1773), thanks @MartinMystikJonas!getRawArgs()
instead (6cd3d5d61d
), #80783758d9d5d5
), #8072e753dfd4a4
)8f6392f452
), #778733771e5d8e
), #8054CURLOPT_POSTFIELDS
param type (#1782), thanks @ahmedash95!IssetCheck
/MutatingScope::issetCheck
deviations and remove too early exits (#1784),thanks @herndlm!
c052aace4e
), #8008false
tolerant withisset
(#1791), #8068, thanks @ahmedash95!Function signature fixes 🤖
time_nanosleep
return type signature (#1787), #8097, thanks @staabm!Internals 🔍
376449e2d4
)v1.8.6
Compare Source
Improvements 🔧
reportUnmatched
(#1686), thanks @MartinMystikJonas!ConstantArrayType::isKeysSupersetOf()
(#1729), #8017, thanks @rvanvelzen!$argc
,$argv
global variables types (#1718), thanks @staabm!oversized-array
type to enfore max number ofHasOffsetValueType
accessory types (#1666), thanks @rvanvelzen!a628fb3429
)UnionTypeHelper::sortTypes()
stability (#1746), thanks @rvanvelzen!Bleeding edge 🔪
curl_setopt
function signature based on 2nd arg (#1719), 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
: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
Bugfixes 🐛
::class
as literal string (#1692), #7823, thanks @staabm!5f1a4a5b9c
), #7963BuilderHelpers::normalizeValue()
, it's not needed (ec286787e7
), #8029Function signature fixes 🤖
gnupg::geterror
can return false (#1735), thanks @Firehed!pathinfo()
return type (#1734), #8033, thanks @rvanvelzen!stream_*
functions all return a list of strings. (#1745), thanks @johnbillion!v1.8.5
Compare Source
Improvements 🔧
true
pseudotypes in native unions (#1539), thanks @staabm!16a80d9555
)8a3562e813
)38953dd44d
,7e2941ec6c
,52b7bec279
)8250448cea
,05dbd5e48c
,ab7760e044
), #7933Bugfixes 🐛
ConstantArrayType::isKeysSupersetOf
for tagged unions (#1693), #7898, thanks @herndlm!::class
type for final classes (#1699), thanks @rvanvelzen!5b448a7dce
)74309300ba
), #7952v1.8.4
Compare Source
PHPStan 1.8.3 but faster!
Improvements 🔧
0cc87f3785
,ec9240294a
,13d659522c
), #7918, #7903, #7901, #75811a8f07040d
), #7917Bugfixes 🐛
::class
on string expression (#1425), thanks @rvanvelzen!a418c461fa
), #7904reportUnmatchedIgnoredErrors
is changed (84852ab8d9
)array_filter()
that does not return all items (2e89a22dc2
), #7909v1.8.3
Compare Source
This release fixes 76 issues! 🎉
Improvements 🔧
non-falsy-string
(truthy-string
) type (#1542, #1660, #1661, #1662), #5317, #5370, #7199, thanks @staabm!checkImplicitMixed
(#1645), thanks @MartinMystikJonas!substr()
(#1532), #7663, thanks @staabm!ltrim()
return type extension to supportclass-string
(#1597), #7483, thanks @staabm!24aee609eb
,10ba3c6816
)dbdcb817fc
)@psalm-readonly-allow-private-mutation
as alias of@readonly
(#1609), #7774, thanks @zonuexe!gettype()
inference in TypeSpecifier (#1611), #6901, thanks @staabm!expr & number
for positive numbers (#1629), thanks @thg2k!ctype_digit
(#1635), thanks @fluffycondor!array_flip()
for constant arrays (a6cec395f6
)array_filter()
for constant arrays (771b860d0c
)array_intersect_key()
for constant arrays (a96cdf2bf5
)092ef3be68
)f8f6e2a8df
)Bugfixes 🐛
ConstantArrayType
callables with union values (#1529), #2343, thanks @herndlm!eval()
(058d739904
), #7647363a282add
), #7676pg_*
functions with multiple variants from signature map on PHP 8.1 (8128a63348
), #7138in_array
non-empty-array type specification (#1545), #7684, thanks @herndlm!ConstantArrayType::unsetOffset
(#1537), #5223, thanks @herndlm!treatPhpDocTypesAsCertain: false
(#1560), #7622, thanks @rvanvelzen!1537424191
), #7469, #3391, #7417class-string
s fromGenericClassStringType
(#1590), #7698, thanks @staabm!Array_
expr type resolving with unpacked array items (#1586), #7724, thanks @herndlm!Array_
expr type resolving with unpacked constant array items (#1619), #7776, thanks @herndlm!229df9ba73
)8ab002a13a
)json_decode()
without arguments (bf6d4c003a
), #77628613169c10
), #7763ConstantStringType::describe()
(#1612), thanks @rvanvelzen!14592ddf2b
)f09b288ac0
)non-empty-array
(32353a9269
)$data[$key]
after specifying$key
(46a8f32f54
), #6008MixedType
explicitness inMethodParameterComparisonHelper::isTypeCompatible
(#1491), #7415, thanks @herndlm!ConstantArrayType
(6173110226
), #6013, #2851, #6008sscanf()
(#1593), thanks @staabm!sscanf()
inference with regex format patterns (#1576), #7563, #7764, thanks @staabm!9c49d4c913
)MixedType
(#1656), thanks @staabm!PHPStan\dumpType
pure (#1665), #7803, thanks @rvanvelzen!024738fcc7
), #6170c057aa9d1f
)Function signature fixes 🤖
Imagick::queryFontMetrics
more specific return type (#1530), thanks @MartkCz!Imagick::roundCornersImage
correct naming and optional params (#1531), thanks @MartkCz!str_split
returns an empty array since PHP 8.2 (#1544), thanks @herndlm!XmlReader::next|read()
has side-effects (#1551), #5920, thanks @staabm!getName()
returns anon-empty-string
(#1599), #7056, thanks @staabm!ord()
signature (#1620), thanks @thg2k!port
component of 'parse_url()
(#1622), thanks @thg2k!Internals 🔍
0a2fc63e1f
)non-empty-array
removal inarray_push
/array_unshift
(#1552), thanks @herndlm!VirtualNode::getType()
returning an incorrect value for ClassConstantsNode and MethodReturnStatementsNode (#1568), thanks @Muqsit!SimpleXMLElement::asXML
(#1606), thanks @herndlm!MutatingScope::filterBySpecifiedTypes
(#1536), thanks @herndlm!IntegerRangeType
constructor private (#1624), #7803, thanks @herndlm!jean85/pretty-package-versions
dependency (#1607), thanks @herndlm!brianium/paratest
^6.5 to fix PHP 8.2 deprecation notices (#1631), thanks @herndlm!f3fe24577f
)TypeUtils::containsCallable()
(#1667), thanks @herndlm!v1.8.2
Compare Source
Improvements 🔧
#[\AllowDynamicProperties]
attribute support (RFC)#[\SensitiveParameter]
attribute support (RFC)--debug
: print previous exceptions (a342b2bea0
), #7590Bugfixes 🐛
Function signature fixes 🤖
AppendIterator
stub (#1517), thanks @drupol!CachingIterator::getCache
stub (#1519), thanks @drupol!v1.8.1
Compare Source
Improvements 🔧
49c27d8849
), https://github.com/phpstan/phpstan-src/pull/1480#issuecomment-1169960148@throws
tag in stub file (#1487), #7552, thanks @VincentLanglet!#[AllowDynamicProperties]
PHP 8.2 attribute stub (#1478), thanks @andypost!@immutable
phpdoc (#1489), #7506, thanks @herndlm!ClassReflection::evictPrivateSymbols()
as internal (9138ab2a1b
)Bugfixes 🐛
ConstantArrayType
creation forpreg_split
withPREG_SPLIT_OFFSET_CAPTURE
(#1486), #7554, thanks @herndlm!shuffle
(#1438), #6138, thanks @herndlm!e20e9345f5
), #6291, #7211, #7550FILTER_VALIDATE_INT
option infilter_var
(#1499), #7608, thanks @takeokunn!str_split
/mb_str_split
string arg compound types (#1496), #7580, thanks @herndlm!StaticType::traverse()
(0e257067ff
)GenericClassStringType::isSuperTypeOf()
- do not convert maybe into no (6fba5429b9
), #6697StaticType
(0906336d29
), #6443Function signature fixes 🤖
octdec()
(#1500), thanks @zonuexe!v1.8.0
Compare Source
Major new features 🚀
rememberPossiblyImpureFunctionValues
config parameter (defaults totrue
) (50ed38f04d
), #7529* Read more: https://phpstan.org/config-reference#rememberpossiblyimpurefunctionvalues
Bleeding edge 🔪
c4d05276fb
)9e007251ce
)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
: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 🔧
filter_var(FILTER_VALIDATE_INT)
(#1443), #7494, thanks @zonuexe!f9374e74be
), #2741@api
annotation toNodeScopeResolver::processStmtNodes()
(#1464), thanks @vojtech-dobes!ClassReflection->is()
shortcut (#1468), thanks @janedbal!b95606ec29
)7aa19e02c6
)@template-contravariant
tags (https://github.com/phpstan/phpdoc-parser/pull/140), thanks @autaut03!Bugfixes 🐛
proc_open
is not disabled (#1451), #7488, thanks @mvorisek!is_file
warnings inbin/phpstan
(#1466), thanks @mvorisek!-a
(78016fe928
)Function signature fixes 🤖
Closure::bind()
with$newScope = null
(#1446), #7489, thanks @rvanvelzen!Closure::bindTo()
with$newScope = null
(#1448), thanks @mvorisek!imagesx
andimagesy
functions (#1452), thanks @norkunas!NoRewindIterator
stub (#1453), thanks @drupol!LimitIterator
stub (#1455), thanks @drupol!InfiniteIterator
stub (#1454), thanks @drupol!CachingIterator
stub (#1456), thanks @drupol!RegexIterator
stub (#1462), thanks @drupol!EmptyIterator
stub (#1472), thanks @drupol!array_keys
slightly (#1474), thanks @Seldaek!v1.7.15
Compare Source
Improvements 🔧
editorUrl
for Docker environment (#1414), #7043, thanks @Wirone!sprintf()
constant format inference (#1437, #1440, #1441), thanks @staabm!sscanf()
andfscanf()
(#1434), thanks @staabm!Scope::getFunction()
does not need to be used (f18bd86495
)Bleeding edge 🔪
is_a()
orclass_parents()
(c4a662ac6c
)new ReflectionMethod()
(536306611c
)instanceof
of classes not covered by backward compatibility promise (ff4d02d62a
)instanceof
of classes covered by backward compatibility promise but where the assumption might change (996bc69fa9
)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
: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
Bugfixes 🐛
numeric-string
being returned fornon-empty-string
(#1428), #7265, thanks @staabm!in_array
(#1430), #7153, #7275, thanks @rvanvelzen!non-empty-array after
afterin_array()
(#1108), #6167, thanks @staabm!array_push
/array_unshift
call can still be empty (#1431), #7424, thanks @herndlm!TemplateTypeArgumentStrategy::accepts()
(85ab8cfe23
), #7460TypeCombinator::union()
for intersection of array and template type (#1444), #4117, thanks @rvanvelzen!Function signature fixes 🤖
xhprof_sample_disable()
) (#1436), thanks @johnbillion!v1.7.14
Compare Source
Improvements 🔧
date_create
(#1413), thanks @VincentLanglet!sprintf()
return type on constant formats (#1410), #7387, thanks @staabm!9878eef9a7
)MutatingScope::enterCatch()
(4a7d7da6f5
)Bugfixes 🐛
literal-string
as array key (#1420), #7353, #6163, thanks @rvanvelzen!Function signature fixes 🤖
v1.7.13
Compare Source
Improvements 🔧
e12524e215
,fba292944a
)e8b8ffdd7d
)Lexer::tokenize()
(https://github.com/phpstan/phpdoc-parser/pull/133), thanks @rvanvelzen!Bleeding edge 🔪
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
: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
Bugfixes 🐛
TypeUtils::getDirectClassNames()
- return unique list of class names (b85fce0707
)v1.7.12
Compare Source
Improvements 🔧
ef8c7c37f2
)@param
type (https://github.com/phpstan/phpdoc-parser/pull/127), https://github.com/phpstan/phpdoc-parser/issues/77, thanks @rvanvelzen!ExtendedMethodReflection
interface (#1403)Bleeding edge 🔪
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
: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
Bugfixes 🐛
v1.7.11
Compare Source
Bleeding edge 🔪
@readonly
rule that disallows default values (#1391), thanks @herndlm!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
: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
Bugfixes 🐛
BetterReflectionProvider::getClass()
- handleInvalidIdentifierName
too (64b0907db0
), #7404ReflectionClass
adapter - implementnewInstance*
methods (90dd583444
), https://github.com/phpstan/phpstan/discussions/7403v1.7.10
Compare Source
Improvements 🔧
vendor-dir
setting incomposer.json
, and alsoCOMPOSER
environment variable (#1384), thanks @canvural!Bugfixes 🐛
PHPStan\Node\ClassMethod
(9b4a5913aa
),d0a9d084ea (r75178623)
TypeUtils::getDirectClassNames
for nested type (#1380), thanks @mvorisek!Internals 🔍
<file>bin</file>
intophpcs.xml
, and applied it (#1393, #1394), thanks @sasezaki!v1.7.9
Compare Source
Improvements 🔧
non-empty-string
on str-casing functions comparison with constant string (#1382), thanks @staabm!Bugfixes 🐛
MutatingScope::getTypeToInstantiateForNew()
(#1388), #7374, thanks @rvanvelzen!v1.7.8
Compare Source
Improvements 🔧
nikic/php-parser
to 4.14.0 (fbaab8f9a6
)Bugfixes 🐛
b73a396217
)Function signature fixes 🤖
PDO::pgsqlCopy{From,To}{Array,File}
(#1375), thanks @takaram!v1.7.7
Compare Source
Bugfixes 🐛
invoke()
etc. (2a0638be39
), #7333v1.7.6
Compare Source
Bugfixes 🐛
v1.7.5
Compare Source
Bugfixes 🐛
Fixes for more custom autoloader scenarios (#7296, #7308):
99acc024f9
)eab4542c4b
)v1.7.4
Compare Source
Improvements 🔧
UnusedPrivatePropertyRule
(#1360), thanks @herndlm!Bugfixes 🐛
ConstantArrayType
optional key unsetting viaremoveLastElements
(#1366), #7351, thanks @herndlm!array_walk
callback parameters (#1367), thanks @rvanvelzen!e73f320b57
), #7352non-empty-string
onstrstr()
comparison with constant string (#1365), thanks @staabm!Function signature fixes 🤖
stream_bucket_make_writeable
(#1361), #7341, thanks @VincentLanglet!v1.7.3
Compare Source
Improvements 🔧
latest
+latest-php8.0
use PHP 8.0latest-php8.1
uses PHP 8.11
+1-php8.0
use PHP 8.01-php8.1
uses PHP 8.11.7.3
+1.7.3-php8.0
use PHP 8.01.7.3-php8.1
uses PHP 8.1nightly
+nightly-php8.0
use PHP 8.0nightly-php8.1
uses PHP 8.1nodeCallback
for all attribute-related nodes (#1333), #7071, thanks @janedbal!d3589dc541
), #7330ConstantArrayType::slice
(#1345), thanks @herndlm!@no-named-args
(#1349), #5968, thanks @jrmajor!ArrayChunkFunctionReturnTypeExtension
(#1356), #7277, thanks @herndlm!Bugfixes 🐛
hasSideEffects()
for static methods (1182199bcf
), #7210MissingReadOnlyPropertyAssignRule
(#1357), #6632, #7337, thanks @herndlm!Function signature fixes 🤖
NumberFormatter:format()
andNumberFormatter::formatCurrency()
(#1350), thanks @MartkCz!v1.7.2
Compare Source
Improvements 🔧
86cfb85437
), #7305AppendIterator
stub (50cbc45cd5
), https://github.com/phpstan/phpstan/discussions/7322Bugfixes 🐛
isset
/??
(#1351), #7318, thanks @rajyan!6962280fde
), #7308, #7306, #7293v1.7.1
Compare Source
Improvements 🔧
ArraySliceFunctionReturnTypeExtension
(#1341), thanks @herndlm!Bugfixes 🐛
array_reverse
(#1342), thanks @herndlm!7beee3d5db
,4495bf1229
,c24aa5a165
), #7294v1.7.0
Compare Source
This release closes 25 issues! 🥳
Major new features 🚀
bootstrapFiles
andfiles
sections in Composerautoload
configurationBetterReflection
adapter (https://github.com/phpstan/phpstan-src/pull/1265/commits/ef603397df6036647f6b030407b3316159dc330f)bootstrapFiles
(#1277, #1282), thanks @kukulich!@phpstan-consistent-constructor
and add a new rule as another way to supressnew static()
issues (#1296), thanks @canvural!Bleeding edge 🔪
@readonly
property and@immutable
class PHPDoc (#1295, #1335), #4082, thanks @herndlm!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
: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 🔧
PHPStan\Type\ConstantTypeHelper::getTypeFromValue()
. Instead of going from runtime value -> PHPStan type, usePHPStan\Reflection\InitializerExprTypeResolver::getType()
to go from Expr -> PHPStan type. In case you haveScope
available, useScope::getType()
.7ce177e71b
)--debug
flag (5f5b96d432
)Bugfixes 🐛
get_class
on enum case (#1272), #7167, thanks @olsavmic!::class
(#1271), #6864, #6986, thanks @olsavmic!value-of
/key-of
with template types (#1288), thanks @rvanvelzen!openssl_error_string
after openssl function calls (#1292), #7106, thanks @pbourdet!761d116822
), #4950isset()
andArrayDimFetch
(#1307), #6508, #7000, #7190, #7144, thanks @rajyan!DatePeriod
constructor with named arguments (59453678ac
), #7048, #55530ecddcca76
)is_subclass_of
type checks (#1321), #2755, thanks @staabm!$isOffsetAccessible->maybe()
for isUndefinedExpressionAllowed and isSpecified expression (#1312), #7229, thanks @rajyan!ConstructorsHelper
inReadOnlyByPhpDocPropertyAssignRule
andReadOnlyPropertyAssignRule
(#1328), #6612, thanks @herndlm!array_reverse
with constant arrays (#1337), #7278, thanks @herndlm!Function signature fixes 🤖
var_export()
extension with conditional-type stub (#1244), thanks @staabm!is_a()
via stub (#1310) (#1310, #1311), #4371, thanks @staabm!mb_ereg_replace_callback()
callable. (#1316), thanks @johnbillion!DateTimeZone::getTransitions()
. (#1315), thanks @johnbillion!RedisCluster::getOption()
andRedisCluster::setOption()
(#1334), thanks @taka-oyama!v1.6.9
Compare Source
Bugfixes 🐛
BitwiseNot
(#1266), thanks @staabm!non-empty-string
onsubstr()
comparison with constant string (#1259), #6792, thanks @staabm!ArrayDimFetch
unset (cc640d797c
)v1.6.8
Compare Source
Bugfixes 🐛
in_array()
for enum cases (#1291), #7176, thanks @herndlm!361e064d4b
), #7171, #7208v1.6.7
Compare Source
DateTime(Immutable)::modify()
behaviour less annoying (7bd9fb7285
)v1.6.6
Compare Source
Improvements 🔧
e40474b3fc
), #7157, #7112124b30f98c
,0c82c96f2a
)Bugfixes 🐛
DateTime(Immutable)::modify()
(b5da7cea2a
), #6609v1.6.5
Compare Source
Improvements 🔧
json_decode
(#993), thanks @TomasVotruba and @herndlm!Bugfixes 🐛
46f51e71c3
), #7150$conditionalExpressions
key consistent in all usages (#1270), thanks @rajyan!TypeSpecifier::specifyTypesInCondition
with a non-null context in case the original context is null (#1275), #7166, thanks @herndlm!v1.6.4
Compare Source
Improvements 🔧
non-empty-string
onliteral-string and
strlen()
(#1260), thanks @staabm!Bugfixes 🐛
ae53760a87
), #715128eaba24ac
), #7151v1.6.3
Compare Source
Improvements 🔧
6e02453df3
)c9ae89cab4
)5c85200c97
)str_contains
FunctionTypeSpecifyingExtension (#1068), thanks @staabm!Bleeding edge 🔪
6ebf2361a3
)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
: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
Bugfixes 🐛
3f75d8ac0c
), #7135v1.6.2
Compare Source
Improvements 🔧
array_push
/array_unset
arg handling (#1252), thanks @herndlm!3a3c69eb93
)Bugfixes 🐛
constUses
in ExportedPhpDocNode (3fe27268f6
), #7130??
/isset
/empty
, report it in bleedingEdge with different message (#1253,54f15441eb
), #7109, thanks @rajyan!v1.6.1
Compare Source
Bugfixes 🐛
72bb305070
), #7112BackedEnum::from()
andtryFrom()
methods (e97439c598
), #70962f49187491
), #711163ef0a9eb7
), #7113array_push
/array_unshift
with unpacked non-constant array types (#1247), #7115, thanks @herndlm!v1.6.0
Compare Source
Read the article about PHPStan 1.6.0 »
Major new features 🚀
@return ($i is positive-int ? non-empty-array : array)
(don't forget the parentheses!)@template
tags:@return (T is positive-int ? non-empty-array : array)
int-mask<...>
andint-mask-of<...>
types (#1166), thanks @rvanvelzen!php-8-stubs
to know about PHP 8.1 function signature changes, #7017, #6448isset()
and null-coalesce (??
) operators consistent with each other (#1223), thanks @rajyan!checkDynamicProperties
to restore the original stricter behaviour (#1234), thanks @rajyan!Bleeding edge 🔪
'parent'
,'next'
, and'previous'
node attributes. Learn more »__construct()
(level 2) (#1208), #7022, thanks @muno92!checkMissingIterableValueType: false
no longer does anything (50d0c8e23e
)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
: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 🔧
f7d80d6c13
), #7052796c9d5f85
), #7075Bugfixes 🐛
b95949a0bf
), #7030isset()
with multiple arguments (#1240), #3601, thanks @rajyan!isset()
fix (3c7d9c8dcf
), #7095Function signature fixes 🤖
json_decode
error return type (#1235), thanks @herndlm!mb_strlen
(#1211), thanks @fluffycondor!db2_last_insert_id
may return NULL (#1214), thanks @morozov!SimpleXMLElement::addChild
signature (#1215), thanks @szepeviktor!SimpleXMLElement::children()
(3a2f1058b1
)v1.5.7
Compare Source
Bugfixes 🐛
array_merge
with numeric keys (#1218), thanks @herndlm!ConstantArrayTypeBuilder
optional keys viasetOffsetValueType
(#1225), thanks @herndlm!array_push
with an empty constant array (#1210), #6974, thanks @herndlm!array_push
/array_unshift
withConstantArrayType
arguments (#1232), #5783, thanks @herndlm!f091c5629a
), #70689044bfc33d
)2a145bad4e
)array_merge
(#1233), thanks @herndlm!v1.5.6
Compare Source
This release enables to write forward-compatible custom rules with PHPStan 1.6.0+Bleeding Edge. Detailed instructions are here: https://phpstan.org/blog/preprocessing-ast-for-custom-rules
b0dafcc492
)v1.5.5
Compare Source
Improvements 🔧
ConstantArrayType::getKeyType()
(#1173), thanks @herndlm!ConstantArrayType
union performance (#1176), thanks @herndlm!new
(#1205), thanks @VasekPurchart!Bleeding edge 🔪
is_array
(#1191), thanks @herndlm!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
: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
Bugfixes 🐛
curl_getinfo($ch, CURLINFO_CONTENT_TYPE)
(#1170), #6929, thanks @oschwald!bcdiv()
,bcmod()
,bcpowmod()
andbcsqrt()
in PHP 8.0 and higher (#1152), #5134, thanks @W0rma!int
andbool
args forstrlen()
(#1162), thanks @fluffycondor!float
andnull
forstrlen()
, improve support for booleans (#1199), thanks @fluffycondor!array_replace
(#1209), #7020, thanks @herndlm!ee934468b7
), #6944c5d0902d2b
), #6979Function signature fixes 🤖
DOMText::splitText()
may return false (#1180), thanks @xPaw!Collator
creation function/method can return null (#1182), thanks @finwe!SplObjectStorage
methods (#1185), thanks @Furgas!SimpleXMLElement::getDocNamespaces
(#1190), thanks @Furgas!v1.5.4
Compare Source
Bugfixes 🐛
843ebbb1d8
), #6552UnhandledMatchError
throw point (#1165), #6910, thanks @rajyan!in_array()
bug (0ae28f761b
)91c7507787
,5400b5858e
,c4c64fe6da
)Function signature fixes 🤖
show_source()
signature, an alias ofhighlight_file()
(#1160), thanks @staabm!getenv()
signature (#1161), thanks @staabm!v1.5.3
Compare Source
Improvements 🔧
6fa7c9097d
), https://github.com/phpstan/phpdoc-parser/pull/114, thanks @rvanvelzen!Bugfixes 🐛
Memcached::HAVE_*
constants as dynamic (#1142), #6263, thanks @VasekPurchart!array_fill_keys
andarray_combine
(#1139), thanks @canvural!Equal
(==
) expression specification with empty array on both sides (#1143), #6940, thanks @herndlm!array_fill_keys
for not constant arrays (#1145), thanks @canvural!false
return insubstr()
with PHP < 8 (#1144), #6939, thanks @herndlm!array_merge
lost non-empty-string keys type (#1135), #6927, #5846, #2567, thanks @staabm!v1.5.2
Compare Source
Bugfixes 🐛
22f755c6a0
)v1.5.1
Compare Source
Bugfixes 🐛
is_subclass_of()
: do not infer anything when context is falsy (#1124), #6891, thanks @VincentLanglet!Function signature fixes 🤖
getTrace()
return-type (#1123), thanks @staabm!Internals 🔍
0a3e1a7973
)6700eb69c1
,a3a7fad5b7
)v1.5.0
Compare Source
This release fixes 26 issues! 🎉
Improvements 🔧
OptimizedDirectorySourceLocator::locateIdentifiersByType()
returns all located classes or functions (#1080), thanks @tomasfejfar!e60d6d6e96
)ArraySearchFunctionTypeSpecifyingExtension
(#1086), #6863, thanks @staabm!ArrayReplaceFunctionReturnTypeExtension
(#1087), #5327, thanks @staabm!curl_getinfo
(#1072), thanks @PrinsFrank!value-of<BackedEnum>
(#1082), #6775, thanks @staabm!Bleeding edge 🔪
array_filter()
calls (#1077), #6840, thanks @leongersen!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
: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
Bugfixes 🐛
JSON_THROW_ON_ERROR
with optional bitwise flags (#1025), #6654, thanks @staabm!NeverType
(#1063), #5351, thanks @rajyan!$flags
arg inpreg_split()
(#1081), thanks @staabm!array_keys
andarray_values
with accessory types (#1084), #6859, thanks @staabm!UnhandledMatchError
(#1056), #6115, thanks @rajyan!@throws
tag is present withUnhandledMatchError
(#1103), thanks @rajyan!FloatType::accepts
handling ofCompoundType
s (#1097), #6872, thanks @herndlm!125619231f
), #6494enum_exists
in ClassExistsFunctionTypeSpecifyingExtension (#1109), thanks @staabm!BinaryOp
(#1105), #6870, #6890, thanks @rajyan!Function signature fixes 🤖
ReflectionMethod::$class
type toclass-string
(#1107), #6889, thanks @rvanvelzen!context
parameter signature infopen()
(#1113), thanks @bytestream!is_writeable()
calls (#1112), thanks @staabm!Internals 🔍
1.5.x
) instead ofmaster
phpstan.phar
checksum is computed and compared when running integration tests fromphpstan/phpstan
on pull requests inphpstan-src
. The integration tests run only when the checksum was changed. This means that for example if only unit tests in phpstan-src were changed, PHAR didn't change and those integration tests fromphpstan/phpstan
don't have to run.v1.4.10
Compare Source
?T
andT|null
(28776ffd46
), #6790TypeError
throw point by native type (#1065), #6791, #6786, thanks @rajyan!v1.4.9
Compare Source
Improvements 🔧
Identical
(===
and!==
) andEqual
(==
and!=
) with the same variables resolve toConstantBooleanType
(98c4d84ec9
)Equal
(==
and!=
) are delegated toIdentical
(===
and!==
) (316f269d6e
)Bugfixes 🐛
null
to a template type for a default parameter valuenull
(7a66cb6eda
), #6584c05ba984a0
), #67016525d6805b
)51e2df38ee
), #6591offsetSet
to get throw points for ArrayAccess assignment (#1054), #4852, thanks @rajyan!array_column()
aware of PHP version (#1053), thanks @jlherren!Equal
(==
and!=
) handling in TypeSpecifier (10b295f3cd
)Identical
(===
and!==
) (#1058)v1.4.8
Compare Source
Improvements 🔧
ignoreErrors
regexes during DIC compilation (save time in each run) (692158c194
), #6693parametersSchema
only during DIC compilation (50f25e95ad
)==
and===
expression (#1046), thanks @herndlm!strtotime()
with constant strings (#1045), thanks @Seldaek!Bugfixes 🐛
is_subclass_of
with same class (#1044), #6305, thanks @herndlm!d921d06770
), #6724, #6727c2b9e713da
), #3400, #6353, #5757, #5065ArrayType::traverse()
- create emptyConstantArrayType
in case ofnever
(8c1dfc1afb
)v1.4.7
Compare Source
This release fixes 43 issues! 🎉
Improvements 🔧
phpstan.dist.neon
as a config file (#1006), #6561, thanks @b1rdex!bbf14bf635
), thanks @Seldaek!bc481b74fb
)str_repeat
(#1030), #6679, thanks @staabm!TypeUtils::generalizeType()
(2674577128
)b49df58105
), #6550089d4c6fb6
), #6398Bugfixes 🐛
sizeof()
when usingunset()
(#971), #6488, thanks @staabm!TemplateType::isSubTypeOf()
andTemplateType::isAcceptedBy()
(#1001), #6589, thanks @arnaud-lb!non-empty-string
andstring
should error (#1011), #6624, thanks @staabm!TypeSpecifyingExtension
uses$overwrite=true
(#1011), #6620, thanks @staabm!@template
above a property (53563e9429
)SpecifiedTypes
forcount()
andstrlen()
in===
expressions (#1021), thanks @herndlm!cc6655f931
), #6696, #6112, #57490e5d58604e
), #66817110a088ff
)0808a89469
)dd5633f183
), #5969, #5295class-string
during template type inference (#1038), #6505, #6699, thanks @arnaud-lb!class-string
$class
parameter inis_subclass_of()
(#1039), #6698, #5369, thanks @arnaud-lb!EnumCaseObjectType
(9e428966d8
), #6695, #6433is_subclass_of()
foris_a()
(#1040), #6704, thanks @herndlm!7f643c5866
), #6715ArrayType::castToArrayKeyType()
for booleans (#1033), thanks @jlherren!ArrayColumnFunctionReturnTypeExtension
producing array key types (#1033), #6682, thanks @jlherren!in_array()
for arrays with union value type (4321374cad
), #6705, #5668, #5759, #3314, #5496, #4666, #3892, #5354, #2870Function signature fixes 🤖
c5f4c3b169
)868720e093
)86a63ff1f0
)set_error_handler()
. (#1008), #6619, thanks @johnbillion!PDOStatement::fetchAll
no longer returns false on PHP8 (#1014), thanks @xPaw!mb_*
fatal errors on php8 with invalid encoding (#969), thanks @staabm!$read
ofstream_select
to be nullable (#1031), thanks @niconoe-!PDOException::getCode()
return type (#1018), #6651, thanks @VincentLanglet!0|positive-int
(bleeding edge) (#1027), thanks @staabm!substr()
return type on PHP < 8 - use benevolent union type (#1036), thanks @Seldaek!\SplFileInfo
(#1034), #6680, thanks @siganushka!setFetchMode
signature withfetch_class
(#1043), thanks @Seldaek!preg_filter
return type extension (#1024), #6664, thanks @staabm!preg_match_all
return type on PHP 8 (#1023), thanks @staabm!v1.4.6
Compare Source
Improvements 🔧
implode()
function (#991), thanks @staabm!Bugfixes 🐛
TypeCombinator::remove()
toType::tryRemove()
(#994), #6438, thanks @arnaud-lb!0d288353ca
), #6566@var
right aboveforeach
(b6bbbaf6b0
), #6564:
(5162bcfea5
), https://github.com/composer/composer/issues/10498Function signature fixes 🤖
md5()
always returnnon-empty-string
(#987), thanks @janbarasek!Iterator
. (#988), thanks @johnbillion!round()
/ceil()
/floor()
(#729), thanks @johnbillion!SplFileObject::fstat()
(#996), thanks @johnbillion!v1.4.5
Compare Source
Improvements 🔧
--generate-baseline
(-b
) (#980), thanks @Seldaek!array_filter()
return type via string callable (#938), #6417, thanks @herndlm!Bugfixes 🐛
9f12f0fb48
), #6423, #6464, #6236, #6418, #6118, #6081, #6053, #6055, #5860, #62305d17b847d9
), #6117NeverType::toBoolean()
(fe3a3419d5
), #6258DatePeriod
constructor extension in subclasses (0c82b3a267
), #6500af38f03b41
), #6473d101764ff9
), #6501Function signature fixes 🤖
array_chunk
signature (#709), thanks @staabm!preg_replace_callback()
callable. (#758), thanks @johnbillion!array_splice()
argument$replacement
(#901), #6288, thanks @spawnia!stream_bucket_new
returns an object (#968), thanks @mind-bending-forks!mb_*
functions (#717), thanks @staabm!array_column()
withnull
as$column_key
(#970), thanks @jlherren!v1.4.4
Compare Source
Improvements 🔧
array_column()
(#948), thanks @jlherren!DatePeriod
+ constructor dynamic return type extension (#958), #5953, thanks @Alban-io!Bugfixes 🐛
array_filter()
flags for narrowing down types (#941), thanks @herndlm!1d8b2eb269
), #4656, #5305, #3384isset()
(f05e8eb8fe
), #4926isset()
,empty()
and null coalesce operator (??
) (3b17acc5de
), #4592, #4903, #2420, #2718, #3126, #4586, #4887Function signature fixes 🤖
Throwable::getTrace()
method (#914), thanks @ste93cry!v1.4.3
Compare Source
Improvements 🔧
--memory-limit
CLI option inclear-result-cache
command (156700b515
), #64327dd699f946
).memory_limit
file (daf7d5577b
), https://twitter.com/timacdonald87/status/1484804225658146823Bugfixes 🐛
b43c057d2d
), #6399, #435754f67c5252
), #6231#[ReturnTypeWillChange]
on PHP 7.1-7.4 (bf362441dc
,639a055975
), #6414array_filter
with callback that always evaluates to false (#939), thanks @herndlm!a2acf64f79
), #5817f1734dc531
), #6466Function signature fixes 🤖
Ds\Set::reduce()
to stubs (#942), thanks @ZebulanStanphill!*strlen()
return type to exclude negative integers (#945), thanks @staabm!DatePeriod::getEndDate
declaration (#951), thanks @nyamsprod!v1.4.2
Compare Source
PHP_VERSION_ID
(433511a3eb
), #6386, https://github.com/api-platform/core/issues/4614, https://github.com/api-platform/api-platform/issues/2101121e0212db
)ObjectType::equals()
when compared toEnumCaseObjectType
(ab0245c49a
), #63943aa878f2b2
), #6404a5447db695
), #6393, #5698v1.4.1
Compare Source
Improvements 🔧
==
operator for the same types on both sides (e40eff0a8e
), #6370, #4413ClassReflection::getBackedEnumType()
method (a0ed2d304e
)BenevolentUnionType
return type without dynamic return type extension (723dfc51ea
), https://github.com/phpstan/phpstan/discussions/6391Bugfixes 🐛
__unserialize
(#929), thanks @ruudk!UnitEnum
andBackedEnum
(67d3a882a8
), #6385ConstantArrayTypeBuilder
- fix for potential performance problems (86b93068ae
), #6375Function signature fixes 🤖
Set::map()
method to functionMap (#923), thanks @simPod!gnupg_verify()
accepts false fot its signature param (#925), thanks @spaze!random_bytes()
(#926), thanks @staabm!count_chars()
mode-param (#927), thanks @staabm!getdate()
return type (#928), thanks @staabm!v1.4.0
Compare Source
This release fixes 25 issues! 🎉
Major new features 🚀
readonly
properties (RFC)Improvements 🔧
ParametersAcceptorSelector
- message forShouldNotHappenException
(d3c34832c7
), #6328BenevolentUnionType
is covered by BC promise (8f28dc8453
)Bugfixes 🐛
require
statement (b5a2c8f2b5
), #6348ClosureType
(#921), thanks @canvural!random_int()
without args crash (6d7ba0f0db
), #6361Thanks to some internal refactorings listed below, the following issues have been fixed: #5337, #4910, #5316, #5607, #3766, #3858, #3310, #3264, #2806, #5328, #3044, #6184, #3339, #5656, #5362, #3867, #5707
4fb1a77b02
)ConstantArrayType
after setting new offset (ec117fa2ae
)ConstantArrayTypeBuilder
- preserveConstantArrayType
for integer range offsets (3eab4628f2
)ConstantIntegerType
in Scope (d6c7595ba5
)36513388a6
)Function signature fixes 🤖
gmp_div
(#915), thanks @danielmarschall!PDO::prepare()
might returnfalse
(#916,a9881e3afd
), thanks @staabm!preg_match*
return type signatures (#918), thanks @staabm!v1.3.3
Compare Source
Improvements 🔧
@method
tag forgetCode()
method above child Exception classes (e04cc8dfb8
)phpstan/phpstan-src
now uses promoted properties (https://github.com/phpstan/phpstan-src/pull/910)v1.3.2
Compare Source
Improvements
10e4602688
), #6312Bugfixes 🐛
8498b01253
), #630663838ee7c2
)11176c76aa
), #62530993d180e5
), #6295Function signature fixes 🤖
false
since PHP 5.4 (#907), thanks @johnbillion!Exception::getCode()
type (11817175c9
)v1.3.1
Compare Source
Bugfixes 🐛
mixed
type not considered nullable (c0aad86b54
), #6293, #6158fc5be6a991
), #6264PDO::pgsqlGetNotify()
call (3624bbb2c4
), #6255#!
shebang (c87284a8ea
), #6252@mixin
extensions (9ab4e6fd8e
), #6300Function signature fixes 🤖
SessionHandler::gc()
(#899), thanks @Khartir!preg_quote
to NonEmptyStringFunctionsReturnTypeExtension (#881), thanks @staabm!v1.3.0
Compare Source
Major new features 🚀
e30f4467ab
phpstan/phpstan-src
is now PHP 8.0+ only, while the distribution packagephpstan/phpstan
still supports PHP 7.1+.Improvements 🔧
nikic/php-parser
to 4.13.2 (8939964ecf
)--allow-empty-baseline
to allow generating empty baseline (#776), thanks @Lctrs!@phpstan-property
,@phpstan-property-read
, and@phpstan-property-write
(#775), thanks @mad-briller!key-of<...>
andvalue-of<...>
types (#800), thanks @ste93cry!ErrorFormatter
(#854), thanks @ruudk!e40ba15698
)Bugfixes 🐛
echo
isn't callable either. (#777), thanks @johnbillion!$object::class
with Identical (#745), thanks @marmichalski!e61ad9575a
), #5433256d11b8fe
)ae6dca5d4f
)e9dd3a3033
)97e153ce52
)cfb6fad051
)b927c87f58
), #6187, #6096hasClass()
as case-sensitive (792ce0af4b
), #6096e30f4467ab
)@
operator should use& $errno
check (#889), thanks @samsonasik!9adf6bff2e
)8519cca424
)Function signature fixes 🤖
trigger_error
(#766), thanks @staabm!array_count_values()
can never contain a zero. (#773), thanks @johnbillion!date_parse
anddate_parse_from_format
functions (#807), thanks @ste93cry!get_resources()
(#837), thanks @MidnightDesign!restore_error_handler
andrestore_exception_handler
always return booleantrue
. (#850), thanks @johnbillion!DateTimeZone
methods (#857), thanks @johnbillion!Set::map()
method toext-ds
stub (#855), thanks @simPod!preg_split
(a16c7aeac1
), thanks @clxmstaab!v1.2.0
Compare Source
Improvements 🔧
new
in initializers - RFC (1a102fec28
)array_is_list()
- RFC (#770), thanks @canvural!literal-string
with encapsed strings (#768), thanks @craigfrancis!2db3c268e2
)rules
config section by their class name (50cb90ddc6
)Bugfixes 🐛
::class
is always considered a classname (da34d3f1d6
), #59796573959829
), #59547c8e81dcf8
), #5906@var
tags (2652f2dc6c
), #59216366066f3b
), #5898Function signature fixes 🤖
08f3e2d023
), #6014v1.1.2
Compare Source
Bugfixes 🐛
=&
) too (74787be3fe
), #5935self::
(b5e44f7936
), #5951pecl_http
(9f2b6eb6b8
,bdd25238b1
), #5460, thanks @kukulich!2427b83fc1
)Function signature fixes 🤖
v1.1.1
Compare Source
Bugfixes 🐛
/** @​phpstan-ignore-line */
and/** @​phpstan-ignore-next-line */
annotations sometimes not working because of AST (9474696dff
), #4750, #4759, #3834, #3563, #4250, #4798function_exists()
check (28e8c11a2b
), #3576function_exists()
similar tois_callable()
(4a988637e6
), #1849v1.1.0
Compare Source
Improvements 🔧
nikic/php-parser
to 4.13.1 (6a64c8aa95
), #5458jetbrains/phpstorm-stubs
(546e87c61f
), #5833PhpStormStubsElementAvailable
attribute injetbrains/phpstorm-stubs
(e41e66a1ec
)never
return type - RFC (59be92fd7e
)be05557435
,021e25ed2b
), #58700e98150eff
,762fc470a2
)e3a0e0d1b9
)Bugfixes 🐛
Function signature fixes 🤖
get_loaded_extensions()
(#754), thanks @dktapps!call_user_func_array()
support named arguments (#727), thanks @mglaman!phpversion()
does not return false when no arguments are given (#753), thanks @dktapps!v1.0.2
Compare Source
Bugfixes 🐛
Composer
namespace only with static reflection, some classes in PHAR are unprefixed (95754d1c52
), https://github.com/composer/composer/pull/10253c59330c539
), #5834, #5881, #5872, #5861Function signature fixes 🤖
array_map
parameter (94333459e3
)connection_aborted()
signature (#715), thanks @staabm!str_split()
signature (#718), thanks @staabm!DateFunctionReturnTypeExtension
: support more precise single-char date-formats (#721), thanks @staabm!$preserve_keys
argument foriterator_to_array()
(#748), thanks @Lctrs!v1.0.1
Compare Source
e5f8e72c41
), #5875DerivativeContainerFactory
- pass all arguments to the derived container (f28c7e9d06
)PhpStanNamespaceIn3rdPartyPackageRule
- fix segfault when there's no composer.json (d4efedbd50
)v1.0.0
Compare Source
PHPStan 1.0 is here and I'm really excited about it! Read the accompanying article on PHPStan's blog and also check out the merchandise we're selling for limited time (until November 22nd). It includes white and blue PHPStan t-shirts, PHPStan stickers, and also something very special: Rule level badges that you can pin to your clothes to show off that you care about code quality 😊
Major new features 🚀
e5bbb52fbc
)d4edc59b36
)4588e73dd6
)c98d0a4946
)03341cc6bf
,51d7431dbe
)New rules
6905d66cf4
)89acb0db44
)@final
classes (dffd2c2351
), https://github.com/phpstan/phpstan/discussions/534318bdd34a80
)0f4885aa10
), #4281??
operator issues (#36), thanks @leongersen!@var
PHPDoc tag (58860536dc
)static::
(d8e89538ac
,bad2607a03
,270326a1ed
)780a54cd01
)284af50d76
), #5222@throws void
does not have an explicit throw point (8b3382acea
)aae34d9350
), #3267isset()
(25b61d974f
)empty()
rule (601460ccec
), #970217fac3098
,fb3f83e8f6
)e81ccd40a4
)ce9299c0e9
)3f712be7c4
)array_map()
andarray_filter()
calls (#555), #5609, #5356, #1954, thanks @BackEndTea!implode()
function rule (#679), thanks @staabm!DateTime
instantiation (#380), thanks @b1rdex!random_int()
dynamic return type extension and parameters rule (#99), thanks @cs278!9070c5bce3
), #25812f456b91bb
), #5148BC breaks for end-users
max
is now level 9. Feel free to updatemax
to8
if your code isn't ready.numeric-string
(it was previously described asstring&numeric
), and also array shapes.baselineNeon
error formatter, use--generate-baseline
CLI option instead (492cfbcd74
)polluteCatchScopeWithTryAssignments
config parameter (8933c7e28c
)autoload_files
parameter - use Discovering Symbols instead (7a21246cae
)autoload_directories
parameter - use Discovering Symbols instead (f67b48a712
)bootstrap
parameter - usebootstrapFiles
instead (1baa29425d
)implicitThrows
configuration parameter toexceptions.implicitThrows
(96b7c48025
)--paths-file
CLI option (5670cf2217
), #5756dump-deps
command (9c7017c697
)excludes_analyse
option, useexcludePaths
instead (d25c5e5a6c
)The following are interesting only if you create a custom ruleset in your configuration file:
DeadCatchRule
, replaced byCatchWithUnthrownExceptionRule
(4dba60bacb
)VariableCertaintyInIssetRule
, replaced byIssetRule
(2e858dee38
)MissingClosureNativeReturnTypehintRule
, no longer needed thanks to type inference (1c34d8dc85
)003ab1aea5
)BC breaks for extension developers
nikic/php-parser
to version 4.13.0, you should now use->getArgs()
instead of->args
wherever possible.* Helpful message about this change is also included in PHPStan itself:
c836a423d3
PHPStan\Parser\Parser
service is no longer autowired. You need to choose the right instance for your needs and register it in thearguments
section of your service that needs the parser in the configuration. The Parser services you can choose from are:@defaultAnalysisParser
- the best choice if you're parsing files that are among the analysed files@currentPhpVersionSimpleDirectParser
- the closest choice to default behaviour from previous PHPStan versions038c7a518f
CompoundTypeHelper
(145c4e3af4
)CommentHelper
(ebad6f61b9
)DependencyDumper
(9c7017c697
)PHPStan\Reflection\Generic\ResolvedFunctionVariant
, replaced byPHPStan\Reflection\ResolvedFunctionVariant
(1cc6c8175a
)ClassReflection::getNativeMethods()
, usegetNativeReflection()
instead (d2c1446b3b
)PhpPropertyReflection::hasPhpDoc()
, replaced byhasPhpDocType()
(bedd5be991
)NodeDependencies
no longer iterable (f76875a84d
)TestCase
toPHPStanTestCase
(#634), thanks @frankdejonge!StaticType
andThisType
- requireClassReflection
in constructor (7aabc84835
)PHPStanTestCase
- extensions can no longer be provided by overriding methods fromPHPStanTestCase
. UsegetAdditionalConfigFiles()
instead. (65efd93f76
,239291a910
)d578151030
)|false
to|null
(629ccf6b02
)65681033ff
)1f4062fe2d
)BrokerAwareExtension
(db2f7fb9e7
)PHPStanTestCase::createBroker()
. UsecreateReflectionProvider()
instead. (1e5cf58e07
)PHPStan\Broker\Broker
. UsePHPStan\Reflection\ReflectionProvider
instead. (c7755948c1
)PHPStan\Broker\Broker::getInstance()
. UsePHPStan\Reflection\ReflectionProviderStaticAccessor
instead. (4e7d60d74b
)IntersectionType
with less than two types (f7d232a666
)ReflectionWithFilename
, useClassReflection|FunctionReflection
instead (3738fcd98a
)Improvements 🔧
FileHelper::normalizePath()
(#735), thanks @staabm!TypeCombinator::compareTypesInUnion()
(#742), thanks @voku!TypeCombinator::union()
(#743), thanks @voku!TypeCombinator::union()
v2 (#747), thanks @voku!TypeCombinator::intersect()
(#747), thanks @voku!TypeCombinator::remove()
(#746), thanks @voku!f3c054b199
)ac6a1022ff
)25cb765aca
)d781e34a35
)27df5cf55e
), #5825analysedPathsFromConfig
(9f5f911337
), #5850IssetRule
everything whatVariableCertaintyInIssetRule
does (9689fbd0ed
), #970MissingReturnRule
- make the error non-ignorable for native typehints (9ecefd56d8
)get_class()
returnsfalse
for mixed argument types (e86742db58
), #4741RecursiveIterator
,RecursiveArrayIterator
,WeakMap
(0b92888320
)b7bd0a98db
)4a82eec404
)new $string
leads toobject
, notmixed
(78a9f057d7
)interface-string
andtrait-string
(d0ef5d4af7
)915fa2e2bb
)SpecifiedTypes
phpdocs (#682), thanks @staabmPHP_INT_MAX
as positive integer (#684), thanks @herndlm!config.platform.php
in project'scomposer.json
is respected and overrides the current runtime PHP version (d235195220
)40a76e88d0
,ae9a558484
)5314a6b205
)c721459764
)int|string
(724c8bad2e
), #3753003d235cc5
), #37231de5de80ec
), #3753preserveOriginalNames
set to true (2a9d1beb7a
)4e5ed5d8b9
,fd99879e0b
,9d0e070ed9
,458a8fb663
,50a7141a6e
)E_DEPRECATED
(1a4338552e
)5ddca4279e
)Bugfixes 🐛
84b09349dc
)Throwable::toString()
can throw an exception (18adc8c99f
)new $object
with a template type (956a7f4835
)never
is always an explicit throw point (c362fc59b2
), #5627be27584056
), #56391e717d73c2
)0837be403f
)0cfeb1b930
), #5651c524c4e134
), #4516d484ea890d
), #4370a2bdfd1485
), #56695f91da66bd
), #55016754df565a
), #4743, #5017ac5fe1bc92
), #569284bafe79d6
)ca3aad0790
), #5709+
-operator withnon-empty-array
should lead tonon-empty-array
(#739), thanks @staabm!Function signature fixes 🤖
$cmp_function
parameters to$callback
(27a5d0f10b
)2b51392ad6
), #56380d025e7bc2
)static
(4653d1574e
), #5700exit()
status should be in the range 0 to 254 (#707), thanks @staabm!Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Renovate Bot.
⚠️ Artifact update problem
Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.
♻ Renovate will retry this branch, including artifacts, only when one of the following happens:
The artifact failure details are included below:
File name: composer.lock
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.