diff --git a/src/adapter/etl-adapter-amphp/src/Flow/ETL/Async/Amp/Worker/ChildProcessLauncher.php b/src/adapter/etl-adapter-amphp/src/Flow/ETL/Async/Amp/Worker/ChildProcessLauncher.php index e5356e217..fe2b5cc6e 100644 --- a/src/adapter/etl-adapter-amphp/src/Flow/ETL/Async/Amp/Worker/ChildProcessLauncher.php +++ b/src/adapter/etl-adapter-amphp/src/Flow/ETL/Async/Amp/Worker/ChildProcessLauncher.php @@ -36,7 +36,7 @@ private function onStart(Process $process) : void while (null !== $chunk = $stdout->read()) { foreach (\explode("\n", $chunk) as $chunkLine) { - if (\strlen($chunkLine)) { + if ('' !== $chunkLine) { $this->logger->debug($chunkLine); } } @@ -44,7 +44,7 @@ private function onStart(Process $process) : void while (null !== $chunk = $stderr->read()) { foreach (\explode("\n", $chunk) as $chunkLine) { - if (\strlen($chunkLine)) { + if ('' !== $chunkLine) { $this->logger->error($chunkLine); } } diff --git a/src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/AvroExtractor.php b/src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/AvroExtractor.php index b584a956c..e884b7d4d 100644 --- a/src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/AvroExtractor.php +++ b/src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/AvroExtractor.php @@ -65,7 +65,7 @@ public function extract(FlowContext $context) : \Generator } } - if (\count($rows) > 0) { + if ([] !== $rows) { yield new Rows(...$rows); } } diff --git a/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/CSVExtractor.php b/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/CSVExtractor.php index 8d54261e0..82451ca0b 100644 --- a/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/CSVExtractor.php +++ b/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/CSVExtractor.php @@ -101,7 +101,7 @@ public function extract(FlowContext $context) : \Generator $rowData = \fgetcsv($stream->resource(), $this->charactersReadInLine, $this->separator, $this->enclosure, $this->escape); } - if (\count($rows)) { + if ([] !== $rows) { yield new Rows(...$rows); } diff --git a/src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/Columns.php b/src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/Columns.php index dbd565cad..1b669bcb9 100644 --- a/src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/Columns.php +++ b/src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/Columns.php @@ -13,7 +13,7 @@ public function __construct( public readonly string $startColumn, public readonly string $endColumn, ) { - if (\strlen($sheetName) === 0) { + if ('' === $sheetName) { throw new InvalidArgumentException('Sheet name can\'t be empty'); } diff --git a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/Codename/ParquetExtractor.php b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/Codename/ParquetExtractor.php index f31b1f7c1..aea963bbe 100644 --- a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/Codename/ParquetExtractor.php +++ b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/Codename/ParquetExtractor.php @@ -37,7 +37,7 @@ public function extract(FlowContext $context) : \Generator $data = []; foreach ($dataFields as $field) { - if (\count($this->fields) && !\in_array($field->name, $this->fields, true)) { + if ([] !== $this->fields && !\in_array($field->name, $this->fields, true)) { continue; } diff --git a/src/adapter/etl-adapter-reactphp/src/Flow/ETL/Async/ReactPHP/Worker/ChildProcessLauncher.php b/src/adapter/etl-adapter-reactphp/src/Flow/ETL/Async/ReactPHP/Worker/ChildProcessLauncher.php index 796a8701b..6d7d0c9cf 100644 --- a/src/adapter/etl-adapter-reactphp/src/Flow/ETL/Async/ReactPHP/Worker/ChildProcessLauncher.php +++ b/src/adapter/etl-adapter-reactphp/src/Flow/ETL/Async/ReactPHP/Worker/ChildProcessLauncher.php @@ -33,7 +33,7 @@ public function launch(Pool $pool, string $host) : void $process->stderr->on('data', function ($chunk) : void { foreach (\explode("\n", $chunk) as $chunkLine) { - if (\strlen($chunkLine)) { + if ('' !== $chunkLine) { $this->logger->error($chunkLine); } } @@ -41,7 +41,7 @@ public function launch(Pool $pool, string $host) : void $process->stdout->on('data', function ($chunk) : void { foreach (\explode("\n", $chunk) as $chunkLine) { - if (\strlen($chunkLine)) { + if ('' !== $chunkLine) { $this->logger->debug($chunkLine); } } diff --git a/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/TextExtractor.php b/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/TextExtractor.php index 47356c80b..ed9991576 100644 --- a/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/TextExtractor.php +++ b/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/TextExtractor.php @@ -55,7 +55,7 @@ public function extract(FlowContext $context) : \Generator $rowData = \fgets($fileStream->resource()); } - if (\count($rows)) { + if ([] !== $rows) { yield new Rows(...$rows); } } diff --git a/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/XMLReaderExtractor.php b/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/XMLReaderExtractor.php index f2d2f972c..7583bf3fc 100644 --- a/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/XMLReaderExtractor.php +++ b/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/XMLReaderExtractor.php @@ -90,7 +90,7 @@ public function extract(FlowContext $context) : \Generator $xmlReader->close(); - if (\count($rows)) { + if ([] !== $rows) { yield new Rows(...$rows); } } diff --git a/src/core/etl/src/Flow/ETL/Async/Socket/Worker/Processor.php b/src/core/etl/src/Flow/ETL/Async/Socket/Worker/Processor.php index 815545317..3debc5b08 100644 --- a/src/core/etl/src/Flow/ETL/Async/Socket/Worker/Processor.php +++ b/src/core/etl/src/Flow/ETL/Async/Socket/Worker/Processor.php @@ -58,7 +58,7 @@ public function process(Rows $rows) : Rows ->mode(SaveMode::Append) ->threadSafe(); - if (\count($this->partitionEntries)) { + if ([] !== $this->partitionEntries) { $dataFrame = $dataFrame->partitionBy(...$this->partitionEntries); } diff --git a/src/core/etl/src/Flow/ETL/DSL/functions.php b/src/core/etl/src/Flow/ETL/DSL/functions.php index e26bb09f8..60ae72b11 100644 --- a/src/core/etl/src/Flow/ETL/DSL/functions.php +++ b/src/core/etl/src/Flow/ETL/DSL/functions.php @@ -16,7 +16,7 @@ function col(string $entry, string ...$entries) : Reference { - if (\count($entries)) { + if ([] !== $entries) { return new StructureReference($entry, ...$entries); } diff --git a/src/core/etl/src/Flow/ETL/Filesystem/Path.php b/src/core/etl/src/Flow/ETL/Filesystem/Path.php index cec76f313..98f327561 100644 --- a/src/core/etl/src/Flow/ETL/Filesystem/Path.php +++ b/src/core/etl/src/Flow/ETL/Filesystem/Path.php @@ -73,7 +73,7 @@ public function __construct(string $uri, private readonly array $options = []) public static function realpath(string $path, array $options = []) : self { // "" - empty path is current, local directory - if (!\strlen($path)) { + if ('' === $path) { /** @phpstan-ignore-next-line */ return new self(\getcwd(), $options); } @@ -124,7 +124,7 @@ public static function realpath(string $path, array $options = []) : self } if ($part === '..') { - if (\count($absoluteParts)) { + if ([] !== $absoluteParts) { \array_pop($absoluteParts); } diff --git a/src/core/etl/src/Flow/ETL/GroupBy.php b/src/core/etl/src/Flow/ETL/GroupBy.php index 3c8e4f627..e69536451 100644 --- a/src/core/etl/src/Flow/ETL/GroupBy.php +++ b/src/core/etl/src/Flow/ETL/GroupBy.php @@ -101,7 +101,7 @@ public function result() : Rows $entries = $entries->add($aggregator->result()); } - if (\count($entries)) { + if ($entries->count()) { $rows = $rows->add(new Row($entries)); } } diff --git a/src/core/etl/src/Flow/ETL/Partition.php b/src/core/etl/src/Flow/ETL/Partition.php index 3c4a8137b..531628954 100644 --- a/src/core/etl/src/Flow/ETL/Partition.php +++ b/src/core/etl/src/Flow/ETL/Partition.php @@ -19,11 +19,11 @@ final class Partition implements Serializable public function __construct(public readonly string $name, public readonly string $value) { - if (!\strlen($this->name)) { + if ('' === $this->name) { throw new InvalidArgumentException("Partition name can't be empty"); } - if (!\strlen($this->value)) { + if ('' === $this->value) { throw new InvalidArgumentException("Partition value can't be empty"); } diff --git a/src/core/etl/src/Flow/ETL/Row/Entries.php b/src/core/etl/src/Flow/ETL/Row/Entries.php index e6fedf03f..ca5542c73 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entries.php +++ b/src/core/etl/src/Flow/ETL/Row/Entries.php @@ -28,7 +28,7 @@ public function __construct(Entry ...$entries) { $this->entries = []; - if (\count($entries)) { + if ([] !== $entries) { foreach ($entries as $entry) { $this->entries[$entry->name()] = $entry; } diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/ArrayEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/ArrayEntry.php index 6b37a2ad9..9b605c961 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/ArrayEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/ArrayEntry.php @@ -26,7 +26,7 @@ public function __construct( private readonly string $name, private readonly array $value ) { - if (!\strlen($name)) { + if ('' === $name) { throw InvalidArgumentException::because('Entry name cannot be empty'); } } diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/BooleanEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/BooleanEntry.php index 04dab020c..b81e6320f 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/BooleanEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/BooleanEntry.php @@ -21,7 +21,7 @@ final class BooleanEntry implements \Stringable, Entry */ public function __construct(private readonly string $name, private readonly bool $value) { - if (!\strlen($name)) { + if ('' === $name) { throw InvalidArgumentException::because('Entry name cannot be empty'); } } diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/FloatEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/FloatEntry.php index 26cd54252..42df04de4 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/FloatEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/FloatEntry.php @@ -21,7 +21,7 @@ final class FloatEntry implements \Stringable, Entry */ public function __construct(private readonly string $name, private readonly float $value, private readonly int $precision = 6) { - if (!\strlen($name)) { + if ('' === $name) { throw InvalidArgumentException::because('Entry name cannot be empty'); } } diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/IntegerEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/IntegerEntry.php index 85def7d98..c65f6d3b0 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/IntegerEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/IntegerEntry.php @@ -21,7 +21,7 @@ final class IntegerEntry implements \Stringable, Entry */ public function __construct(private readonly string $name, private readonly int $value) { - if (!\strlen($name)) { + if ('' === $name) { throw InvalidArgumentException::because('Entry name cannot be empty'); } } diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/JsonEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/JsonEntry.php index aacca2ea3..ed7cdd10a 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/JsonEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/JsonEntry.php @@ -28,7 +28,7 @@ final class JsonEntry implements \Stringable, Entry */ public function __construct(private readonly string $name, private readonly array $value) { - if (!\strlen($name)) { + if ('' === $name) { throw InvalidArgumentException::because('Entry name cannot be empty'); } diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/ListEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/ListEntry.php index 93e0d25b7..ba6a709c6 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/ListEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/ListEntry.php @@ -34,11 +34,11 @@ public function __construct( private readonly Type $type, private readonly array $value ) { - if (!\strlen($name)) { + if ('' === $name) { throw InvalidArgumentException::because('Entry name cannot be empty'); } - if (\count($value) && !\array_is_list($value)) { + if ([] !== $value && !\array_is_list($value)) { throw new InvalidArgumentException('Expected list of ' . $type->toString() . ' got array with not sequential integer indexes'); } diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/NullEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/NullEntry.php index 44c2b904c..2a6274a95 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/NullEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/NullEntry.php @@ -21,7 +21,7 @@ final class NullEntry implements \Stringable, Entry */ public function __construct(private readonly string $name) { - if (!\strlen($name)) { + if ('' === $name) { throw InvalidArgumentException::because('Entry name cannot be empty'); } } diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/ObjectEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/ObjectEntry.php index b3677d169..9a6a4d92f 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/ObjectEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/ObjectEntry.php @@ -21,7 +21,7 @@ final class ObjectEntry implements \Stringable, Entry */ public function __construct(private readonly string $name, private readonly object $value) { - if (!\strlen($name)) { + if ('' === $name) { throw InvalidArgumentException::because('Entry name cannot be empty'); } } diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/StringEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/StringEntry.php index ee7f7dcb6..7eee45e8e 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/StringEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/StringEntry.php @@ -21,7 +21,7 @@ final class StringEntry implements \Stringable, Entry */ public function __construct(private readonly string $name, private string $value) { - if (!\strlen($name)) { + if ('' === $name) { throw InvalidArgumentException::because('Entry name cannot be empty'); } } diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/StructureEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/StructureEntry.php index 11b31db74..40a4f814c 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/StructureEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/StructureEntry.php @@ -27,7 +27,7 @@ final class StructureEntry implements \Stringable, Entry */ public function __construct(private readonly string $name, Entry ...$entries) { - if (!\strlen($name)) { + if ('' === $name) { throw InvalidArgumentException::because('Entry name cannot be empty'); } diff --git a/src/core/etl/src/Flow/ETL/Rows.php b/src/core/etl/src/Flow/ETL/Rows.php index 03da3c5ff..3bb9ba25c 100644 --- a/src/core/etl/src/Flow/ETL/Rows.php +++ b/src/core/etl/src/Flow/ETL/Rows.php @@ -228,7 +228,7 @@ public function findOne(callable $callable) : ?Row } } - if (\count($rows)) { + if ([] !== $rows) { return \current($rows); } diff --git a/src/lib/array-dot/src/Flow/ArrayDot/array_dot.php b/src/lib/array-dot/src/Flow/ArrayDot/array_dot.php index 289829b1d..27f0a7650 100644 --- a/src/lib/array-dot/src/Flow/ArrayDot/array_dot.php +++ b/src/lib/array-dot/src/Flow/ArrayDot/array_dot.php @@ -16,7 +16,7 @@ */ function array_dot_steps(string $path) : array { - if (!\strlen($path)) { + if ('' === $path) { throw new InvalidPathException("Path can't be empty."); } @@ -119,7 +119,7 @@ function array_dot_set(array $array, string $path, $value) : array */ function array_dot_get(array $array, string $path) : mixed { - if (\count($array) === 0) { + if ([] === $array) { if (\str_starts_with($path, '?')) { return null; } diff --git a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Columns.php b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Columns.php index ea28e8ea0..7eb7179d2 100644 --- a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Columns.php +++ b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Columns.php @@ -15,7 +15,7 @@ final class Columns public function __construct(string ...$columns) { - if (\count($columns) === 0) { + if ([] === $columns) { throw new RuntimeException('Columns cannot be empty'); }