CLI-1226: Support objects as API params #2014
mutation.yml
on: pull_request
Mutation Testing
8m 14s
Annotations
7 warnings
Mutation Testing:
src/Command/Api/ApiBaseCommand.php#L190
Escaped Mutant for Mutator "LogicalAnd":
--- Original
+++ New
@@ @@
}
$types[] = $type['type'];
}
- if (in_array('integer', $types, TRUE) && ctype_digit($value)) {
+ if (in_array('integer', $types, TRUE) || ctype_digit($value)) {
return $this->doCastParamType('integer', $value);
}
} elseif ($paramSpec['type'] === 'array') {
|
Mutation Testing:
src/Command/Api/ApiBaseCommand.php#L190
Escaped Mutant for Mutator "LogicalAndNegation":
--- Original
+++ New
@@ @@
}
$types[] = $type['type'];
}
- if (in_array('integer', $types, TRUE) && ctype_digit($value)) {
+ if (!(in_array('integer', $types, TRUE) && ctype_digit($value))) {
return $this->doCastParamType('integer', $value);
}
} elseif ($paramSpec['type'] === 'array') {
|
Mutation Testing:
src/Command/Api/ApiBaseCommand.php#L190
Escaped Mutant for Mutator "LogicalAndAllSubExprNegation":
--- Original
+++ New
@@ @@
}
$types[] = $type['type'];
}
- if (in_array('integer', $types, TRUE) && ctype_digit($value)) {
+ if (!in_array('integer', $types, TRUE) && !ctype_digit($value)) {
return $this->doCastParamType('integer', $value);
}
} elseif ($paramSpec['type'] === 'array') {
|
Mutation Testing:
src/Command/Api/ApiBaseCommand.php#L190
Escaped Mutant for Mutator "LogicalAndSingleSubExprNegation":
--- Original
+++ New
@@ @@
}
$types[] = $type['type'];
}
- if (in_array('integer', $types, TRUE) && ctype_digit($value)) {
+ if (!in_array('integer', $types, TRUE) && ctype_digit($value)) {
return $this->doCastParamType('integer', $value);
}
} elseif ($paramSpec['type'] === 'array') {
|
Mutation Testing:
src/Command/Api/ApiBaseCommand.php#L190
Escaped Mutant for Mutator "LogicalAndSingleSubExprNegation":
--- Original
+++ New
@@ @@
}
$types[] = $type['type'];
}
- if (in_array('integer', $types, TRUE) && ctype_digit($value)) {
+ if (in_array('integer', $types, TRUE) && !ctype_digit($value)) {
return $this->doCastParamType('integer', $value);
}
} elseif ($paramSpec['type'] === 'array') {
|
Mutation Testing:
src/Command/Api/ApiBaseCommand.php#L211
Escaped Mutant for Mutator "MatchArmRemoval":
--- Original
+++ New
@@ @@
'boolean' => $this->castBool($value),
'array' => is_string($value) ? explode(',', $value) : (array) $value,
'string' => (string) $value,
- 'object' => json_decode($value, FALSE, 512, JSON_THROW_ON_ERROR),
};
}
public function castBool(mixed $val) : bool
|
Mutation Testing:
src/Command/Api/ApiBaseCommand.php#L212
Escaped Mutant for Mutator "CastInt":
--- Original
+++ New
@@ @@
private function doCastParamType(string $type, mixed $value) : array|bool|int|string|object
{
return match ($type) {
- 'integer' => (int) $value,
+ 'integer' => $value,
'boolean' => $this->castBool($value),
'array' => is_string($value) ? explode(',', $value) : (array) $value,
'string' => (string) $value,
|