Simplify extractors output #2047
test-suite.yml
on: pull_request
Matrix: Mutation Tests
Matrix: Static Analyze
Matrix: Tests
Annotations
11 warnings
Static Analyze (locked, 8.1, ubuntu-latest)
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|
Mutation Tests (locked, 8.1, ubuntu-latest):
src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/ValueConverter.php#L38
Escaped Mutant for Mutator "Identical":
--- Original
+++ New
@@ @@
foreach ($data as $entry => $value) {
$avroType = $this->type($entry);
if ($avroType !== null && \is_array($avroType[\AvroSchema::TYPE_ATTR])) {
- if ($avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::TYPE_ATTR] === \AvroSchema::LONG_TYPE && \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType) && $avroType[\AvroSchema::LOGICAL_TYPE_ATTR] === 'timestamp-micros') {
+ if ($avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::TYPE_ATTR] !== \AvroSchema::LONG_TYPE && \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType) && $avroType[\AvroSchema::LOGICAL_TYPE_ATTR] === 'timestamp-micros') {
$convertedData[$entry] = \DateTimeImmutable::createFromFormat('U.u', \implode('.', \str_split((string) $value, 10)));
} elseif ($avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::TYPE_ATTR] === \AvroSchema::ARRAY_SCHEMA && \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType[\AvroSchema::TYPE_ATTR]) && $avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::LOGICAL_TYPE_ATTR] === 'timestamp-micros') {
$convertedData[$entry] = \array_map(static fn(int $timestamp): \DateTimeImmutable => \DateTimeImmutable::createFromFormat('U.u', \implode('.', \str_split((string) $timestamp, 10))), $value);
|
Mutation Tests (locked, 8.1, ubuntu-latest):
src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/ValueConverter.php#L38
Escaped Mutant for Mutator "LogicalAnd":
--- Original
+++ New
@@ @@
foreach ($data as $entry => $value) {
$avroType = $this->type($entry);
if ($avroType !== null && \is_array($avroType[\AvroSchema::TYPE_ATTR])) {
- if ($avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::TYPE_ATTR] === \AvroSchema::LONG_TYPE && \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType) && $avroType[\AvroSchema::LOGICAL_TYPE_ATTR] === 'timestamp-micros') {
+ if (($avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::TYPE_ATTR] === \AvroSchema::LONG_TYPE || \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType)) && $avroType[\AvroSchema::LOGICAL_TYPE_ATTR] === 'timestamp-micros') {
$convertedData[$entry] = \DateTimeImmutable::createFromFormat('U.u', \implode('.', \str_split((string) $value, 10)));
} elseif ($avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::TYPE_ATTR] === \AvroSchema::ARRAY_SCHEMA && \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType[\AvroSchema::TYPE_ATTR]) && $avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::LOGICAL_TYPE_ATTR] === 'timestamp-micros') {
$convertedData[$entry] = \array_map(static fn(int $timestamp): \DateTimeImmutable => \DateTimeImmutable::createFromFormat('U.u', \implode('.', \str_split((string) $timestamp, 10))), $value);
|
Mutation Tests (locked, 8.1, ubuntu-latest):
src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/ValueConverter.php#L40
Escaped Mutant for Mutator "Identical":
--- Original
+++ New
@@ @@
foreach ($data as $entry => $value) {
$avroType = $this->type($entry);
if ($avroType !== null && \is_array($avroType[\AvroSchema::TYPE_ATTR])) {
- if ($avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::TYPE_ATTR] === \AvroSchema::LONG_TYPE && \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType) && $avroType[\AvroSchema::LOGICAL_TYPE_ATTR] === 'timestamp-micros') {
+ if ($avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::TYPE_ATTR] === \AvroSchema::LONG_TYPE && \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType) && $avroType[\AvroSchema::LOGICAL_TYPE_ATTR] !== 'timestamp-micros') {
$convertedData[$entry] = \DateTimeImmutable::createFromFormat('U.u', \implode('.', \str_split((string) $value, 10)));
} elseif ($avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::TYPE_ATTR] === \AvroSchema::ARRAY_SCHEMA && \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType[\AvroSchema::TYPE_ATTR]) && $avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::LOGICAL_TYPE_ATTR] === 'timestamp-micros') {
$convertedData[$entry] = \array_map(static fn(int $timestamp): \DateTimeImmutable => \DateTimeImmutable::createFromFormat('U.u', \implode('.', \str_split((string) $timestamp, 10))), $value);
|
Mutation Tests (locked, 8.1, ubuntu-latest):
src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/ValueConverter.php#L58
Escaped Mutant for Mutator "LogicalAnd":
--- Original
+++ New
@@ @@
$convertedData[$entry] = $value;
}
} else {
- if ($avroType[\AvroSchema::TYPE_ATTR] === \AvroSchema::LONG_TYPE && \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType) && $avroType[\AvroSchema::LOGICAL_TYPE_ATTR] === 'timestamp-micros') {
+ if (($avroType[\AvroSchema::TYPE_ATTR] === \AvroSchema::LONG_TYPE || \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType)) && $avroType[\AvroSchema::LOGICAL_TYPE_ATTR] === 'timestamp-micros') {
$convertedData[$entry] = \DateTimeImmutable::createFromFormat('U.u', \implode('.', \str_split((string) $value, 10)));
} else {
$convertedData[$entry] = $value;
|
Mutation Tests (locked, 8.1, ubuntu-latest):
src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/ValueConverter.php#L72
Escaped Mutant for Mutator "ArrayOneItem":
--- Original
+++ New
@@ @@
}
}
}
- return $convertedData;
+ return count($convertedData) > 1 ? array_slice($convertedData, 0, 1, true) : $convertedData;
}
private function type(string $entry) : ?array
{
|
Mutation Tests (locked, 8.1, ubuntu-latest):
src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/Chart/BarChart.php#L51
Escaped Mutant for Mutator "CastString":
--- Original
+++ New
@@ @@
{
foreach ($rows as $row) {
/** @phpstan-ignore-next-line */
- $this->data['labels'][] = (string) $row->valueOf($this->label);
+ $this->data['labels'][] = $row->valueOf($this->label);
foreach ($this->datasets as $dataset) {
if (!\array_key_exists($dataset->name(), $this->data['datasets'])) {
$this->data['datasets'][$dataset->name()] = ['label' => $dataset->name(), 'data' => [$row->valueOf($dataset)]];
|
Mutation Tests (locked, 8.1, ubuntu-latest):
src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/Pages.php#L15
Escaped Mutant for Mutator "RoundingFamily":
--- Original
+++ New
@@ @@
}
public function pages() : int
{
- return (int) \ceil($this->total / $this->pageSize);
+ return (int) round($this->total / $this->pageSize);
}
}
|
Mutation Tests (locked, 8.1, ubuntu-latest):
src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/Columns.php#L20
Escaped Mutant for Mutator "PregMatchRemoveFlags":
--- Original
+++ New
@@ @@
if ('' === $sheetName) {
throw new InvalidArgumentException('Sheet name can\'t be empty');
}
- if (!\preg_match('/^[A-Z]+$/u', $startColumn)) {
+ if (!\preg_match('/^[A-Z]+$/', $startColumn)) {
throw new InvalidArgumentException(\sprintf('The column `%s` needs to contain only letters.', $startColumn));
}
if (!\preg_match('/^[A-Z]+$/u', $endColumn)) {
|
Mutation Tests (locked, 8.1, ubuntu-latest):
src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/Columns.php#L24
Escaped Mutant for Mutator "PregMatchRemoveFlags":
--- Original
+++ New
@@ @@
if (!\preg_match('/^[A-Z]+$/u', $startColumn)) {
throw new InvalidArgumentException(\sprintf('The column `%s` needs to contain only letters.', $startColumn));
}
- if (!\preg_match('/^[A-Z]+$/u', $endColumn)) {
+ if (!\preg_match('/^[A-Z]+$/', $endColumn)) {
throw new InvalidArgumentException(\sprintf('The column `%s` needs to contain only letters.', $endColumn));
}
if ($endColumn < $startColumn) {
|
Mutation Tests (locked, 8.1, ubuntu-latest):
src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/GoogleSheetExtractor.php#L31
Escaped Mutant for Mutator "LessThanOrEqualTo":
--- Original
+++ New
@@ @@
*/
public function __construct(private readonly Sheets $service, private readonly string $spreadsheetId, private readonly Columns $columnRange, private readonly bool $withHeader, private readonly int $rowsInBatch, private readonly array $options = [], private readonly EntryFactory $entryFactory = new NativeEntryFactory())
{
- if ($this->rowsInBatch <= 0) {
+ if ($this->rowsInBatch < 0) {
throw new InvalidArgumentException('Rows in batch must be greater than 0');
}
}
|