Skip to content

Commit

Permalink
[TASK] Allow assertInstanceOf calls in tests (#1377)
Browse files Browse the repository at this point in the history
We find those checks useful.
  • Loading branch information
oliverklee authored Dec 12, 2024
1 parent e6c33d9 commit b408be1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 84 deletions.
84 changes: 0 additions & 84 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -188,42 +188,12 @@ parameters:
count: 1
path: tests/Unit/Css/CssDocumentTest.php

-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Pelago\\\\Emogrifier\\\\CssInliner'' and Pelago\\Emogrifier\\CssInliner will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 1
path: tests/Unit/CssInlinerTest.php

-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Pelago\\\\Emogrifier\\\\HtmlProcessor\\\\AbstractHtmlProcessor'' and Pelago\\Emogrifier\\CssInliner will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 1
path: tests/Unit/CssInlinerTest.php

-
message: '#^Parameter \#1 \$string of function trim expects string, string\|false given\.$#'
identifier: argument.type
count: 1
path: tests/Unit/CssInlinerTest.php

-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''DOMDocument'' and DOMDocument will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 1
path: tests/Unit/HtmlProcessor/AbstractHtmlProcessorTest.php

-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Pelago\\\\Emogrifier\\\\HtmlProcessor\\\\AbstractHtmlProcessor'' and Pelago\\Emogrifier\\Tests\\Unit\\HtmlProcessor\\Fixtures\\TestingHtmlProcessor will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 2
path: tests/Unit/HtmlProcessor/AbstractHtmlProcessorTest.php

-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Pelago\\\\Emogrifier\\\\Tests\\\\Unit\\\\HtmlProcessor\\\\Fixtures\\\\TestingHtmlProcessor'' and Pelago\\Emogrifier\\Tests\\Unit\\HtmlProcessor\\Fixtures\\TestingHtmlProcessor will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 2
path: tests/Unit/HtmlProcessor/AbstractHtmlProcessorTest.php

-
message: '#^Parameter \#1 \$string of function strtolower expects string, string\|false given\.$#'
identifier: argument.type
Expand All @@ -236,66 +206,12 @@ parameters:
count: 1
path: tests/Unit/HtmlProcessor/AbstractHtmlProcessorTest.php

-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Pelago\\\\Emogrifier\\\\HtmlProcessor\\\\AbstractHtmlProcessor'' and Pelago\\Emogrifier\\HtmlProcessor\\CssToAttributeConverter will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 1
path: tests/Unit/HtmlProcessor/CssToAttributeConverterTest.php

-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Pelago\\\\Emogrifier\\\\HtmlProcessor\\\\CssToAttributeConverter'' and Pelago\\Emogrifier\\HtmlProcessor\\CssToAttributeConverter will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 2
path: tests/Unit/HtmlProcessor/CssToAttributeConverterTest.php

-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Pelago\\\\Emogrifier\\\\HtmlProcessor\\\\AbstractHtmlProcessor'' and Pelago\\Emogrifier\\HtmlProcessor\\HtmlNormalizer will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 1
path: tests/Unit/HtmlProcessor/HtmlNormalizerTest.php

-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Pelago\\\\Emogrifier\\\\HtmlProcessor\\\\HtmlNormalizer'' and Pelago\\Emogrifier\\HtmlProcessor\\HtmlNormalizer will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 2
path: tests/Unit/HtmlProcessor/HtmlNormalizerTest.php

-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Pelago\\\\Emogrifier\\\\HtmlProcessor\\\\AbstractHtmlProcessor'' and Pelago\\Emogrifier\\HtmlProcessor\\HtmlPruner will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 1
path: tests/Unit/HtmlProcessor/HtmlPrunerTest.php

-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Pelago\\\\Emogrifier\\\\HtmlProcessor\\\\HtmlPruner'' and Pelago\\Emogrifier\\HtmlProcessor\\HtmlPruner will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 2
path: tests/Unit/HtmlProcessor/HtmlPrunerTest.php

-
message: '#^Offset 1 might not exist on array\<int, array\<int, string\>\>\|null\.$#'
identifier: offsetAccess.notFound
count: 1
path: tests/Unit/HtmlProcessor/HtmlPrunerTest.php

-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''PHPUnit\\\\Framework\\\\Constraint\\\\Constraint'' and Pelago\\Emogrifier\\Tests\\Support\\Constraint\\IsEquivalentCss will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 1
path: tests/Unit/Support/Traits/AssertCssTest.php

-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''PHPUnit\\\\Framework\\\\Constraint\\\\Constraint'' and Pelago\\Emogrifier\\Tests\\Support\\Constraint\\StringContainsCss will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 1
path: tests/Unit/Support/Traits/AssertCssTest.php

-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''PHPUnit\\\\Framework\\\\Constraint\\\\Constraint'' and Pelago\\Emogrifier\\Tests\\Support\\Constraint\\StringContainsCssCount will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 1
path: tests/Unit/Support/Traits/AssertCssTest.php

-
message: '#^Parameter \#1 \$array of function array_filter expects array, array\<int, array\<int, string\>\>\|null given\.$#'
identifier: argument.type
Expand Down
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ parameters:
paths:
- src
- tests

ignoreErrors:
-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) .* will always evaluate to#'
path: 'tests/'

0 comments on commit b408be1

Please sign in to comment.