2.2.3 #14890
ondrejmirtes
started this conversation in
General
2.2.3
#14890
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
This release fixes 52 issues! 🎉
Bleeding edge 🔪
newon an expression whose type is notstring|objectvianew.nonObject(#5866), Detect wrong type used withnew#4922, thanks @VincentLanglet and @staabm!__DIR__(#5879), 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 🔧
AccessoryDecimalIntegerStringType::tryRemove()and preserve accessories when re-unioning'0'(#5816), removing '0' fromdecimal-int-stringshould make it non-falsey #14785, thanks @staabm and @VincentLanglet!a?,a{n},a{n,m}) (#5860), regex-matching: infer constant strings from zero-or-one quantification #14820, thanks @staabm!::classmagic constant in array shape keys and const types (#5891), thanks @janedbal!non-falsy-string&non-decimal-int-stringfor the magicnameproperty on theUnitEnum/BackedEnuminterfaces (#5894), magic "name" property on enum case should be non-falsy-string #14839, thanks @staabm and @VincentLanglet!ob_get_contents()/ob_get_clean()/ob_get_flush()/ob_get_length()to non-falsewhile output buffering is active (#5909), Output buffering being active is not recognized #10348, thanks @staabm and @VincentLanglet!Foo<T>|TisFooshould result inFoo<T>|FoonotFoo<T>#13190, thanks @rvanvelzen!in_array(..., true)when every finite needle value is guaranteed in the haystack (#5944), PHPStan should reportin_array(..., true)calls that are obviously always true #14873, thanks @staabm and @VincentLanglet!Bugfixes 🐛
matchsubject when its assigned result is later narrowed (#5808), Narrow the subject of a match(...) clause based on the narrowing of its result #14772, Type is not resolvable via match and instanceof check #10843never-narrowing conditional expression holders inBooleanAnd/BooleanOrdecomposition (#5809), Version 2.2.2 introduced error with uninitialized property #14774BooleanAnd/BooleanOrconditional holders (#5810), Since 2.2.2: implication learned from an&&guard drops one of its conditions and chains into a wrong type #14780&&guard drops one of its conditions and chains into a wrong type #14780non-empty-listforpreg_match_all()matches when the match succeeded (#5812), preg_match_all() should infer non-empty-list #14781, thanks @staabm and @VincentLanglet!decimal-int-stringwhen every alternation branch is a decimal integer (#5814), narrow todecimal-int-stringby regex #14784, thanks @staabm!ctype_digit()argument tonumeric-stringinstead ofdecimal-int-string(#5822), ctype_digit($x) is true does not imply that $x is decimal-int-string #14792+(#5832),+=with array<string, mixed> discards the keyed array-shape prefix instead of merging it with the open tail #14799isMaybeEmptyNode(#5851), Nested captured optional subpatterns result in non-falsy-string instead of string #14809, thanks @staabm and @VincentLanglet!ConstantArrayType::flipArray()andfillKeysArray()to preserve per-key value precision (#5719), Wrong array_flip inference #14656, thanks @VincentLanglet and @staabm!ResultCacheMetaExtensionduring result cache restore as internal errors (#5853), Exception from ResultCacheMetaExtension::getHash() during cache restore is swallowed → exits 0, analysis silently skipped #14805, thanks @staabm and @VincentLanglet!nullin return type ofClosure::bindTo()andClosure::bind()dynamic return type extensions (#5675), Closure::bindTo() no longer identified as potentially returning null #5009, thanks @VincentLanglet and @staabm!decimal-int-stringas a numeric string inlooseCompare()instead of assuming inequality with non-decimal strings (#5824), A decimal-int-string may be loosely equal to a non-decimal-int-string #14793, thanks @VincentLanglet and @staabm!is_file($path)before checkingrequire $path(#5867), thanks @staabm!BooleanAndfalse-context conditional holders (#5878), Boolean narrowing regression since v2.2.2 #14828foreachwhose body guards each element with an early exit (#5877), Failure to understand/acknowledge type checking of array elements #5755@phpstan-assert-if-trueargument narrowing (#5885), "Path in require() __DIR__ . '/../vendor/autoload.php' is not a file or it does not exist." false positive #14829, thanks @staabm!@phpstan-assert-if-trueargument narrowing (#5880), thanks @staabm and @VincentLanglet!mixedtype is breaking conditional analysis type narrowing #7948, Cannot access property XX on Class|null after an assert #4905, thanks @VincentLanglet and @staabm!??=so closures capturing the assigned variable by reference see its assigned type (#5900), References in use clauses are not processed correctly #13810, thanks @staabm!hasYieldfromyieldin ternary branches (#5904), False positive with conditional yield #5681, thanks @staabm and @VincentLanglet!$obj->{'n'}) to bareword form when printing expression keys (#5916), Teach phpstan about about equivalence of two types of object property access #14847, thanks @staabm and @VincentLanglet!Foo<T>|TisFooshould result inFoo<T>|FoonotFoo<T>#13190, thanks @rvanvelzen!TemplateTypeFactory::create()(#5905), Generic type information lost after comparison operation #10083, thanks @staabm and @VincentLanglet!$a['foo']after excludingisset($a['foo']) && !is_array($a['foo'])#14874, thanks @VincentLanglet and @staabm!class-stringas a definite subtype ofclass-string<object>inGenericClassStringType::isSuperTypeOf()(#5956), new ReflectionClass($class) does not accept what it should accept #14887Performance 🏎️
FileExcluder->isExcludedFromAnalysing()(#5886), thanks @staabm!VerbosityLevel(#5932), thanks @staabm!Function signature fixes 🤖
Internals 🔍
ClosureType::isStaticClosure()(#5699), thanks @VincentLanglet and @staabm!// lint >=comment for the version-specific PHP syntax they use (#5855), add builtin rule to early detect common php version requirement errors #14816, thanks @staabm and @VincentLanglet!PhpMinorVersionIterator::__construct()in BC promise (#5898), thanks @staabm!BleedingEdgeToggle::withBleedingEdge()and use it instead of manual set/restore in tests (#5915), Refactor: simplifyBleedingEdgeToggleset/restore handling #14859, thanks @VincentLanglet!BleedingEdgeToggleacrossyieldin data providers - fixes racy/flaky tests (#5911), intermittent in CI #14855, thanks @staabm and @VincentLanglet!setUp()of tests with PHP-version-dependent reflection assertions - fixes racy/flaky tests (#5917), CI: Intermittent in HasPropertyTypeTest #14860, thanks @staabm and @VincentLanglet!BleedingEdgeToggle::withBleedingEdgeto simplify another test (#5931), thanks @staabm!BleedingEdgeToggle::withBleedingEdgeto simplify test (#5930), thanks @staabm!This discussion was created from the release 2.2.3.
All reactions