Skip to content

Commit 622b113

Browse files
authored
chore: narrow phpstan class.notFound suppression to config only and specific classes only (#1975)
1 parent 2bc9102 commit 622b113

File tree

5 files changed

+7
-20
lines changed

5 files changed

+7
-20
lines changed

phpstan.neon

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,8 @@ parameters:
8787

8888
ignoreErrors:
8989
-
90+
message: '#Dom\\(HTMLDocument|Element)#i'
9091
identifier: class.notFound
91-
path: src/core/etl/src/Flow/ETL/Row/Entry/HTMLEntry.php
92-
93-
-
94-
identifier: class.notFound
95-
path: src/core/etl/src/Flow/ETL/Function/HTMLQuerySelector.php
96-
97-
-
98-
identifier: class.notFound
99-
path: src/core/etl/src/Flow/ETL/Function/HTMLQuerySelectorAll.php
100-
101-
-
102-
identifier: class.notFound
103-
path: src/lib/types/src/Flow/Types/Type/Logical/HTMLType.php
10492

10593
includes:
10694
- tools/phpstan/vendor/spaze/phpstan-disallowed-calls/extension.neon

src/core/etl/src/Flow/ETL/DSL/functions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ function xml_element_entry(string $name, \DOMElement|string|null $value, ?Metada
632632
* @return Entry<?HTMLDocument>
633633
*/
634634
#[DocumentationDSL(module: Module::CORE, type: DSLType::ENTRY)]
635-
function html_entry(string $name, HTMLDocument|string|null $value, ?Metadata $metadata = null) : Entry // @phpstan-ignore class.notFound,class.notFound
635+
function html_entry(string $name, HTMLDocument|string|null $value, ?Metadata $metadata = null) : Entry
636636
{
637637
return new HTMLEntry($name, $value, $metadata);
638638
}
@@ -1973,7 +1973,7 @@ function json_schema(string $name, bool $nullable = false, ?Metadata $metadata =
19731973
* @return Definition<HTMLDocument>
19741974
*/
19751975
#[DocumentationDSL(module: Module::CORE, type: DSLType::SCHEMA)]
1976-
function html_schema(string $name, bool $nullable = false, ?Metadata $metadata = null) : Definition // @phpstan-ignore class.notFound
1976+
function html_schema(string $name, bool $nullable = false, ?Metadata $metadata = null) : Definition
19771977
{
19781978
return Definition::html($name, $nullable, $metadata);
19791979
}

src/core/etl/src/Flow/ETL/Schema/Definition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public static function fromArray(array $definition) : self
143143
/**
144144
* @return Definition<HTMLDocument>
145145
*/
146-
public static function html(string|Reference $entry, bool $nullable = false, ?Metadata $metadata = null) : self // @phpstan-ignore class.notFound
146+
public static function html(string|Reference $entry, bool $nullable = false, ?Metadata $metadata = null) : self
147147
{
148148
return new self($entry, type_html(), $nullable, $metadata);
149149
}

src/lib/types/src/Flow/Types/DSL/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ function type_literal(bool|float|int|string $value) : LiteralType
441441
* @return Type<HTMLDocument>
442442
*/
443443
#[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)]
444-
function type_html() : Type // @phpstan-ignore class.notFound
444+
function type_html() : Type
445445
{
446446
return new HTMLType();
447447
}

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

Lines changed: 2 additions & 3 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 // @phpstan-ignore class.notFound
26+
public function assert(mixed $value) : HTMLDocument
2727
{
2828
if ($this->isValid($value)) {
2929
return $value;
@@ -32,15 +32,14 @@ public function assert(mixed $value) : HTMLDocument // @phpstan-ignore class.not
3232
throw InvalidTypeException::value($value, $this);
3333
}
3434

35-
public function cast(mixed $value) : HTMLDocument // @phpstan-ignore class.notFound
35+
public function cast(mixed $value) : HTMLDocument
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 */
4443
return HTMLDocument::createFromString($value);
4544
}
4645

0 commit comments

Comments
 (0)