Skip to content

Commit e985ea8

Browse files
committed
Adjust phpstan.neon ignoring rules for < PHP 8.4
1 parent 709d414 commit e985ea8

5 files changed

Lines changed: 69 additions & 11 deletions

File tree

phpstan.neon

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ parameters:
6060
excludePaths:
6161
- src/cli/src/Flow/CLI/Command/*
6262
- src/core/etl/src/Flow/ETL/Formatter/ASCII/ASCIITable.php
63-
- src/core/etl/src/Flow/ETL/Function/HTMLQuerySelectorAll.php
64-
- src/core/etl/src/Flow/ETL/Function/HTMLQuerySelector.php
65-
- src/core/etl/src/Flow/ETL/Row/Entry/HTMLEntry.php
6663
- src/core/etl/src/Flow/ETL/Sort/ExternalSort/RowsMinHeap.php
6764
- src/adapter/etl-adapter-avro/*
6865
- src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/ElasticsearchPHP/SearchResults.php
@@ -73,7 +70,6 @@ parameters:
7370
- src/lib/parquet/src/Flow/Parquet/ThriftModel/*
7471
- src/lib/parquet/src/Flow/Parquet/BinaryReader/*
7572
- src/lib/parquet/src/Flow/Parquet/Dremel/ColumnData/DefinitionConverter.php
76-
- src/lib/types/src/Flow/Types/Type/Logical/HTMLType.php
7773

7874
tmpDir: var/phpstan/cache
7975

@@ -89,6 +85,61 @@ parameters:
8985
-
9086
function: 'dj()'
9187

88+
ignoreErrors:
89+
-
90+
message: '#^Cloning object of an unknown class Dom\\HTMLDocument\.$#'
91+
identifier: class.notFound
92+
count: 1
93+
path: src/core/etl/src/Flow/ETL/Row/Entry/HTMLEntry.php
94+
95+
-
96+
message: '#^Method Flow\\ETL\\Row\\Entry\\HTMLEntry\:\:definition\(\) has invalid return type Dom\\HTMLDocument\.$#'
97+
identifier: class.notFound
98+
count: 1
99+
path: src/core/etl/src/Flow/ETL/Row/Entry/HTMLEntry.php
100+
101+
-
102+
message: '#^Method Flow\\ETL\\Row\\Entry\\HTMLEntry\:\:type\(\) has invalid return type Dom\\HTMLDocument\.$#'
103+
identifier: class.notFound
104+
count: 1
105+
path: src/core/etl/src/Flow/ETL/Row/Entry/HTMLEntry.php
106+
107+
-
108+
message: '#^Method Flow\\ETL\\Row\\Entry\\HTMLEntry\:\:value\(\) has invalid return type Dom\\HTMLDocument\.$#'
109+
identifier: class.notFound
110+
count: 1
111+
path: src/core/etl/src/Flow/ETL/Row/Entry/HTMLEntry.php
112+
113+
-
114+
message: '#^PHPDoc tag @implements has invalid type Dom\\HTMLDocument\.$#'
115+
identifier: class.notFound
116+
count: 1
117+
path: src/core/etl/src/Flow/ETL/Row/Entry/HTMLEntry.php
118+
119+
-
120+
message: '#^Property Flow\\ETL\\Row\\Entry\\HTMLEntry\:\:\$type has unknown class Dom\\HTMLDocument as its type\.$#'
121+
identifier: class.notFound
122+
count: 1
123+
path: src/core/etl/src/Flow/ETL/Row/Entry/HTMLEntry.php
124+
125+
-
126+
message: '#^Method Flow\\Types\\Type\\Logical\\HTMLType\:\:assert\(\) has invalid return type Dom\\HTMLDocument\.$#'
127+
identifier: class.notFound
128+
count: 1
129+
path: src/lib/types/src/Flow/Types/Type/Logical/HTMLType.php
130+
131+
-
132+
message: '#^Method Flow\\Types\\Type\\Logical\\HTMLType\:\:cast\(\) has invalid return type Dom\\HTMLDocument\.$#'
133+
identifier: class.notFound
134+
count: 1
135+
path: src/lib/types/src/Flow/Types/Type/Logical/HTMLType.php
136+
137+
-
138+
message: '#^PHPDoc tag @implements has invalid type Dom\\HTMLDocument\.$#'
139+
identifier: class.notFound
140+
count: 1
141+
path: src/lib/types/src/Flow/Types/Type/Logical/HTMLType.php
142+
92143
includes:
93144
- tools/phpstan/vendor/spaze/phpstan-disallowed-calls/extension.neon
94145

src/core/etl/src/Flow/ETL/Function/HTMLQuerySelector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function __construct(
1616
) {
1717
}
1818

19-
public function eval(Row $row) : ?Element
19+
public function eval(Row $row) : ?Element // @phpstan-ignore class.notFound
2020
{
2121
if (!\class_exists('\Dom\HTMLDocument')) {
2222
throw new RequiredPHPVersionException('\Dom\HTMLDocument', '8.4');

src/core/etl/src/Flow/ETL/Function/HTMLQuerySelectorAll.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,21 @@ public function __construct(
1919
/**
2020
* @return null|array<Element>
2121
*/
22-
public function eval(Row $row) : ?array
22+
public function eval(Row $row) : ?array // @phpstan-ignore class.notFound
2323
{
2424
if (!\class_exists('\Dom\HTMLDocument')) {
2525
throw new RequiredPHPVersionException('\Dom\HTMLDocument', '8.4');
2626
}
2727

28+
/* @phpstan-ignore-next-line class.notFound */
2829
$value = (new Parameter($this->value))->asInstanceOf($row, HTMLDocument::class);
2930
$selector = (new Parameter($this->selector))->asString($row);
3031

3132
if (null === $value || null === $selector) {
3233
return null;
3334
}
3435

36+
/* @phpstan-ignore-next-line class.notFound */
3537
$result = $value->querySelectorAll($selector);
3638

3739
if (0 === $result->count()) {
@@ -41,6 +43,7 @@ public function eval(Row $row) : ?array
4143
$nodes = [];
4244

4345
foreach ($result as $node) {
46+
/* @phpstan-ignore-next-line class.notFound */
4447
if (!$node instanceof Element) {
4548
continue;
4649
}

src/core/etl/src/Flow/ETL/Row/Entry/HTMLEntry.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ final class HTMLEntry implements Entry
2424
*/
2525
private readonly Type $type;
2626

27-
private ?HTMLDocument $value;
27+
private ?HTMLDocument $value; // @phpstan-ignore class.notFound
2828

2929
public function __construct(
3030
private readonly string $name,
31-
HTMLDocument|string|null $value,
31+
HTMLDocument|string|null $value, // @phpstan-ignore class.notFound
3232
?Metadata $metadata = null,
3333
) {
3434
if (\is_string($value)) {
35+
/* @phpstan-ignore-next-line class.notFound */
3536
$this->value = HTMLDocument::createFromString($value);
3637
} else {
3738
$this->value = $value;
@@ -75,6 +76,7 @@ public function isEqual(Entry $entry) : bool
7576
return false;
7677
}
7778

79+
/* @phpstan-ignore-next-line class.notFound */
7880
return $entry->value()?->saveHtml() === $this->value?->saveHtml();
7981
}
8082

@@ -99,6 +101,7 @@ public function toString() : string
99101
return '';
100102
}
101103

104+
/* @phpstan-ignore-next-line class.notFound */
102105
return $this->value->saveHtml();
103106
}
104107

@@ -107,7 +110,7 @@ public function type() : Type
107110
return $this->type;
108111
}
109112

110-
public function value() : ?HTMLDocument
113+
public function value() : ?HTMLDocument // @phpstan-ignore class.notFound
111114
{
112115
return $this->value;
113116
}

src/lib/types/src/Flow/Types/Type/Logical/HTMLType.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
$@isx
2424
REGXP;
2525

26-
public function assert(mixed $value) : HTMLDocument
26+
public function assert(mixed $value) : HTMLDocument // @phpstan-ignore class.notFound
2727
{
2828
if ($this->isValid($value)) {
2929
return $value;
@@ -32,14 +32,15 @@ public function assert(mixed $value) : HTMLDocument
3232
throw InvalidTypeException::value($value, $this);
3333
}
3434

35-
public function cast(mixed $value) : HTMLDocument
35+
public function cast(mixed $value) : HTMLDocument // @phpstan-ignore class.notFound
3636
{
3737
if (!$this->isValid($value)) {
3838
throw new CastingException($value, $this);
3939
}
4040

4141
/* @phpstan-ignore-next-line */
4242
if (\is_string($value)) {
43+
/* @phpstan-ignore-next-line class.notFound */
4344
return HTMLDocument::createFromString($value);
4445
}
4546

0 commit comments

Comments
 (0)