Releases: phpstan/phpstan
1.10.49
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
:
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 🔧
Bugfixes 🐛
- Fix
count(list)
regression (#2813), thanks @staabm! - Make AcceptsResult reasons unique (phpstan/phpstan-src@01aabcf)
Function signature fixes 🤖
- Make
SimpleXMLElement
method return types benevolent (when they returnstatic|null
) (phpstan/phpstan-src@fb76c9f)
1.10.48
Bleeding edge 🔪
- TooWideMethodReturnTypehintRule - always report for final methods (phpstan/phpstan-src@c30e9a4)
- LogicalXorConstantConditionRule (phpstan/phpstan-src@3a12724, phpstan/phpstan-src@3b011f6), #7539
- NoopRule - report top-level
xor
because that's probably not what the user intended to do (phpstan/phpstan-src@a1fffb3), #10267 - Report unused results of
and
andor
(phpstan/phpstan-src@1d8fff6) - Report unused result of ternary (phpstan/phpstan-src@9664f7a)
- Report unused results of
&&
and||
(phpstan/phpstan-src@cf2c8bb)
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 🔧
- Narrow
ReflectionEnum::getName()
afterReflectionEnum::isBacked()
(#2806), #10192, thanks @franmomu! - Any variable can exist after include/require (phpstan/phpstan-src@0a3a968), #10252
Bugfixes 🐛
- ResolvedPhpDocBlock: fix parent return tag merging (#2803), #6462, #10208, #3580, #4396, thanks @janedbal!
- Merge in-foreach scope even for non-iterable expr (phpstan/phpstan-src@942afbf)
- TooWideMethodReturnTypehintRule - never report in a trait (phpstan/phpstan-src@e0eb850)
- Narrowing list type with
count()
results in type loss (#2811), #10264, thanks @staabm! - Fix LevelsTestCase for PHPUnit 10 (phpstan/phpstan-src@fa5d5f9)
Function signature fixes 🤖
- Update return type information for
SimpleXMLElement::addChild
(#2808), #10269, thanks @DaveLiddament!
1.10.47
Improvements 🔧
ExpressionTypeResolverExtension
(#2789), thanks @janedbal!- See:
ExpressionTypeResolverExtension
in API Reference - This can be used to override inferred types by Scope if existing extension points like DynamicMethodReturnTypeExtension are not sufficient
- See:
Bugfixes 🐛
array_filter
- handle error types (#2794), #10189, thanks @mglaman!- Fix variable certainty after
if ($var ?? null)
(phpstan/phpstan-src@c2ba341), #10224 - Fix trait PHPDocs when checking overriden methods (phpstan/phpstan-src@4c4f22f), #10184
Function signature fixes 🤖
1.10.46
Improvements 🔧
- Improved
isset()
and ternary operator handling (#2710), #3632, #8190, #8366, #8659, #9580, #10064, #10088, thanks @staabm! - Optimize enums with many cases (phpstan/phpstan-src@b17d529)
Bugfixes 🐛
- Fix namespace of named type in class constant native type by patching PHP-Parser (phpstan/phpstan-src@8234dc0), #10212
- Do not create conditional expression for the same variable (phpstan/phpstan-src@aec0406)
- It's okay to have always-throwing expression in arrow function (phpstan/phpstan-src@758e5f1), #7890
Internals 🔍
1.10.45
Improvements 🔧
- Introduce InvalidTypesInUnionRule (#2763), #9185, thanks @paulbalandan!
- Implement DeclareStrictTypesRule (#2766), #6195, thanks @staabm!
- Narrow
enum_exists()
arg to UnitEnum (#2764), #10169, thanks @staabm!
Bugfixes 🐛
- Use dedicated Type methods over
isSuperTypeOf()
(#2772, #2787), #9778, #9723, #6407, thanks @staabm! - Optimize match expression with many conditions (phpstan/phpstan-src@c238fe7)
in_array
- simulate Identical/Equal handling from TypeSpecifier for literal arrays (phpstan/phpstan-src@0177e33), #10201
Function signature fixes 🤖
- Fix optional 4th parameter for
Redis::restore
(#2765), thanks @Vaalyn! - Put
str_increment
andstr_decrement
into functionMap (#2777), thanks @zonuexe! - Update functionMap (#2783), thanks @zonuexe!
- Update functionMap for
ext-mongodb
1.17 (#2768), thanks @alcaeus!
Internals 🔍
- Replace with
in_array()
instead of redundant property (#2770), thanks @zonuexe! - Fix typo in rule name:
MethodVisibitiliyInInterfaceRule
(#2781), thanks @staabm! - Make extensions that return default types simply
return null
(#2782), thanks @zonuexe! - Simplify InArrayFunctionTypeSpecifyingExtension (#2785), thanks @staabm!
1.10.44
Improvements 🔧
- PHP 8.3: support for dynamic class constant fetches (RFC)
- PHP 8.3: support for anonymous readonly class
- RedefinedParametersRule (#2755), #8025, thanks @paulbalandan!
- AbstractPrivateMethodRule (#2756), thanks @staabm!
- ReadOnlyClassRule (phpstan/phpstan-src@02b2e3d)
- InvalidLexicalVariablesInClosureUseRule (#2757), #1855, thanks @paulbalandan!
- AbstractProtectedMethodRule (#2758), thanks @staabm!
- VarTagTypeRuleHelper: do not allow widening
list<array{id: int}>
tomixed[]
(#2760), thanks @janedbal!
Bugfixes 🐛
- Re-add nullable type to interface to fix
Carbon
PHPStan extension (#2762), thanks @calebdw! - Fix named arguments for few multi-variant methods (#2748), thanks @schlndh!
- Fix overriding
SoapClient
old-style constructor (phpstan/phpstan-src@7765768), #10165 - Apply same fix in MethodSignatureRule from phpstan/phpstan-src@be2b415 (phpstan/phpstan-src@85fcd5f), #10166
Function signature fixes 🤖
1.10.43
Improvements 🔧
- Update
phpstan/phpdoc-parser
- Fix HTML description detection for PhpStorm stubs (phpstan/phpdoc-parser#220), thanks @schlndh!
- Make
ReflectionEnum
generic (phpstan/phpstan-src@9ce8faf)
Bugfixes 🐛
- Merge right scope of
??=
with scope before the expression (phpstan/phpstan-src@846f44e), #10151, #10131 - Fix return type of parent calls for SplHeap and other internal methods (#2622), #7162, #9867, thanks @schlndh!
stdClass
does not have__get
method (phpstan/phpstan-src@baf359e), #10149- Fix signature check of method from trait (phpstan/phpstan-src@be2b415), #10153
- All
universalObjectCratesClasses
allow dynamic properties (phpstan/phpstan-src@2ec416e) - Fix infinite recursion with self-referencing class constant (phpstan/phpstan-src@93af41b), #10147
Internals 🔍
1.10.42
This release closes 25 issues! 🎉
Major new features 🚀
- PHP 8.3 - support for natively typed class constants (RFC)
- PHP 8.3 - support for
#[\Override]
attribute (phpstan/phpstan-src@e9a5639) (RFC)- New configuration option:
checkMissingOverrideMethodAttribute
(https://phpstan.org/config-reference#checkmissingoverridemethodattribute) (phpstan/phpstan-src@ac4d3de)
- New configuration option:
Bleeding edge 🔪
- Detect overriding
@final
method in OverridingMethodRule, #9135 - MethodSignatureRule - look at abstract trait method (phpstan/phpstan-src@5fd8cee)
- MagicConstantContextRule (#2741), #10099, thanks @staabm!
If you want to see the shape of things to come and adopt bleeding edge features early, you can include this config file in your project's phpstan.neon
:
includes:
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
Of course, there are no backwards compatibility guarantees when you include this file. The behaviour and reported errors can change in minor versions with this file included. Learn more
Improvements 🔧
- Add ConstantsInTraitsRule (#2718), thanks @paulbalandan!
- Add NoncapturingCatchRule (#2721), #8663, thanks @paulbalandan!
- Detect non-abstract methods with no body (#2730), #4244, thanks @paulbalandan!
- Detect properties declared in interface (#2731), #8915, thanks @paulbalandan!
- Add VariadicParametersDeclarationRule (#2733), #3802, thanks @paulbalandan!
- Add InvalidCallablePropertyTypeRule (#2745), #4424, thanks @paulbalandan!
- ConflictingTraitConstantsRule (phpstan/phpstan-src@f94a3c3)
- Read class constant type when generalizing the type for
dynamicConstantNames
(phpstan/phpstan-src@cb9571b) - Rework prototype searching in OverridingMethodRule (phpstan/phpstan-src@4b2ffb8), #10101, #7541, #10043, #7859, #8081, #8500, #9014
- OverridingMethodRule - search for method prototype in traits (phpstan/phpstan-src@2df14af)
- VarTagTypeRuleHelper: fix widening array shapes (#2738), #10130, thanks @janedbal!
- Note about Xdebug with
--debug
(phpstan/phpstan-src@c534f8c) - FunctionSignatureMapProvider - cache data statically (phpstan/phpstan-src@394064b), #10039
Bugfixes 🐛
- Star projection is always within template type bounds (#2715), #10097, thanks @jiripudil!
- Support
non-empty-string
instr_shuffle()
(#2717), thanks @staabm! - Look if userland prototype has
ReturnTypeWillChange
or not (phpstan/phpstan-src@eb0c7a1), #9615 - Fix wrong tip about returning a list (phpstan/phpstan-src@00adfaa, phpstan/phpstan-src@00a9d94)
- Fix parameter names for multi-variant functions (#2726), #9018, #9399, #9923, #9823, thanks @schlndh!
- Fix iterator_to_array, iterator_count for PHP 8.2 (#2625), #9793, #7760, thanks @schlndh!
- Update array_filter signature to allow null as callback (#2740) (#2740), thanks @andyexeter!
Function signature fixes 🤖
- Fix return value of
mailparse_msg_get_part()
(#2722), thanks @jlherren! - Update functionMaps (#2699), thanks @zonuexe!
- Change
iptcparse
return type (#2727), thanks @ManuelHu!
Internals 🔍
- Create DirectoryCreator helper class (#2697), thanks @calebdw!
- Use PHP 8.3 in Name Collision Detector (phpstan/phpstan-src@8cd239e)
- Golden test for reflection (#2679), thanks @schlndh!
- Fully qualify the name of the
#[\Override]
attribute in error messages (#10136), thanks @TimWolla! - RuleTestCase - allow null tip (phpstan/phpstan-src@f384b43)
1.10.41
Bugfixes 🐛
- Fix type-specifying of expression involved in nullsafe property fetch (phpstan/phpstan-src@a849f06), #10071, #9394, #6922
- Fix type-specifying for nested assign in
===
andmatch
condition (phpstan/phpstan-src@01deed6), #10084 - Improve missing iterable value type check in lists (phpstan/phpstan-src@e705f09)
- Update BetterReflection (#2713), #10086
- Reuse same printer instance (ondrejmirtes/BetterReflection@bab47ea)
Function signature fixes 🤖
Internals 🔍
MutatingScope::debug()
- add info about conditional expressions (phpstan/phpstan-src@80782fb)
1.10.40
Improvements 🔧
- TemplateTypeCheck tries to resolve template type names such as
self
because they're not usable (phpstan/phpstan-src@c6fad64), #10049
Bugfixes 🐛
- Fix used memory reporting (#2686), thanks @staabm!
- Fix switch statement with enum in the condition (#2687), #9806, thanks @schlndh!
- Fix null coalesce assignment type (#2702), #9995, thanks @hirokinoue!
- Fix
!==
with union of constants (#2700), #10002, thanks @schlndh! - Process statements inside
declare(ticks=...)
(phpstan/phpstan-src@eb39381), #10059 - Fix crash when template types map and variances map are not of equal length (phpstan/phpstan-src@1308c52), #10049
Function signature fixes 🤖
- functionMap.php fixes for YAF 3.3.5 (#2696), thanks @mbakirov!
- Remove
\
from DateTimeZone in functionMap (#2693), thanks @simPod! - Allow
Redis::pconnect
to have 7 parameters (#2695), thanks @Vaalyn!