Skip to content

Commit

Permalink
Rework Psalm configuration & adjust codebase (#822)
Browse files Browse the repository at this point in the history
  • Loading branch information
stloyd authored Nov 23, 2023
1 parent 53abfd7 commit a123021
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 25 deletions.
24 changes: 5 additions & 19 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,9 @@
findUnusedCode="false"
>
<projectFiles>
<directory name="src/adapter/etl-adapter-avro/src" />
<directory name="src/adapter/etl-adapter-csv/src" />
<directory name="src/adapter/etl-adapter-chartjs/src" />
<directory name="src/adapter/etl-adapter-doctrine/src" />
<directory name="src/adapter/etl-adapter-elasticsearch/src" />
<directory name="src/adapter/etl-adapter-filesystem/src" />
<directory name="src/adapter/etl-adapter-google-sheet/src" />
<directory name="src/adapter/etl-adapter-http/src" />
<directory name="src/adapter/etl-adapter-json/src" />
<directory name="src/adapter/etl-adapter-logger/src" />
<directory name="src/adapter/etl-adapter-parquet/src" />
<directory name="src/adapter/etl-adapter-text/src" />
<directory name="src/adapter/etl-adapter-xml/src" />
<directory name="src/core/etl/src" />
<directory name="src/lib/array-dot/src" />
<directory name="src/lib/doctrine-dbal-bulk/src" />
<directory name="src/lib/parquet/src" />
<directory name="src/lib/dremel/src" />
<directory name="src/lib/snappy/src" />
<directory name="src/adapter/**/src" />
<directory name="src/core/**/src" />
<directory name="src/lib/**/src" />
<ignoreFiles>
<directory name="vendor"/>

Expand All @@ -45,6 +29,8 @@
<file name="src/adapter/etl-adapter-filesystem/src/Flow/ETL/Adapter/Filesystem/AwsS3Stream.php" />
<file name="src/adapter/etl-adapter-filesystem/src/Flow/ETL/Adapter/Filesystem/AzureBlobStream.php" />

<file name="src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadMetadataCommand.php" />

<directory name="src/lib/parquet/src/Flow/Parquet/ThriftStream/" />
<directory name="src/lib/parquet/src/Flow/Parquet/Thrift/" />
<directory name="src/lib/parquet/src/Flow/Parquet/BinaryReader/" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function transform(Rows $rows, FlowContext $context) : Rows
$entries = [];

foreach ($row->toArray() as $key => $value) {
$entries[] = $context->entryFactory()->create((string) $key, $value);
$entries[] = $context->entryFactory()->create($key, $value);
}

$newRows[] = Row::create(...$entries);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ public function getQuery() : string

public function set(string $key, mixed $value) : self
{
/** @phpstan-ignore-next-line */
/**
* @psalm-suppress InvalidArgument
*
* @phpstan-ignore-next-line
*/
return new self(\array_merge($this->params, [$key => $value]));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ public function toRows(EntryFactory $entryFactory) : Rows
public function total() : int
{
try {
/** @phpstan-ignore-next-line */
return $this->results->getTotalHits();
return $this->results->getTotalHits() ?: 0;
} catch (\Error) {
return $this->results->getEstimatedTotalHits();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,16 @@ protected function execute(InputInterface $input, OutputInterface $output) : int
return Command::FAILURE;
}

$batchSize = (int) $input->getOption('batch-size');

if ($batchSize < 1) {
$style->error('Batch size must be positive number, got: ' . $batchSize);

return Command::FAILURE;
}

$limit = (int) $input->getOption('limit');
$columns = $input->getOption('columns');
$batchSize = (int) $input->getOption('batch-size');
$truncate = $input->getOption('truncate') ? (int) $input->getOption('truncate') : false;

\ob_start();
Expand All @@ -63,7 +70,7 @@ protected function execute(InputInterface $input, OutputInterface $output) : int
->write(To::output($truncate))
->run();

$output->write(\ob_get_clean());
$output->write(\ob_get_clean() ?: '');

return Command::SUCCESS;
}
Expand Down

0 comments on commit a123021

Please sign in to comment.