-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix PHPStan extension for matchAllStrictGroups #38
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,19 +82,9 @@ public function specifyTypes(MethodReflection $methodReflection, StaticCall $nod | |
} | ||
|
||
if ( | ||
in_array($methodReflection->getName(), ['matchStrictGroups', 'isMatchStrictGroups'], true) | ||
&& count($matchedType->getConstantArrays()) === 1 | ||
in_array($methodReflection->getName(), ['matchStrictGroups', 'isMatchStrictGroups', 'matchAllStrictGroups', 'isMatchAllStrictGroups'], true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this IF case was missing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I tried that without success tho. But now with the traverser looks much better, thanks! |
||
) { | ||
$matchedType = $matchedType->getConstantArrays()[0]; | ||
$matchedType = new ConstantArrayType( | ||
$matchedType->getKeyTypes(), | ||
array_map(static function (Type $valueType): Type { | ||
return TypeCombinator::removeNull($valueType); | ||
}, $matchedType->getValueTypes()), | ||
$matchedType->getNextAutoIndexes(), | ||
[], | ||
$matchedType->isList() | ||
); | ||
$matchedType = PregMatchFlags::removeNullFromMatches($matchedType); | ||
} | ||
|
||
$overwrite = false; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved this out into the utility class to ease re-use without duplication