Skip to content

Commit ca840c8

Browse files
authored
Fix global phpstan errors (#1350)
* Added missing path to libs to rector configuration * Fixed phpstan globally ignored errors * Updated DSL * More CS Fixes * Build docs
1 parent 056ebe0 commit ca840c8

File tree

183 files changed

+1385
-1115
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

183 files changed

+1385
-1115
lines changed

.php-cs-fixer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
__DIR__ . '/web/**/tests',
2323
__DIR__ . '/examples',
2424
__DIR__ . '/tools/rector/src',
25+
])
26+
->exclude([
27+
__DIR__ . '/src/lib/parquet/src/Flow/Parquet/Thrift'
2528
]);
2629

2730
if (!\file_exists(__DIR__ . '/var')) {
@@ -146,6 +149,8 @@
146149
'ternary_to_null_coalescing' => true,
147150
'yoda_style' => false,
148151
'void_return' => true,
152+
'fully_qualified_strict_types' => false,
153+
'phpdoc_array_type' => true,
149154
'php_unit_method_casing' => ['case' => 'snake_case'],
150155
'php_unit_test_case_static_method_calls' => ['call_type' => 'static'],
151156
])

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,9 @@
386386
"tools/cs-fixer/vendor/bin/php-cs-fixer fix --dry-run"
387387
],
388388
"cs:php:fix": [
389-
"tools/cs-fixer/vendor/bin/php-cs-fixer fix"
389+
"tools/cs-fixer/vendor/bin/php-cs-fixer fix",
390+
"./tools/rector/vendor/bin/rector -c ./rector.src.php",
391+
"./tools/rector/vendor/bin/rector -c ./rector.tests.php"
390392
],
391393
"build:phar": [
392394
"composer update --working-dir=./src/cli",

phpstan.neon

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@ parameters:
33
treatPhpDocTypesAsCertain: false
44
ignoreErrors:
55
- identifier: argument.type
6+
paths:
7+
- src/core/etl/tests/*
8+
- src/bridge/filesystem/azure/tests/*
9+
- src/bridge/filesystem/async-aws/tests/*
10+
- src/adapter/etl-adapter-xml/tests/*
11+
- src/adapter/etl-adapter-text/tests/*
12+
- src/adapter/etl-adapter-parquet/tests/*
13+
- src/adapter/etl-adapter-meilisearch/tests/*
14+
- src/adapter/etl-adapter-logger/tests/*
15+
- src/adapter/etl-adapter-json/tests/*
16+
- src/adapter/etl-adapter-http/tests/*
17+
- src/adapter/etl-adapter-csv/tests/*
618
- identifier: missingType.iterableValue
719
bootstrapFiles:
820
- tools/phpunit/vendor/autoload.php

rector.src.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
__DIR__ . '/examples',
1010
__DIR__ . '/src/core/etl/src',
1111
__DIR__ . '/src/cli/src',
12+
__DIR__ . '/src/lib/*/src',
1213
__DIR__ . '/src/adapter/*/src',
1314
__DIR__ . '/src/bridge/*/*/src',
1415
__DIR__ . '/src/tools/*/*/src',
1516
])
17+
->withSkipPath(__DIR__ . '/src/lib/parquet/src/Flow/Parquet/Thrift')
1618
->withCache(__DIR__ . '/var/rector/src')
1719
->withSets([
1820
LevelSetList::UP_TO_PHP_82

rector.tests.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
->withPaths([
6262
__DIR__ . '/src/core/etl/tests',
6363
__DIR__ . '/src/cli/tests',
64+
__DIR__ . '/src/lib/*/tests',
6465
__DIR__ . '/src/adapter/*/tests',
6566
__DIR__ . '/src/bridge/*/*/tests',
6667
__DIR__ . '/src/tools/*/*/tests',
@@ -158,6 +159,7 @@
158159
RemoveParentCallWithoutParentRector::class
159160
])
160161
->withCache(__DIR__ . '/var/rector/tests')
162+
->withSkipPath(__DIR__ . '/src/lib/parquet/src/Flow/Parquet/Thrift')
161163
->withImportNames(
162164
importNames: true,
163165
importDocBlockNames: true,

src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/EntryIdFactory/HashIdFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
final class HashIdFactory implements IdFactory
1414
{
1515
/**
16-
* @var string[]
16+
* @var array<string>
1717
*/
1818
private readonly array $entryNames;
1919

src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/GoogleSheetExtractor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ public function extract(FlowContext $context) : \Generator
4444
);
4545

4646
/**
47-
* @var array[] $values
47+
* @var array<array> $values
4848
*/
4949
$values = $response->getValues() ?? [];
5050

5151
if ($this->withHeader && [] !== $values) {
52-
/** @var string[] $headers */
52+
/** @var array<string> $headers */
5353
$headers = $values[0];
5454
unset($values[0]);
5555
$totalRows = 1;
@@ -108,7 +108,7 @@ function (array $rowData) use ($headers, $shouldPutInputIntoRows) {
108108
/** @var Sheets\ValueRange $response */
109109
$response = $this->service->spreadsheets_values->get($this->spreadsheetId, $cellsRange->toString(), $this->options);
110110
/**
111-
* @var array[] $values
111+
* @var array<array> $values
112112
*/
113113
$values = $response->getValues() ?? [];
114114
}

src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/RowsNormalizer/EntryNormalizer/PHPValueNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct(
3939
public function normalize(string $name, Type $type, mixed $value) : XMLNode|XMLAttribute
4040
{
4141
if (\str_starts_with($name, $this->attributePrefix)) {
42-
return new XMLAttribute(\substr($name, \strlen($this->attributePrefix)), $this->caster->to(type_string())->value($value));
42+
return new XMLAttribute(\substr($name, \strlen($this->attributePrefix)), (string) $this->caster->to(type_string())->value($value));
4343
}
4444

4545
if ($value === null) {

src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/XMLWriter/DOMDocumentWriter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ private function createDOMElement(\DOMDocument $dom, XMLNode $node) : \DOMElemen
3030
$element = $dom->createElement($node->name);
3131

3232
if ($node->hasValue()) {
33-
$element->appendChild($dom->createTextNode($node->value));
33+
$element->appendChild($dom->createTextNode((string) $node->value));
3434
}
3535

3636
foreach ($node->attributes as $attribute) {

src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function from_xml(
4444
* @param string $row_element_name - @deprecated use `withRowElementName()` method instead
4545
* @param string $attribute_prefix - @deprecated use `withAttributePrefix()` method instead
4646
* @param string $date_time_format - @deprecated use `withDateTimeFormat()` method instead
47-
* @param DOMDocumentWriter $xml_writer
47+
* @param XMLWriter $xml_writer
4848
*/
4949
#[DocumentationDSL(module: Module::XML, type: DSLType::LOADER)]
5050
function to_xml(

0 commit comments

Comments
 (0)