CARVIEW |
Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 928
Releases: phpstan/phpstan
2.1.19
Improvements π§
- Remove manual wrapping for error table (#4035), thanks @schlndh!
- Improve array_search inference (#4014), thanks @VincentLanglet!
- Improve
str_split()
return type (#3999), thanks @VincentLanglet! - Detect more duplicate array keys (#4116), thanks @VincentLanglet!
- Add support for multiple identifiers in ignoreErrors configuration (#4080), thanks @janedbal!
- Fix missing detection of dead code in expressions (#4090), #13232, #11909, thanks @staabm!
Bugfixes π
- Fix
IntersectionType::isIterableOnce()
(#4106), #13248, thanks @VincentLanglet! - Fix false positive unreachable (#4112), #7531, thanks @VincentLanglet!
- Improve array filter return type on PHP 8 (#4123), #12689, thanks @VincentLanglet!
- Fix analysis on
array_map
with named arguments (#3763), #12317, thanks @takaram! - Fix
ObjectType::getOffsetValueType()
(#4126), #12125, #9575, #9456, #13144, thanks @VincentLanglet! - Fix for respecting rule levels for
property.nameNotString
(#4117), #13271 - Improve trim on numeric string (#4130), #10860, thanks @VincentLanglet!
- Fix intersection with substracted (#4132), thanks @VincentLanglet!
- Understand at least one argument for non empty array unpacked (#4134), #10020, #8506, thanks @VincentLanglet!
- Handle empty array case via
ConstantArrayType::spliceArray()
(#4140), #13279, thanks @herndlm! - Fix lowercase string usage in template (#4122), #12739, thanks @VincentLanglet!
- Fix "Unsafe use of new static when trait enforces constructor via abstract method" (#4114), #9654, thanks @VincentLanglet!
- Nothing is lower than null (#4131), #10719, #9141, thanks @VincentLanglet!
- Hotfix - allow people to override
exceptionTypeResolver
in neon (phpstan/phpstan-src@e7febc3)
Function signature fixes π€
- Improve sys_getloadavg return type (#4107), #13198, thanks @VincentLanglet!
- Fix PDO quote return type (#4113), #10512, thanks @VincentLanglet!
- Fix pg_lo_import definition (#4120), thanks @VincentLanglet!
- Update eio function return type (#4124), thanks @VincentLanglet!
- Update
stream_filter_*
signatures (#4125), #12380, thanks @VincentLanglet! - Update DomNode return type (#4137), thanks @VincentLanglet!
- Update Spl methods with side effects (#4129), #10884, #9180, thanks @VincentLanglet!
- Fix odbc definitions (#4119), thanks @VincentLanglet!
Internals π
- Added regression test (#4105), #8372, thanks @staabm!
- Added regression test (#4109), #13043, thanks @VincentLanglet!
- Add regression tests for strict rules issues (#4110), phpstan/phpstan-strict-rules#147, phpstan/phpstan-strict-rules#143, thanks @VincentLanglet!
- Fix function name typo (#4118), thanks @VincentLanglet!
- Fix typo in error message in
#[RequiresPhp]
attribute rule (#4127), thanks @takaram! - Update bashunit:0.22.0 (#4133), thanks @Chemaclass!
- Add regression test (#4135), #9706, thanks @VincentLanglet!
- Add regression test (#4136), #9401, thanks @VincentLanglet!
- Introduce
dumpNativeType
(#4108), thanks @VincentLanglet!
Assets 4
2.1.18
Bleeding edge πͺ
- Name string expr check in ClassConstantRule (#3910), thanks @zonuexe!
- Name string expr check in AccessPropertiesCheck (#4094), 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
:
includes:
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
Of course, there are no backwards compatibility guarantees when you include this file. The behaviour and reported errors can change in minor versions with this file included. Learn more
Improvements π§
- Add
@phpstan-sealed
support (#4095), thanks @VincentLanglet! - This release includes improvements and bugfixes from PHPStan 1.12.28
- Validate registered services tags against implemented interface (phpstan/phpstan-src@f375a81)
- Only change exit code with
--fail-without-result-cache
when the error formatter returns 0 (phpstan/phpstan-src@df9fa6e) - Normalize arguments before calling into TypeSpecifyingExtensions (#4034), #13088, thanks @staabm!
- Use
count()
return type inObjectType::getArraySize()
(#4072, #4078), thanks @vojtech-dobes! - Add method to get ObjectType from ClassReflection and EnumCaseReflection (#4099), thanks @calebdw!
- Playground & Issue bot: PhpdocCommentRule (#4074), thanks @staabm!
- Describe array shape key in quotes unless valid identifier (#4071), thanks @vojtech-dobes!
- Improve TrimDynamicReturnType for constant strings (#4028), thanks @VincentLanglet!
- Introduce ArrayPadDynamicReturnTypeExtension (#4017), #12305, thanks @VincentLanglet!
- Introduce
PDO::connect
dynamic method return type extension (#4015), #12359, thanks @VincentLanglet! - Add
PhpVersion::__construct
to BC promise (#4022), #8582, thanks @VincentLanglet! - Support
switch
on::class
(#4011), #13069, thanks @VincentLanglet! - More precise
array_keys
return type (#3590), #11928, thanks @staabm!
Bugfixes π
- Fix
ClosureType::equals()
for pure/impure closures (phpstan/phpstan-src@02066c7), #13067 - Fix for benevolent union (#4039), #13098, thanks @VincentLanglet!
- Fix resolving generics from phpstorm-stubs (phpstan/phpstan-src@c0f2e9e), #13171
- Correctly retrieve hasSideEffects metadata for inherited methods (#4079), #13201, thanks @zonuexe!
- ObjectType: fix hasConstant behaviour (#4089), thanks @janedbal!
- Explicitly use StreamSelectLoop for PHPStan Pro download (#4077), thanks @calebdw!
- stream_get_contents() does not return FALSE unless an invalid position is provided (#4092), #3396, thanks @staabm!
- Revert "non-falsy-string cannot be converted to 0" (#3997), thanks @VincentLanglet!
- Improve return type of array map by invoking dynamic function return type extensions for the callback (#4068), #11180, #3156, thanks @VincentLanglet!
- Avoid false positive
in_array()
always true (#4073), #13151, #8818, #12755, #12412, thanks @VincentLanglet! - Fix always-true detection in in_array with union type haystack (#3888), #12755, thanks @sayuprc!
- Fix NAN inferences (#4040), #13097, thanks @VincentLanglet!
- Fix
MixedType->equals(ErrorType)
(#3934), thanks @staabm! - Handle class without namespace for internal rule (#3998), #13041, thanks @VincentLanglet!
- Resolve substr based on configured PHP version instead of runtime PHP version (#4061), #13129, thanks @VincentLanglet!
- Keep list on
unset()
with nested dim fetch (#3964), #12927, #12330, #11171, #8282, #12754, thanks @staabm!
Function signature fixes π€
- These DateTimeInterface methods are pure (phpstan/phpstan-src@7534ee1)
- More precise return type for
posix_getpwnam()
(#4091), #12254, thanks @zonuexe! - Fix
SimpleXMLElement::xpath
return type (#4096), thanks @VincentLanglet! - Fix fwrite (#4087), thanks @VincentLanglet!
- Update
locale_get_display_x()
return types (#4085), thanks @cfahner! - Fix
DOMElement::$attributes
stub (#4029), #13076, thanks @VincentLanglet! - Improve mb detect encoding signature (#4020), #8922, thanks @VincentLanglet!
Internals π
- Moved the list of relative paths in parameters to
parametersSchema.neon
(phpstan/phpstan-src@72c2a8d)- This now allows extensions to declare which of their custom parameters should be treated as relative path to expand
- Scaffolding for auto-fixable rules
- This feature will be fully released in PHPStan 2.2.0
- phpstan-src embraces attributes!
- This is enabled thanks to olvlvl/composer-attribute-collector and AutowiredAttributeServicesExtension
- PHPStan still supports PHP 7.4 because this package bakes compiled list of classes and parameters with attributes to a plain PHP file
vendor/attributes.php
. - Slimmer config files
- Services are now registered with the help of these attributes:
- Rules and collectors for specific levels are registered with:
- phpstan-src now includes more custom opinionated rules specific to development of PHPStan itself
- Attributes must have named arguments (phpstan/phpstan-src@676ad27)
- Use named arguments instead of passing default parameter values phpstan/phpstan-src@35fbc87
- As a limitation of simple-downgrader, this does not apply to MethodCall. Only to New_, StaticCall, and FuncCall.
- Add
#[Override]
for methods overriding 3rd party (phpstan/phpstan-src@98ed732) - SkipTestsWithRequiresPhpAttributeRule (phpstan/phpstan-src@6851343)
- Simplify property memoization for Flyweight pattern by replacing it with
??=
(#4084), thanks @zonuexe! - Simplify by replacing chained
$var === const
within_array()
(#4098), thanks @zonuexe!
- DI Container - throw unprefixed exception (phpstan/phpstan-src@2443663)
- Require Box with Composer (#2955)
- Use 7.4 for PHP-Scoper PHP version (#2955), thanks @ondrejmirtes!
- Update to PHPUnit 10 ((#4046))
- Update to PHPUnit 11 (#4057)
- Upgrade bashunit:0.20 (#4048), thanks @Chemaclass!
...
Assets 4
1.12.28
Improvements π§
- More precise elapsed time if it's a low number (phpstan/phpstan-src@7644bd0)
Bugfixes π
- Fix recursion with object shapes in
@property
referencing other class and then back in recursive manner (phpstan/phpstan-src@33c2cb1), #13057 - Fix
@var
PHPDoc type inheritance for class constants (#4008), #10911, thanks @VincentLanglet! - Allow
getenv(null)
for PHP 8.0+ (#4007), #13065, thanks @VincentLanglet! - Properly restore error handler for collecting errors (phpstan/phpstan-src@43c44ee)
- Fix infinite recursion with TemplateIterableType (phpstan/phpstan-src@400ba6d), #13218
- Avoid error with constant name
$
(#4006), #12095, thanks @VincentLanglet! - Array without
0
in key type is not a list (#4018), #9487, thanks @VincentLanglet! - Fix HasOffsetValueType::searchArray (#4013), thanks @VincentLanglet!
- Rework ArrayReplaceFunctionReturnTypeExtension (#3958), #12828, thanks @VincentLanglet!
Function signature fixes π€
- Update PDO errorCode return type (#4005), #12571, thanks @VincentLanglet!
- Fix return type of
bzdecompress()
(#4088), thanks @jlherren! - Improve
mb_convert_encoding
return type (#4010), thanks @VincentLanglet!
Internals π
- Migrate legacy tests (#4000), thanks @VincentLanglet!
Assets 4
2.1.17
Major new features π
- Introducing Editor Mode (phpstan/phpstan-src@74b909a)
- Learn more: https://phpstan.org/user-guide/editor-mode
Bleeding edge πͺ
- Report
new static()
in static method of abstract class - level 0 (phpstan/phpstan-src@a5f7c06)
If you want to see the shape of things to come and adopt bleeding edge features early, you can include this config file in your project's phpstan.neon
:
includes:
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
Of course, there are no backwards compatibility guarantees when you include this file. The behaviour and reported errors can change in minor versions with this file included. Learn more
Improvements π§
- This release includes improvements and bugfixes from PHPStan 1.12.27
Bugfixes π
- Fix
array_column()
with explicit null$index_key
(#3970), #12945, thanks @herndlm! - AlwaysRememberedExpr - use
getNativeExprType
(phpstan/phpstan-src@222676e) - Invalidate result cache properly when property hook changes (phpstan/phpstan-src@dff492e, phpstan/phpstan-src@268d7c6)
- Result cache - react to property having abstract/final/asymmetric visibility changed (phpstan/phpstan-src@0ad2a6a)
- Result cache - react to property being virtual changing (phpstan/phpstan-src@e33a560)
Function signature fixes π€
- Update
libxml_get_errors()
(#3973), thanks @jack-worman!
Internals π
- Call
ProcessPromise::cancel()
from deferred canceller (phpstan/phpstan-src@df4c1f3) - Solve some cases of dead code (phpstan/phpstan-src@e1e8302)
- Remove dead code (phpstan/phpstan-src@d88e2fe)
- Remove unused method from interface (phpstan/phpstan-src@2ac0a17)
- Remove unused method from PathNotFoundException (phpstan/phpstan-src@aaa1424)
- Remove
getPhpDocReturnTypeWithUnresolvableTemplateTypes
fromResolvedFunctionVariantWithCallable
(phpstan/phpstan-src@e3c76ad) - Remove more dead code (phpstan/phpstan-src@2f66ec6)
- Install & configure shipmonk/dead-code-detector (#3996), thanks @janedbal!
- Drop unused SymfonyStyle::getSymfonyStyle (#3996), thanks @janedbal!
- Drop unused NeonAdapter::dump (#3996), thanks @janedbal!
- Drop unused FileMonitor::getTotalFilesCount (#3996), thanks @janedbal!
- Drop unused SetterReflectionProviderProvider (#3996), thanks @janedbal!
- Drop dead dataProvider in ExistingClassesInTypehintsRuleTest (#3996), thanks @janedbal!
- Drop unused ResolvedPropertyReflection::getDeclaringTrait (#3996), thanks @janedbal!
- Drop unused ProcessPromise::getName (#3996), thanks @janedbal!
- Drop unused PhpDocBlock::isExplicit (#3996), thanks @janedbal!
- Drop dead TemplateTypeTrait::shouldGeneralizeInferredType (overwritten in all children) (#3996), thanks @janedbal!
- SimultaneousTypeTraverser to be covered by BC promise (#3996), thanks @janedbal!
Assets 4
1.12.27
Major new features π
- Introducing Editor Mode (phpstan/phpstan-src@74b909a)
- Learn more: https://phpstan.org/user-guide/editor-mode
Improvements π§
- Result cache traits optimization - analyse only files using trait when trait implementation changes (phpstan/phpstan-src@bd6fc4e)
- InitializerExprTypeResolver - optimize arithmetical and bitwise operations for large types (phpstan/phpstan-src@275d3b5, phpstan/phpstan-src@572e0e8)
- Limit how big int-mask type can be (phpstan/phpstan-src@80b40f2)
Bugfixes π
- Fix result cache getting stale when editing files mid-analysis (phpstan/phpstan-src@0536d11), #11788
- Result cache should be invalidated when files change in paths excluded for analysis but not scanning (phpstan/phpstan-src@408692e), #12381, #7339
- PHPStan Pro - refresh errors when scanned file is changed (phpstan/phpstan-src@7e3639b), #12465
- Result cache - add traits to dependencies recursively (phpstan/phpstan-src@e5db864)
Assets 4
2.1.16
Improvements π§
- Support for
@final
PHPDoc tag above properties (#3990), #12999, thanks @lpd-au! - Faster ClassNameHelper (#3994), thanks @staabm!
Bugfixes π
- DuplicateKeysInLiteralArraysRule: Fixed union type handling (#3993), #13013, #13022, thanks @staabm!
- Improve
preg_split()
function return type (#3757), thanks @malsuke!
Function signature fixes π€
Assets 4
2.1.15
Improvements π§
- This release includes improvements and bugfixes from PHPStan 1.12.26
- TableErrorFormatter: improve formatting of error tips (#3821), thanks @FeBe95!
- InstantiationRule - call RestrictedMethodUsageExtension for constructor (phpstan/phpstan-src@8edfa9f)
- Call RestrictedMethodUsageExtension for
__toString
methods in(string)
cast (phpstan/phpstan-src@ce257d9)
Bugfixes π
- Fix GetDebugTypeFunctionReturnTypeExtension - should use TypeCombinator instead of
new UnionType
(phpstan/phpstan-src@1044f11), #12512 - Remember value of arguments passed to
{min,max}()
(#3928), #12731, thanks @cs278! - Revert "Useful PhpMethodReflection native type refactoring from #3966" (#3979), thanks @samsonasik!
- Respect asserts and throws on pure functions that return void (#3719), #12224, thanks @jack-worman!
- Disable purity check for non-final methods (#3913), #12382, thanks @VincentLanglet!
- Fix
IterableType::equals()
withTemplateIterableType
(#3991), thanks @staabm! - Restricted usage extensions - do not report false positives for Symfony polyfills (phpstan/phpstan-src@4a907f1), #12951
Function signature fixes π€
- Add stub for
DOMNode::hasAttributes
(#3800), thanks @Niklan! - Update PhpStorm stubs (#3989), thanks @phpstan-bot!
- Remove MongoDB extension from function map (#3891), thanks @alcaeus!
Internals π
Assets 4
1.12.26
Improvements π§
- Add callback types for array_uintersect etc. (#3282), #7707, thanks @schlndh!
- Support iterable as template type bound (#3984), #12214, thanks @RobertMe!
- Introduce StrrevFunctionReturnTypeExtension (#3960), thanks @VincentLanglet!
Bugfixes π
- Fix ImpossibleCheckTypeFunctionCallRule for
is_subclass_of
andis_a
(#3788), #3979, #8464, thanks @VincentLanglet! - Fix
numeric-string
toarray-key
(#3326), #4163, #4671, #8592, #11390, #12413, thanks @VincentLanglet! - Fix
callable-string
must benon-empty-string
(#3983), #12979, thanks @aivchen! - Use SoapClientMethodsClassReflectionExtension as last extension (#3955), #12834, thanks @VincentLanglet!
Function signature fixes π€
- Fix mb_convert_encoding signature (#3914), #12309, thanks @VincentLanglet!
Assets 4
2.1.14
Bugfixes π
- More precise property types after assignment when
strict_types=0
(#3965), #12946, #12940, #12950, #12947, thanks @staabm! - Fix
array_slice()
edge cases (#3959), thanks @herndlm! non-falsy-string
cannot be converted to0
(#3971), thanks @staabm!- Fix crash on dynamic numeric-string symbols (#3975), #12949, thanks @staabm!
Internals π
- Remove useless assign
$parentNode = $parentNode
(#3938), thanks @samsonasik! - TypehintHelper: remove unneeded default param value (#3968), thanks @staabm!
- Useful PhpMethodReflection native type refactoring from #3966 (phpstan/phpstan-src@3854cbc)
Assets 4
2.1.13
Major new features π
- Restricted Usage Extensions
Bleeding edge πͺ
- Report
@internal
symbols usage from outside their top namespace, #1178
If you want to see the shape of things to come and adopt bleeding edge features early, you can include this config file in your project's phpstan.neon
:
includes:
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
Of course, there are no backwards compatibility guarantees when you include this file. The behaviour and reported errors can change in minor versions with this file included. Learn more
Improvements π§
- Improve return type of
array_splice()
(#3947), thanks @herndlm! - Handle preserve_keys in
array_slice()
for normal arrays (#3946), #12880, thanks @herndlm! - Improve
ConstantArrayType::sliceArray()
with non constant integer args (#3949), thanks @herndlm! - TableErrorFormatter: visually differentiate phpstan assertion errors from rule errors (#3951), thanks @staabm!
Bugfixes π
- Consider comparison as strict when type is the same (#3942), #12884, thanks @VincentLanglet!
- Fix wrong property type after assigning iterable type (phpstan/phpstan-src@7c1ee34), #12891
Scope::rememberConstructorScope()
should not remember the function scope (#3944), spaze/phpstan-disallowed-calls#323, thanks @staabm!- Fix imprecise property native types after assignment (#3945), #12902, thanks @staabm!
- Fix invalidating static property access after impure call (#3950), #11019, #3747, #8523, #4864, #4443, thanks @staabm!
- More precise string functions return type with replacement array (#3963), #12928, thanks @staabm!
- Fix
session_set_cookie_params
call with named arguments (phpstan/phpstan-src@72e37dc), #12934
Internals π
- MutatingScope: remove unnecessary callback functions (#3916), thanks @staabm!
- Fix occasional failure in ParallelAnalyserIntegrationTest (phpstan/phpstan-src@4f5a63a)
- MethodReflection - fix isInternal vs. isBuiltin (phpstan/phpstan-src@3024c02)
- Simplify degradation to general array in
ConstantArrayType::shuffle()
(#3948), thanks @herndlm! ExtendedPropertyReflection::getName()
(phpstan/phpstan-src@ff198c9)- Micro optimize LazyInternalScopeFactory (#3962), thanks @staabm!