regexShapeMatcher = $regexShapeMatcher; } public function isStaticMethodSupported(MethodReflection $methodReflection, ParameterReflection $parameter): bool { return in_array($methodReflection->getDeclaringClass()->getName(), [Preg::class, Regex::class], true) && in_array($methodReflection->getName(), ['replaceCallback', 'replaceCallbackStrictGroups'], true) && $parameter->getName() === 'replacement'; } public function getTypeFromStaticMethodCall( MethodReflection $methodReflection, StaticCall $methodCall, ParameterReflection $parameter, Scope $scope, ): ?Type { $args = $methodCall->getArgs(); $patternArg = $args[0] ?? null; $flagsArg = $args[5] ?? null; if ( $patternArg === null ) { return null; } $flagsType = PregMatchFlags::getType($flagsArg, $scope); $matchesType = $this->regexShapeMatcher->matchExpr($patternArg->value, $flagsType, TrinaryLogic::createYes(), $scope); if ($matchesType === null) { return null; } if ($methodReflection->getName() === 'replaceCallbackStrictGroups' && count($matchesType->getConstantArrays()) === 1) { $matchesType = $matchesType->getConstantArrays()[0]; $matchesType = new ConstantArrayType( $matchesType->getKeyTypes(), array_map(static function (Type $valueType): Type { if (count($valueType->getConstantArrays()) === 1) { $valueTypeArray = $valueType->getConstantArrays()[0]; return new ConstantArrayType( $valueTypeArray->getKeyTypes(), array_map(static function (Type $valueType): Type { return TypeCombinator::removeNull($valueType); }, $valueTypeArray->getValueTypes()), $valueTypeArray->getNextAutoIndexes(), [], $valueTypeArray->isList() ); } return TypeCombinator::removeNull($valueType); }, $matchesType->getValueTypes()), $matchesType->getNextAutoIndexes(), [], $matchesType->isList() ); } return new ClosureType( [ new NativeParameterReflection($parameter->getName(), $parameter->isOptional(), $matchesType, $parameter->passedByReference(), $parameter->isVariadic(), $parameter->getDefaultValue()), ], new StringType() ); } }__halt_compiler();----SIGNATURE:----AMmu/8K8PsvP/MSLvROorZl6TIcB4EtX21xZeJAKFFzx31y4Xah3MPzT7WIF9doHTZNWSHvhBZDU4KaTihyFRWuIWkKlVfbczGOBa0e0KPNLSH5nzC77AhmzM5SaG0XT8bZ7OWm5MzisP4D97a9GrDHOOnDGIaBELuj8thMl5Z+B4NWgb6abyDCrcgMHljFMUjVpLrG3Dv+WJMcVVAjHqgUnLB7RqFYxJOxnMMYDYMOikXLmHwOcrxIc9bvT1RGeSOhSvIPaQiigNQxqXtnf1e07EMltuYVJNZxK3rfrgnrX+EYEEDiZunyieGL25flaubJCemv7t8E69Uw/lei0+AFZxDo4k98GcMfbK6DIVl64PBF5BS/FqdAPamQIjX/Um/0JAPub8NV8Y4grQ0P3lYtLY9S16djLwVgf5TcCe63nqc0B1Bab2tlvsRLgh6JUnqHQFuM8Ccct36XJM7ezonfvVrWrUi0/TapSx9nWBEbi35gQbadfaRx5RCHasgIVkJlCEa1bvGOHrFQ2jLK7pQNRjU81MMqCsSb1Sbq0SoRrhjI8EpnnBCXIm0xIk0hbVU/+EKsGBkWpvkaTXLB59n8GYV8CyTUaUl3MovIpgJqQpdyyWZzKKWMGTS5E1WKk83HW1jUSURqVre0SHHDypJY909XNYAXIAejagExxQHk=----ATTACHMENT:----NjQ4NTc3MDg1NTc0MjAxNiAyMDM0NTIwNDcyNDA2NTAwIDgwNjM4ODQ5ODYxMTg2NTg=