* fix treating any post types coverage as ALL
when it's not SUB
@…
#157
Annotations
12 warnings
|
|
be/app/Helper.php#L83
Escaped Mutant for Mutator "DecrementInteger":
--- Original
+++ New
@@ @@
];
public static function abortAPI(int $errorCode) : never
{
- $statusCode = 0;
+ $statusCode = -1;
$errorInfo = null;
foreach (self::ERROR_STATUS_CODE_INFO as $infoStatusCode => $infoErrorInfo) {
if (\array_key_exists($errorCode, $infoErrorInfo)) {
|
be/app/Http/PostsQuery/BaseQuery.php#L281
Escaped Mutant for Mutator "Coalesce":
--- Original
+++ New
@@ @@
// use the topmost value between sorting key or value of orderBy field within its child posts
$curAndChildSortingKeys = collect([
// value of orderBy field in the first sorted child post that isMatchQuery after previous sorting
- $childPosts->filter(static fn(Collection $p) => ($p['isMatchQuery'] ?? true) === true)->first()[$this->orderByField] ?? null,
+ $childPosts->filter(static fn(Collection $p) => (true ?? $p['isMatchQuery']) === true)->first()[$this->orderByField] ?? null,
// sorting key from the first sorted child posts
// not requiring isMatchQuery since a child post without isMatchQuery
// might have its own child posts with isMatchQuery
|
be/app/Http/PostsQuery/CursorCodec.php#L33
Escaped Mutant for Mutator "LessThan":
--- Original
+++ New
@@ @@
return '0';
}
$prefix = match (true) {
- \is_int($cursor) && $cursor < 0 => '-',
+ \is_int($cursor) && $cursor <= 0 => '-',
\is_string($cursor) => 'S',
default => '',
};
|
be/app/Http/PostsQuery/CursorCodec.php#L40
Escaped Mutant for Mutator "GreaterThanOrEqualTo":
--- Original
+++ New
@@ @@
\is_string($cursor) => 'S',
default => '',
};
- $value = \is_int($cursor) ? rtrim(pack('P', $cursor), $cursor >= 0 ? "\x00" : "\xff") : ($prefix === 'S' ? $cursor : throw new \RuntimeException('Invalid cursor value'));
+ $value = \is_int($cursor) ? rtrim(pack('P', $cursor), $cursor > 0 ? "\x00" : "\xff") : ($prefix === 'S' ? $cursor : throw new \RuntimeException('Invalid cursor value'));
if ($prefix !== 'S') {
// https://en.wikipedia.org/wiki/Base64#URL_applications
$value = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($value));
|
be/app/Http/PostsQuery/CursorCodec.php#L75
Escaped Mutant for Mutator "IncrementInteger":
--- Original
+++ New
@@ @@
* @var string $cursor
* @var string $prefix
*/
- [$prefix, $cursor] = array_pad(explode(':', $encodedCursor), 2, null);
+ [$prefix, $cursor] = array_pad(explode(':', $encodedCursor), 3, null);
if ($cursor === null) {
// no prefix being provided means the value of cursor is a positive int
$cursor = $prefix;
|
be/app/Http/PostsQuery/CursorCodec.php#L82
Escaped Mutant for Mutator "CastArray":
--- Original
+++ New
@@ @@
// keep 0 as is
'S' => $cursor,
// string literal is not base64 encoded
- default => ((array) unpack(format: 'P', string: str_pad(
+ default => unpack(format: 'P', string: str_pad(
// re-add removed trailing 0x00 or 0xFF
base64_decode(
// https://en.wikipedia.org/wiki/Base64#URL_applications
@@ @@
),
length: 8,
pad_string: $prefix === '-' ? "\xff" : "\x00"
- )))[1],
+ ))[1],
};
})->chunk(2)->map(static fn(Collection $i) => $i->values()))->mapWithKeys(fn(Collection $cursors, string $postType) => [$postType => $cursors->mapWithKeys(fn(int|string|null $cursor, int $index) => [$index === 0 ? Helper::POST_TYPE_TO_ID[$postType] : $orderByField => $cursor])])->reject(static fn(Collection $cursors) => $cursors->every(static fn(int|string|null $cursor) => $cursor === null))->map(static fn(Collection $cursors) => new Cursor($cursors->all()));
}
}
|
be/app/Http/PostsQuery/CursorCodec.php#L90
Escaped Mutant for Mutator "IncrementInteger":
--- Original
+++ New
@@ @@
// https://en.wikipedia.org/wiki/Base64#URL_applications
str_replace(['-', '_'], ['+', '/'], $cursor)
),
- length: 8,
+ length: 9,
pad_string: $prefix === '-' ? "\xff" : "\x00"
)))[1],
};
|
be/app/Http/PostsQuery/QueryParam.php#L15
Escaped Mutant for Mutator "CastString":
--- Original
+++ New
@@ @@
protected array $subParams;
public function __construct(array $param)
{
- $this->name = (string) array_keys($param)[0];
+ $this->name = array_keys($param)[0];
if (is_numeric($this->name)) {
throw new \InvalidArgumentException();
}
|
be/app/Http/PostsQuery/QueryParams.php#L31
Escaped Mutant for Mutator "UnwrapArrayValues":
--- Original
+++ New
@@ @@
public function pick(string ...$names) : array
{
// array_values() will reset keys
- return array_values(array_filter($this->params, static fn($p): bool => \in_array($p->name, $names, true)));
+ return array_filter($this->params, static fn($p): bool => \in_array($p->name, $names, true));
}
/**
* @return QueryParam[]
|
be/app/Http/PostsQuery/QueryParams.php#L43
Escaped Mutant for Mutator "UnwrapArrayValues":
--- Original
+++ New
@@ @@
*/
public function omit(string ...$names) : array
{
- return array_values(array_filter($this->params, static fn($p): bool => !\in_array($p->name, $names, true)));
+ return array_filter($this->params, static fn($p): bool => !\in_array($p->name, $names, true));
}
public function getUniqueParamValue(string $name) : mixed
{
|
This job succeeded
Loading