diff --git a/phpstan.neon b/phpstan.neon index 8eb69b25e..b4a8a49aa 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,6 +2,7 @@ parameters: level: 8 treatPhpDocTypesAsCertain: false ignoreErrors: + - identifier: argument.type - identifier: missingType.iterableValue - identifier: missingType.generics paths: 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 ba6bdca63..141dcf55e 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 @@ -59,7 +59,7 @@ public function extract(FlowContext $context) : \Generator continue; } - /** @var array $rowData */ + /** @var non-empty-list $rowData */ $rowData = \str_getcsv($csvLine, $separator, $enclosure, $escape); if (!\count($headers)) { diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalLimitOffsetExtractor.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalLimitOffsetExtractor.php index 779ed30f7..a60f123e3 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalLimitOffsetExtractor.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalLimitOffsetExtractor.php @@ -55,6 +55,7 @@ public function extract(FlowContext $context) : \Generator } else { $countQuery = (clone $this->queryBuilder)->select('COUNT(*)'); + // @phpstan-ignore-next-line if (\method_exists($countQuery, 'resetOrderBy')) { $countQuery->resetOrderBy(); } else { diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/Parameter.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/Parameter.php index 208f40ede..f27b0e780 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/Parameter.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/Parameter.php @@ -37,12 +37,15 @@ public function queryParamName() : string return $this->queryParamName; } - public function toQueryParam(Rows $rows) : mixed + /** + * @return array + */ + public function toQueryParam(Rows $rows) : array { return $rows->reduceToArray($this->ref); } - public function type() : int|ArrayParameterType|null + public function type() : int|ArrayParameterType { return $this->type; } diff --git a/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/ElasticsearchPHP/ElasticsearchExtractor.php b/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/ElasticsearchPHP/ElasticsearchExtractor.php index 666b1ab5d..5cbab7515 100644 --- a/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/ElasticsearchPHP/ElasticsearchExtractor.php +++ b/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/ElasticsearchPHP/ElasticsearchExtractor.php @@ -9,9 +9,9 @@ final class ElasticsearchExtractor implements Extractor { /** - * @phpstan-ignore-next-line - * * @psalm-suppress UndefinedClass + * + * @phpstan-ignore-next-line */ private \Elasticsearch\Client|\Elastic\Elasticsearch\Client|null $client; diff --git a/src/adapter/etl-adapter-logger/src/Flow/ETL/Adapter/Logger/PsrLoggerLoader.php b/src/adapter/etl-adapter-logger/src/Flow/ETL/Adapter/Logger/PsrLoggerLoader.php index 00913d768..7f163a4f8 100644 --- a/src/adapter/etl-adapter-logger/src/Flow/ETL/Adapter/Logger/PsrLoggerLoader.php +++ b/src/adapter/etl-adapter-logger/src/Flow/ETL/Adapter/Logger/PsrLoggerLoader.php @@ -15,9 +15,6 @@ public function __construct(private LoggerInterface $logger, private string $mes public function load(Rows $rows, FlowContext $context) : void { - /** - * @psalm-var callable(Row) : void $loader - */ $loader = function (Row $row) : void { $this->logger->log($this->logLevel, $this->message, $row->toArray()); }; diff --git a/src/core/etl/src/Flow/ETL/Config/Cache/CacheConfigBuilder.php b/src/core/etl/src/Flow/ETL/Config/Cache/CacheConfigBuilder.php index be9fdb557..6c77dda5b 100644 --- a/src/core/etl/src/Flow/ETL/Config/Cache/CacheConfigBuilder.php +++ b/src/core/etl/src/Flow/ETL/Config/Cache/CacheConfigBuilder.php @@ -22,13 +22,8 @@ final class CacheConfigBuilder public function build(FilesystemTable $fstab, Serializer $serializer) : CacheConfig { - $cachePath = \is_string(\getenv(CacheConfig::CACHE_DIR_ENV)) && \getenv(CacheConfig::CACHE_DIR_ENV) !== '' - ? \getenv(CacheConfig::CACHE_DIR_ENV) - : \sys_get_temp_dir() . '/flow_php/cache'; - - if (!\is_string($cachePath)) { - throw new RuntimeException('Cache directory must be a string, got ' . \gettype($cachePath)); - } + $cachePath = \getenv(CacheConfig::CACHE_DIR_ENV) ?: ''; + $cachePath = $cachePath !== '' ? $cachePath : \sys_get_temp_dir() . '/flow_php/cache'; if (!\file_exists($cachePath)) { if (!mkdir($cachePath, 0777, true) && !is_dir($cachePath)) { diff --git a/src/core/etl/src/Flow/ETL/DataFrame.php b/src/core/etl/src/Flow/ETL/DataFrame.php index 5dc8ed83d..deba1f58f 100644 --- a/src/core/etl/src/Flow/ETL/DataFrame.php +++ b/src/core/etl/src/Flow/ETL/DataFrame.php @@ -110,7 +110,6 @@ public static function fromArray(array $definition) : self } /** - * @throws \JsonException * @throws InvalidArgumentException */ public static function fromJson(string $json) : self @@ -118,7 +117,7 @@ public static function fromJson(string $json) : self try { return self::fromArray(\json_decode($json, true, 512, JSON_THROW_ON_ERROR)); } catch (\JsonException $exception) { - throw new InvalidFileFormatException('json', 'unknown'); + throw new InvalidFileFormatException('json', 'unknown', $exception); } } diff --git a/src/core/etl/src/Flow/ETL/Extractor/LimitableExtractor.php b/src/core/etl/src/Flow/ETL/Extractor/LimitableExtractor.php index cfd459800..561431152 100644 --- a/src/core/etl/src/Flow/ETL/Extractor/LimitableExtractor.php +++ b/src/core/etl/src/Flow/ETL/Extractor/LimitableExtractor.php @@ -4,12 +4,14 @@ namespace Flow\ETL\Extractor; +use Flow\ETL\Extractor; + /** * Limitable extractor is one that can be limited to extract only given number of rows. * Whenever limit is set in a pipeline before any transformations, LogicalPlan processor will try * to grab that limit and inject it directly to the extractor to avoid unnecessary processing. */ -interface LimitableExtractor +interface LimitableExtractor extends Extractor { public function changeLimit(int $limit) : void; diff --git a/src/core/etl/src/Flow/ETL/Function/Split.php b/src/core/etl/src/Flow/ETL/Function/Split.php index 048a9fb65..6c1e0ea56 100644 --- a/src/core/etl/src/Flow/ETL/Function/Split.php +++ b/src/core/etl/src/Flow/ETL/Function/Split.php @@ -15,7 +15,7 @@ public function __construct( ) { } - public function eval(Row $row) : array|string|null + public function eval(Row $row) : ?array { $value = (new Parameter($this->value))->asString($row); $separator = (new Parameter($this->separator))->asString($row); diff --git a/src/core/etl/src/Flow/ETL/Function/XPath.php b/src/core/etl/src/Flow/ETL/Function/XPath.php index 3b29c8369..1433c0d46 100644 --- a/src/core/etl/src/Flow/ETL/Function/XPath.php +++ b/src/core/etl/src/Flow/ETL/Function/XPath.php @@ -14,7 +14,7 @@ public function __construct( ) { } - public function eval(Row $row) : \DOMNode|array|null + public function eval(Row $row) : ?array { $value = (new Parameter($this->value))->asInstanceOf($row, \DOMNode::class); $path = (new Parameter($this->path))->asString($row); diff --git a/src/core/etl/src/Flow/ETL/Loader/ArrayLoader.php b/src/core/etl/src/Flow/ETL/Loader/ArrayLoader.php index 338af8904..5d1516f7b 100644 --- a/src/core/etl/src/Flow/ETL/Loader/ArrayLoader.php +++ b/src/core/etl/src/Flow/ETL/Loader/ArrayLoader.php @@ -9,7 +9,7 @@ final class ArrayLoader implements Loader { /** - * @param-out array> $array + * @param array> $array */ public function __construct(private array &$array) { diff --git a/src/core/etl/src/Flow/ETL/Loader/CallbackLoader.php b/src/core/etl/src/Flow/ETL/Loader/CallbackLoader.php index 84a47182e..d3032ce6b 100644 --- a/src/core/etl/src/Flow/ETL/Loader/CallbackLoader.php +++ b/src/core/etl/src/Flow/ETL/Loader/CallbackLoader.php @@ -9,9 +9,9 @@ final class CallbackLoader implements Loader { /** - * @phpstan-ignore-next-line - * * @param callable(Rows $row, FlowContext $context) : void $callback + * + * @phpstan-ignore-next-line */ private $callback; diff --git a/src/core/etl/src/Flow/ETL/Pipeline/CollectingPipeline.php b/src/core/etl/src/Flow/ETL/Pipeline/CollectingPipeline.php index 03a1564d9..3733bde33 100644 --- a/src/core/etl/src/Flow/ETL/Pipeline/CollectingPipeline.php +++ b/src/core/etl/src/Flow/ETL/Pipeline/CollectingPipeline.php @@ -4,7 +4,6 @@ namespace Flow\ETL\Pipeline; -use Flow\ETL\Exception\InvalidArgumentException; use Flow\ETL\{Extractor, FlowContext, Loader, Pipeline, Rows, Transformer}; /** @@ -12,11 +11,6 @@ */ final class CollectingPipeline implements Pipeline { - /** - * @param Pipeline $pipeline - * - * @throws InvalidArgumentException - */ public function __construct(private readonly Pipeline $pipeline) { } diff --git a/src/core/etl/src/Flow/ETL/Row.php b/src/core/etl/src/Flow/ETL/Row.php index 697f7f542..bf13730c0 100644 --- a/src/core/etl/src/Flow/ETL/Row.php +++ b/src/core/etl/src/Flow/ETL/Row.php @@ -29,8 +29,6 @@ public static function with(Entry ...$entries) : self /** * @throws InvalidArgumentException - * - * @return $this */ public function add(Entry ...$entries) : self { @@ -151,10 +149,8 @@ public function toArray(bool $withKeys = true) : array /** * @throws InvalidArgumentException - * - * @return mixed */ - public function valueOf(string|Reference $name) + public function valueOf(string|Reference $name) : mixed { return $this->get($name)->value(); } diff --git a/src/core/etl/src/Flow/ETL/Row/Entries.php b/src/core/etl/src/Flow/ETL/Row/Entries.php index f5cff6955..941b9f03f 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entries.php +++ b/src/core/etl/src/Flow/ETL/Row/Entries.php @@ -37,8 +37,6 @@ public function __construct(Entry ...$entries) /** * @throws InvalidArgumentException - * - * @return $this */ public function add(Entry ...$entries) : self { @@ -222,7 +220,7 @@ public function offsetSet(mixed $offset, mixed $value) : void /** * @param array-key $offset * - * @throws InvalidArgumentException + * @throws RuntimeException */ public function offsetUnset(mixed $offset) : void { @@ -312,9 +310,6 @@ public function rename(string|Reference $currentName, string|Reference $newName) return self::recreate($entries); } - /** - * @return $this - */ public function set(Entry ...$entries) : self { $newEntries = $this->entries; diff --git a/src/core/etl/src/Flow/ETL/Row/Schema/Metadata.php b/src/core/etl/src/Flow/ETL/Row/Schema/Metadata.php index 3605d54ca..1b5f7f431 100644 --- a/src/core/etl/src/Flow/ETL/Row/Schema/Metadata.php +++ b/src/core/etl/src/Flow/ETL/Row/Schema/Metadata.php @@ -41,8 +41,6 @@ public static function fromArray(array $map) : self /** * @param string $key * @param array|bool|float|int|string $value - * - * @return $this */ public static function with(string $key, int|string|bool|float|array $value) : self { @@ -52,8 +50,6 @@ public static function with(string $key, int|string|bool|float|array $value) : s /** * @param string $key * @param array|bool|float|int|string $value - * - * @return $this */ public function add(string $key, int|string|bool|float|array $value) : self { diff --git a/src/core/etl/src/Flow/ETL/Rows.php b/src/core/etl/src/Flow/ETL/Rows.php index a5babc232..e1d0c663c 100644 --- a/src/core/etl/src/Flow/ETL/Rows.php +++ b/src/core/etl/src/Flow/ETL/Rows.php @@ -674,8 +674,6 @@ public function sort(callable $callback) : self /** * @throws InvalidArgumentException - * - * @return $this */ public function sortAscending(string|Reference $ref) : self { @@ -687,8 +685,6 @@ public function sortAscending(string|Reference $ref) : self /** * @throws InvalidArgumentException - * - * @return $this */ public function sortBy(Reference ...$refs) : self { @@ -703,8 +699,6 @@ public function sortBy(Reference ...$refs) : self /** * @throws InvalidArgumentException - * - * @return $this */ public function sortDescending(string|Reference $ref) : self { diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/CopyBlob/CopyBlobOptions.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/CopyBlob/CopyBlobOptions.php index 729b0a7d5..ed21a2f09 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/CopyBlob/CopyBlobOptions.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/CopyBlob/CopyBlobOptions.php @@ -28,18 +28,14 @@ final class CopyBlobOptions implements EndpointOptions private ?int $timeoutSeconds = null; - private ?string $version = BlobService::VERSION; + private string $version = BlobService::VERSION; private ?string $versionId = null; public function toHeaders() : array { $headers = []; - - if ($this->version !== null) { - $headers['x-ms-version'] = $this->version; - } - + $headers['x-ms-version'] = $this->version; $headers['User-Agent'] = $this->userAgentHeader(); if ($this->requestId !== null) { @@ -82,6 +78,20 @@ public function toURIParameters() : array return $uriParameters; } + public function withDeleteSnapshots(DeleteSnapshots $deleteSnapshots) : self + { + $this->deleteSnapshots = $deleteSnapshots; + + return $this; + } + + public function withDeleteType(DeleteType $deleteType) : self + { + $this->deleteType = $deleteType; + + return $this; + } + public function withLeaseId(string $leaseId) : self { $this->leaseId = $leaseId; diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/CreateContainer/CreateContainerOptions.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/CreateContainer/CreateContainerOptions.php index 429e36492..c26924c5c 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/CreateContainer/CreateContainerOptions.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/CreateContainer/CreateContainerOptions.php @@ -16,17 +16,14 @@ final class CreateContainerOptions implements EndpointOptions private ?int $timeoutSeconds = null; - private ?string $version = BlobService::VERSION; + private string $version = BlobService::VERSION; public function toHeaders() : array { $headers = []; $headers['user-agent'] = $this->userAgentHeader(); - - if ($this->version !== null) { - $headers['x-ms-version'] = $this->version; - } + $headers['x-ms-version'] = $this->version; if ($this->requestId !== null) { $headers['x-ms-client-request-id'] = $this->requestId; diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/DeleteBlob/DeleteBlobOptions.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/DeleteBlob/DeleteBlobOptions.php index 11b19631b..a01e61698 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/DeleteBlob/DeleteBlobOptions.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/DeleteBlob/DeleteBlobOptions.php @@ -22,7 +22,7 @@ final class DeleteBlobOptions implements EndpointOptions private ?int $timeoutSeconds = null; - private ?string $version = BlobService::VERSION; + private string $version = BlobService::VERSION; private ?string $versionId = null; @@ -31,10 +31,7 @@ public function toHeaders() : array $headers = []; $headers['user-agent'] = $this->userAgentHeader(); - - if ($this->version !== null) { - $headers['x-ms-version'] = $this->version; - } + $headers['x-ms-version'] = $this->version; if ($this->requestId !== null) { $headers['x-ms-client-request-id'] = $this->requestId; @@ -76,6 +73,20 @@ public function toURIParameters() : array return $uriParameters; } + public function withDeleteSnapshots(DeleteSnapshots $deleteSnapshots) : self + { + $this->deleteSnapshots = $deleteSnapshots; + + return $this; + } + + public function withDeleteType(DeleteType $deleteType) : self + { + $this->deleteType = $deleteType; + + return $this; + } + public function withLeaseId(string $leaseId) : self { $this->leaseId = $leaseId; diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/DeleteContainer/DeleteContainerOptions.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/DeleteContainer/DeleteContainerOptions.php index 7cba039bd..e88722453 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/DeleteContainer/DeleteContainerOptions.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/DeleteContainer/DeleteContainerOptions.php @@ -16,17 +16,14 @@ final class DeleteContainerOptions implements EndpointOptions private ?int $timeoutSeconds = null; - private ?string $version = BlobService::VERSION; + private string $version = BlobService::VERSION; public function toHeaders() : array { $headers = []; $headers['user-agent'] = $this->userAgentHeader(); - - if ($this->version !== null) { - $headers['x-ms-version'] = $this->version; - } + $headers['x-ms-version'] = $this->version; if ($this->requestId !== null) { $headers['x-ms-client-request-id'] = $this->requestId; diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlob/GetBlobOptions.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlob/GetBlobOptions.php index 63b114cc5..e37a08cc1 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlob/GetBlobOptions.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlob/GetBlobOptions.php @@ -32,7 +32,7 @@ final class GetBlobOptions implements EndpointOptions private ?int $timeoutSeconds = null; - private ?string $version = BlobService::VERSION; + private string $version = BlobService::VERSION; private ?string $versionId = null; @@ -41,15 +41,12 @@ public function toHeaders() : array $headers = []; $headers['user-agent'] = $this->userAgentHeader(); + $headers['x-ms-version'] = $this->version; if ($this->range !== null) { $headers['x-ms-range'] = $this->range->toString(); } - if ($this->version !== null) { - $headers['x-ms-version'] = $this->version; - } - if ($this->requestId !== null) { $headers['x-ms-client-request-id'] = $this->requestId; } diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlobProperties/GetBlobPropertiesOptions.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlobProperties/GetBlobPropertiesOptions.php index cad0e4583..1c99978d6 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlobProperties/GetBlobPropertiesOptions.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlobProperties/GetBlobPropertiesOptions.php @@ -24,7 +24,7 @@ final class GetBlobPropertiesOptions implements EndpointOptions private ?int $timeoutSeconds = null; - private ?string $version = BlobService::VERSION; + private string $version = BlobService::VERSION; private ?string $versionId = null; @@ -33,10 +33,7 @@ public function toHeaders() : array $headers = []; $headers['user-agent'] = $this->userAgentHeader(); - - if ($this->version !== null) { - $headers['x-ms-version'] = $this->version; - } + $headers['x-ms-version'] = $this->version; if ($this->requestId !== null) { $headers['x-ms-client-request-id'] = $this->requestId; diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlockBlobBlockList/GetBlockBlobBlockListOptions.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlockBlobBlockList/GetBlockBlobBlockListOptions.php index 95e2ccc39..8cf419e64 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlockBlobBlockList/GetBlockBlobBlockListOptions.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlockBlobBlockList/GetBlockBlobBlockListOptions.php @@ -71,6 +71,13 @@ public function withBlockListType(BlockListType $blockListType) : self return $this; } + public function withLeaseId(string $leaseId) : self + { + $this->leaseId = $leaseId; + + return $this; + } + public function withRequestId(string $requestId) : self { $this->requestId = $requestId; @@ -91,4 +98,11 @@ public function withTimeoutSeconds(int $timeoutSeconds) : self return $this; } + + public function withVersionId(string $versionId) : self + { + $this->versionId = $versionId; + + return $this; + } } diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetContainerProperties/GetContainerPropertiesOptions.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetContainerProperties/GetContainerPropertiesOptions.php index f77e6da19..281572e28 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetContainerProperties/GetContainerPropertiesOptions.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetContainerProperties/GetContainerPropertiesOptions.php @@ -16,7 +16,7 @@ final class GetContainerPropertiesOptions implements EndpointOptions private ?int $timeoutSeconds = null; - private ?string $version = BlobService::VERSION; + private string $version = BlobService::VERSION; private ?string $versionId = null; @@ -25,10 +25,7 @@ public function toHeaders() : array $headers = []; $headers['user-agent'] = $this->userAgentHeader(); - - if ($this->version !== null) { - $headers['x-ms-version'] = $this->version; - } + $headers['x-ms-version'] = $this->version; if ($this->requestId !== null) { $headers['x-ms-client-request-id'] = $this->requestId; diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/ListBlobs/ListBlobOptions.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/ListBlobs/ListBlobOptions.php index c0cd354ed..91bbf3b27 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/ListBlobs/ListBlobOptions.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/ListBlobs/ListBlobOptions.php @@ -29,7 +29,7 @@ final class ListBlobOptions implements EndpointOptions private ?int $timeoutSeconds = null; - private ?string $version = BlobService::VERSION; + private string $version = BlobService::VERSION; public function __construct() { @@ -40,10 +40,7 @@ public function toHeaders() : array $headers = []; $headers['user-agent'] = $this->userAgentHeader(); - - if ($this->version !== null) { - $headers['x-ms-version'] = $this->version; - } + $headers['x-ms-version'] = $this->version; if ($this->requestId !== null) { $headers['x-ms-client-request-id'] = $this->requestId; diff --git a/src/lib/filesystem/src/Flow/Filesystem/Local/StdOut/Filter/Intercept.php b/src/lib/filesystem/src/Flow/Filesystem/Local/StdOut/Filter/Intercept.php index 8f8d79be0..117afd17b 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Local/StdOut/Filter/Intercept.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Local/StdOut/Filter/Intercept.php @@ -18,7 +18,7 @@ public function filter($in, $out, &$consumed, bool $closing) : int { while ($bucket = stream_bucket_make_writeable($in)) { self::$buffer .= $bucket->data; - $consumed += $bucket->datalen; + $consumed += (int) $bucket->datalen; } return PSFS_FEED_ME; diff --git a/src/lib/filesystem/src/Flow/Filesystem/Path.php b/src/lib/filesystem/src/Flow/Filesystem/Path.php index 82fa062c5..b6e25e072 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Path.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Path.php @@ -176,7 +176,7 @@ public function extension() : string|false return $this->extension; } - public function filename() : bool|string + public function filename() : string { return $this->filename; } diff --git a/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadMetadataCommand.php b/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadMetadataCommand.php index dca698482..6e28505ad 100644 --- a/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadMetadataCommand.php +++ b/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadMetadataCommand.php @@ -86,7 +86,7 @@ protected function execute(InputInterface $input, OutputInterface $output) : int $column->flatPath(), ($column->type() ? $column->type()->name : 'group') . ($column->typeLength() ? '(' . $column->typeLength() . ')' : ''), $column->logicalType() ? $column->logicalType()->name() : '-', - $column->repetition()?->name ?? 'N/A', + $column->repetition()?->name ?: 'N/A', $column->maxRepetitionsLevel(), $column->maxDefinitionsLevel(), ]); diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/PlainValuesPacker.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/PlainValuesPacker.php index 41e75bee3..dc4621c96 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/PlainValuesPacker.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/PlainValuesPacker.php @@ -76,8 +76,6 @@ public function packValues(FlatColumn $column, array $values) : void break; case LogicalType::DECIMAL: /** - * @phpstan-ignore-next-line - * * @psalm-suppress PossiblyNullArgument */ $this->writer->writeDecimals($parquetValues, $column->typeLength(), $column->precision(), $column->scale()); diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Page/ColumnData.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Page/ColumnData.php index e45890581..bbca49cf1 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Page/ColumnData.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Page/ColumnData.php @@ -76,7 +76,7 @@ public function splitLastRow() : array $definitions = []; $values = []; - $maxDefinition = \max($this->definitions); + $maxDefinition = $this->definitions ? \max($this->definitions) : 0; $lastRowRepetitions = []; $lastRowDefinitions = []; diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/RowGroup/ColumnChunk.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/RowGroup/ColumnChunk.php index 368ef2839..b8cac95c8 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/RowGroup/ColumnChunk.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/RowGroup/ColumnChunk.php @@ -95,7 +95,8 @@ public function flatPath() : string public function pageOffset() : int { - $offset = \min( + return \min( + // @phpstan-ignore-next-line \array_filter( [ $this->dictionaryPageOffset, @@ -104,8 +105,6 @@ public function pageOffset() : int ], ) ); - - return $offset; } public function statistics() : ?StatisticsReader diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/FlatColumn.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/FlatColumn.php index 3824dcb67..1ae46bdf5 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/FlatColumn.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/FlatColumn.php @@ -142,7 +142,7 @@ public static function uuid(string $uuid, Repetition $repetition = Repetition::O return new self($uuid, PhysicalType::FIXED_LEN_BYTE_ARRAY, null, LogicalType::uuid(), $repetition, typeLength: 16); } - public function __debugInfo() : ?array + public function __debugInfo() : array { return [ 'name' => $this->name, diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/NestedColumn.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/NestedColumn.php index 5cade913d..8f276dd35 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/NestedColumn.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/NestedColumn.php @@ -109,7 +109,7 @@ public static function structure(string $name, array $children, Repetition $repe return new self($name, $repetition, $children); } - public function __debugInfo() : ?array + public function __debugInfo() : array { return [ 'name' => $this->name, diff --git a/tools/phpstan/composer.json b/tools/phpstan/composer.json index 569dd259c..4353c9bcb 100644 --- a/tools/phpstan/composer.json +++ b/tools/phpstan/composer.json @@ -2,7 +2,7 @@ "name": "flow-php/flow-tools", "description": "Flow PHP ETL - Tools", "require-dev": { - "phpstan/phpstan": "^1.10" + "phpstan/phpstan": "^2.0" }, "config": { "allow-plugins": false diff --git a/tools/phpstan/composer.lock b/tools/phpstan/composer.lock index 9e0a2e742..2c5507ea9 100644 --- a/tools/phpstan/composer.lock +++ b/tools/phpstan/composer.lock @@ -4,25 +4,25 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "17ec83f26522a390cc1c7b62f42a5bd4", + "content-hash": "f69b20ebb7b894a5265b6612582c7268", "packages": [], "packages-dev": [ { "name": "phpstan/phpstan", - "version": "1.12.9", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "ceb937fb39a92deabc02d20709cf14b2c452502c" + "reference": "6c98c7600fc717b2c78c11ef60040d5b1e359c82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ceb937fb39a92deabc02d20709cf14b2c452502c", - "reference": "ceb937fb39a92deabc02d20709cf14b2c452502c", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/6c98c7600fc717b2c78c11ef60040d5b1e359c82", + "reference": "6c98c7600fc717b2c78c11ef60040d5b1e359c82", "shasum": "" }, "require": { - "php": "^7.2|^8.0" + "php": "^7.4|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -63,7 +63,7 @@ "type": "github" } ], - "time": "2024-11-10T17:10:04+00:00" + "time": "2024-11-17T14:17:00+00:00" } ], "aliases": [],