Update besar apk finance
This commit is contained in:
Vendored
+9
-5
@@ -20,12 +20,13 @@
|
||||
"php": "^7.4 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^8 || ^9",
|
||||
"phpstan/phpstan": "^1.12 || ^2",
|
||||
"phpstan/phpstan-strict-rules": "^1 || ^2"
|
||||
"phpunit/phpunit": "^9",
|
||||
"phpstan/phpstan": "^2",
|
||||
"phpstan/phpstan-strict-rules": "^2",
|
||||
"phpstan/phpstan-deprecation-rules": "^2"
|
||||
},
|
||||
"conflict": {
|
||||
"phpstan/phpstan": "<1.11.10"
|
||||
"phpstan/phpstan": "<2.2.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@@ -48,7 +49,10 @@
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"test": "@php vendor/bin/phpunit",
|
||||
"test": [
|
||||
"@php vendor/bin/phpunit",
|
||||
"@php vendor/bin/phpunit --testsuite phpstan"
|
||||
],
|
||||
"phpstan": "@php phpstan analyse"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,18 +57,38 @@ final class PregMatchTypeSpecifyingExtension implements StaticMethodTypeSpecifyi
|
||||
{
|
||||
$args = $node->getArgs();
|
||||
$patternArg = $args[0] ?? null;
|
||||
$subjectArg = $args[1] ?? null;
|
||||
$matchesArg = $args[2] ?? null;
|
||||
$flagsArg = $args[3] ?? null;
|
||||
|
||||
$subjectTypes = new SpecifiedTypes();
|
||||
if ($patternArg === null) {
|
||||
return $subjectTypes;
|
||||
}
|
||||
|
||||
if (
|
||||
$patternArg === null || $matchesArg === null
|
||||
$subjectArg !== null
|
||||
&& $context->true()
|
||||
&& $scope->getType($subjectArg->value)->isString()->yes()
|
||||
) {
|
||||
return new SpecifiedTypes();
|
||||
$subjectType = $this->regexShapeMatcher->matchSubjectExpr($patternArg->value, $scope);
|
||||
if ($subjectType !== null) {
|
||||
$subjectTypes = $this->typeSpecifier->create(
|
||||
$subjectArg->value,
|
||||
$subjectType,
|
||||
$context,
|
||||
$scope,
|
||||
)->setRootExpr($node);
|
||||
}
|
||||
}
|
||||
|
||||
if ($matchesArg === null) {
|
||||
return $subjectTypes;
|
||||
}
|
||||
|
||||
$flagsType = PregMatchFlags::getType($flagsArg, $scope);
|
||||
if ($flagsType === null) {
|
||||
return new SpecifiedTypes();
|
||||
return $subjectTypes;
|
||||
}
|
||||
|
||||
if (stripos($methodReflection->getName(), 'matchAll') !== false) {
|
||||
@@ -78,7 +98,7 @@ final class PregMatchTypeSpecifyingExtension implements StaticMethodTypeSpecifyi
|
||||
}
|
||||
|
||||
if ($matchedType === null) {
|
||||
return new SpecifiedTypes();
|
||||
return $subjectTypes;
|
||||
}
|
||||
|
||||
if (
|
||||
@@ -93,27 +113,13 @@ final class PregMatchTypeSpecifyingExtension implements StaticMethodTypeSpecifyi
|
||||
$context = $context->negate();
|
||||
}
|
||||
|
||||
// @phpstan-ignore function.alreadyNarrowedType
|
||||
if (method_exists('PHPStan\Analyser\SpecifiedTypes', 'setRootExpr')) {
|
||||
$typeSpecifier = $this->typeSpecifier->create(
|
||||
$matchesArg->value,
|
||||
$matchedType,
|
||||
$context,
|
||||
$scope
|
||||
)->setRootExpr($node);
|
||||
|
||||
return $overwrite ? $typeSpecifier->setAlwaysOverwriteTypes() : $typeSpecifier;
|
||||
}
|
||||
|
||||
// @phpstan-ignore arguments.count
|
||||
return $this->typeSpecifier->create(
|
||||
$specifiedTypes = $this->typeSpecifier->create(
|
||||
$matchesArg->value,
|
||||
$matchedType,
|
||||
$context,
|
||||
// @phpstan-ignore argument.type
|
||||
$overwrite,
|
||||
$scope,
|
||||
$node
|
||||
);
|
||||
$scope
|
||||
)->setRootExpr($node);
|
||||
|
||||
return $subjectTypes->unionWith($overwrite ? $specifiedTypes->setAlwaysOverwriteTypes() : $specifiedTypes);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -395,7 +395,7 @@ class Preg
|
||||
* @return array<int|string, string>
|
||||
* @throws UnexpectedNullMatchException
|
||||
*/
|
||||
private static function enforceNonNullMatches(string $pattern, array $matches, string $variantMethod)
|
||||
private static function enforceNonNullMatches(string $pattern, array $matches, string $variantMethod): array
|
||||
{
|
||||
foreach ($matches as $group => $match) {
|
||||
if (is_string($match) || (is_array($match) && is_string($match[0]))) {
|
||||
@@ -414,7 +414,7 @@ class Preg
|
||||
* @return array<int|string, list<string>>
|
||||
* @throws UnexpectedNullMatchException
|
||||
*/
|
||||
private static function enforceNonNullMatchAll(string $pattern, array $matches, string $variantMethod)
|
||||
private static function enforceNonNullMatchAll(string $pattern, array $matches, string $variantMethod): array
|
||||
{
|
||||
foreach ($matches as $group => $groupMatches) {
|
||||
foreach ($groupMatches as $match) {
|
||||
|
||||
Reference in New Issue
Block a user