-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Upgrade to PHPStan 2.x and Rector 2.x (#1376)
We'll allow `assertInstanceOf` checks in the tests again in a later change.
- Loading branch information
1 parent
829cf37
commit e6c33d9
Showing
4 changed files
with
238 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,309 @@ | ||
parameters: | ||
ignoreErrors: | ||
- | ||
message: "#^Method Pelago\\\\Emogrifier\\\\CssInliner\\:\\:getAllNodesWithStyleAttribute\\(\\) return type with generic class DOMNodeList does not specify its types\\: TNode$#" | ||
message: '#^Method Pelago\\Emogrifier\\Caching\\SimpleStringCache\:\:set\(\) has BadMethodCallException in PHPDoc @throws tag but it''s not thrown\.$#' | ||
identifier: throws.unusedType | ||
count: 1 | ||
path: src/Caching/SimpleStringCache.php | ||
|
||
- | ||
message: '#^PHPDoc tag @var with type Sabberworm\\CSS\\Renderable is not subtype of type Sabberworm\\CSS\\CSSList\\CSSList\|Sabberworm\\CSS\\Property\\Charset\|Sabberworm\\CSS\\Property\\Import\|Sabberworm\\CSS\\RuleSet\\RuleSet\.$#' | ||
identifier: varTag.type | ||
count: 2 | ||
path: src/Css/CssDocument.php | ||
|
||
- | ||
message: '#^Method Pelago\\Emogrifier\\CssInliner\:\:getAllNodesWithStyleAttribute\(\) return type with generic class DOMNodeList does not specify its types\: TNode$#' | ||
identifier: missingType.generics | ||
count: 1 | ||
path: src/CssInliner.php | ||
|
||
- | ||
message: '#^Only numeric types are allowed in \*, int\|null given on the right side\.$#' | ||
identifier: mul.rightNonNumeric | ||
count: 1 | ||
path: src/CssInliner.php | ||
|
||
- | ||
message: "#^Parameter \\#1 \\$html of method Pelago\\\\Emogrifier\\\\HtmlProcessor\\\\AbstractHtmlProcessor\\:\\:removeSelfClosingTagsClosingTags\\(\\) expects string, string\\|false given\\.$#" | ||
message: '#^Parameter \#1 \$html of method Pelago\\Emogrifier\\HtmlProcessor\\AbstractHtmlProcessor\:\:removeSelfClosingTagsClosingTags\(\) expects string, string\|false given\.$#' | ||
identifier: argument.type | ||
count: 2 | ||
path: src/HtmlProcessor/AbstractHtmlProcessor.php | ||
|
||
- | ||
message: "#^Unsafe usage of new static\\(\\)\\.$#" | ||
message: '#^Unsafe usage of new static\(\)\.$#' | ||
identifier: new.static | ||
count: 2 | ||
path: src/HtmlProcessor/AbstractHtmlProcessor.php | ||
|
||
- | ||
message: "#^Method Pelago\\\\Emogrifier\\\\HtmlProcessor\\\\CssToAttributeConverter\\:\\:getAllNodesWithStyleAttribute\\(\\) return type with generic class DOMNodeList does not specify its types\\: TNode$#" | ||
message: '#^Method Pelago\\Emogrifier\\HtmlProcessor\\CssToAttributeConverter\:\:getAllNodesWithStyleAttribute\(\) return type with generic class DOMNodeList does not specify its types\: TNode$#' | ||
identifier: missingType.generics | ||
count: 1 | ||
path: src/HtmlProcessor/CssToAttributeConverter.php | ||
|
||
- | ||
message: "#^Method Pelago\\\\Emogrifier\\\\HtmlProcessor\\\\CssToAttributeConverter\\:\\:getAllNodesWithStyleAttribute\\(\\) should return DOMNodeList but returns DOMNodeList\\<DOMNode\\>\\|false\\.$#" | ||
message: '#^Method Pelago\\Emogrifier\\HtmlProcessor\\CssToAttributeConverter\:\:getAllNodesWithStyleAttribute\(\) should return DOMNodeList but returns DOMNodeList\<DOMNode\>\|false\.$#' | ||
identifier: return.type | ||
count: 1 | ||
path: src/HtmlProcessor/CssToAttributeConverter.php | ||
|
||
- | ||
message: "#^Argument of an invalid type DOMNodeList\\<DOMNode\\>\\|false supplied for foreach, only iterables are supported\\.$#" | ||
message: '#^Argument of an invalid type DOMNodeList\<DOMNode\>\|false supplied for foreach, only iterables are supported\.$#' | ||
identifier: foreach.nonIterable | ||
count: 1 | ||
path: src/HtmlProcessor/HtmlPruner.php | ||
|
||
- | ||
message: '#^Cannot access property \$length on DOMNodeList\<DOMNode\>\|false\.$#' | ||
identifier: property.nonObject | ||
count: 1 | ||
path: src/HtmlProcessor/HtmlPruner.php | ||
|
||
- | ||
message: "#^Cannot access property \\$length on DOMNodeList\\<DOMNode\\>\\|false\\.$#" | ||
message: '#^Method Pelago\\Emogrifier\\HtmlProcessor\\HtmlPruner\:\:removeClassAttributeFromElements\(\) has parameter \$elements with generic class DOMNodeList but does not specify its types\: TNode$#' | ||
identifier: missingType.generics | ||
count: 1 | ||
path: src/HtmlProcessor/HtmlPruner.php | ||
|
||
- | ||
message: "#^Method Pelago\\\\Emogrifier\\\\HtmlProcessor\\\\HtmlPruner\\:\\:removeClassAttributeFromElements\\(\\) has parameter \\$elements with generic class DOMNodeList but does not specify its types\\: TNode$#" | ||
message: '#^Method Pelago\\Emogrifier\\HtmlProcessor\\HtmlPruner\:\:removeClassesFromElements\(\) has parameter \$elements with generic class DOMNodeList but does not specify its types\: TNode$#' | ||
identifier: missingType.generics | ||
count: 1 | ||
path: src/HtmlProcessor/HtmlPruner.php | ||
|
||
- | ||
message: "#^Method Pelago\\\\Emogrifier\\\\HtmlProcessor\\\\HtmlPruner\\:\\:removeClassesFromElements\\(\\) has parameter \\$elements with generic class DOMNodeList but does not specify its types\\: TNode$#" | ||
message: '#^Offset 1 might not exist on array\<int, array\<int, string\>\>\|null\.$#' | ||
identifier: offsetAccess.notFound | ||
count: 1 | ||
path: src/HtmlProcessor/HtmlPruner.php | ||
|
||
- | ||
message: "#^Parameter \\#1 \\$elements of method Pelago\\\\Emogrifier\\\\HtmlProcessor\\\\HtmlPruner\\:\\:removeClassAttributeFromElements\\(\\) expects DOMNodeList, DOMNodeList\\<DOMNode\\>\\|false given\\.$#" | ||
message: '#^Parameter \#1 \$elements of method Pelago\\Emogrifier\\HtmlProcessor\\HtmlPruner\:\:removeClassAttributeFromElements\(\) expects DOMNodeList, DOMNodeList\<DOMNode\>\|false given\.$#' | ||
identifier: argument.type | ||
count: 1 | ||
path: src/HtmlProcessor/HtmlPruner.php | ||
|
||
- | ||
message: "#^Parameter \\#1 \\$elements of method Pelago\\\\Emogrifier\\\\HtmlProcessor\\\\HtmlPruner\\:\\:removeClassesFromElements\\(\\) expects DOMNodeList, DOMNodeList\\<DOMNode\\>\\|false given\\.$#" | ||
message: '#^Parameter \#1 \$elements of method Pelago\\Emogrifier\\HtmlProcessor\\HtmlPruner\:\:removeClassesFromElements\(\) expects DOMNodeList, DOMNodeList\<DOMNode\>\|false given\.$#' | ||
identifier: argument.type | ||
count: 1 | ||
path: src/HtmlProcessor/HtmlPruner.php | ||
|
||
- | ||
message: "#^Property object\\{media\\: string, ruleBlocks\\: array\\<int, object\\{selectorsAsKeys\\: array\\<string, \\(int\\|string\\)\\>, declarationsBlock\\: string\\}\\>\\}\\:\\:\\$ruleBlocks is not writable\\.$#" | ||
message: '#^Property object\{media\: string, ruleBlocks\: array\<int, object\{selectorsAsKeys\: array\<string, \(int\|string\)\>, declarationsBlock\: string\}\>\}\:\:\$ruleBlocks is not writable\.$#' | ||
identifier: assign.propertyReadOnly | ||
count: 1 | ||
path: src/Utilities/CssConcatenator.php | ||
|
||
- | ||
message: "#^Property object\\{selectorsAsKeys\\: array\\<string, \\(int\\|string\\)\\>, declarationsBlock\\: string\\}\\:\\:\\$declarationsBlock is not writable\\.$#" | ||
message: '#^Property object\{selectorsAsKeys\: array\<string, \(int\|string\)\>, declarationsBlock\: string\}\:\:\$declarationsBlock is not writable\.$#' | ||
identifier: assign.propertyReadOnly | ||
count: 1 | ||
path: src/Utilities/CssConcatenator.php | ||
|
||
- | ||
message: "#^Property object\\{selectorsAsKeys\\: array\\<string, \\(int\\|string\\)\\>, declarationsBlock\\: string\\}\\:\\:\\$selectorsAsKeys is not writable\\.$#" | ||
message: '#^Property object\{selectorsAsKeys\: array\<string, \(int\|string\)\>, declarationsBlock\: string\}\:\:\$selectorsAsKeys is not writable\.$#' | ||
identifier: assign.propertyReadOnly | ||
count: 1 | ||
path: src/Utilities/CssConcatenator.php | ||
|
||
- | ||
message: "#^Parameter \\#1 \\$array of function array_filter expects array, mixed given\\.$#" | ||
message: '#^Offset 1 might not exist on array\<int, string\>\|null\.$#' | ||
identifier: offsetAccess.notFound | ||
count: 1 | ||
path: src/Utilities/DeclarationBlockParser.php | ||
|
||
- | ||
message: '#^Offset 2 might not exist on array\<int, string\>\|null\.$#' | ||
identifier: offsetAccess.notFound | ||
count: 1 | ||
path: src/Utilities/DeclarationBlockParser.php | ||
|
||
- | ||
message: '#^Method Pelago\\Emogrifier\\Utilities\\Preg\:\:match\(\) never assigns null to &\$matches so it can be removed from the by\-ref type\.$#' | ||
identifier: parameterByRef.unusedType | ||
count: 1 | ||
path: src/Utilities/Preg.php | ||
|
||
- | ||
message: '#^Method Pelago\\Emogrifier\\Utilities\\Preg\:\:matchAll\(\) never assigns null to &\$matches so it can be removed from the by\-ref type\.$#' | ||
identifier: parameterByRef.unusedType | ||
count: 1 | ||
path: src/Utilities/Preg.php | ||
|
||
- | ||
message: '#^Method Pelago\\Emogrifier\\Utilities\\Preg\:\:replace\(\) never assigns null to &\$count so it can be removed from the by\-ref type\.$#' | ||
identifier: parameterByRef.unusedType | ||
count: 1 | ||
path: src/Utilities/Preg.php | ||
|
||
- | ||
message: '#^Method Pelago\\Emogrifier\\Utilities\\Preg\:\:replaceCallback\(\) never assigns null to &\$count so it can be removed from the by\-ref type\.$#' | ||
identifier: parameterByRef.unusedType | ||
count: 1 | ||
path: src/Utilities/Preg.php | ||
|
||
- | ||
message: '#^Parameter \#1 \$array of function array_flip expects array\<int\|string\>, array\<string, mixed\> given\.$#' | ||
identifier: argument.type | ||
count: 1 | ||
path: src/Utilities/Preg.php | ||
|
||
- | ||
message: "#^Parameter \\#2 \\$callback of function array_filter expects \\(callable\\(mixed\\)\\: bool\\)\\|null, Closure\\(string\\)\\: bool given\\.$#" | ||
message: '#^Parameter &\$matches by\-ref type of method Pelago\\Emogrifier\\Utilities\\Preg\:\:match\(\) expects array\<int, string\>\|null, array\<string\> given\.$#' | ||
identifier: parameterByRef.type | ||
count: 1 | ||
path: src/Utilities/Preg.php | ||
|
||
- | ||
message: "#^Parameter \\#1 \\$string of function trim expects string, string\\|false given\\.$#" | ||
message: '#^Parameter &\$matches by\-ref type of method Pelago\\Emogrifier\\Utilities\\Preg\:\:matchAll\(\) expects array\<int, array\<int, string\>\>\|null, array\<list\<string\>\> given\.$#' | ||
identifier: parameterByRef.type | ||
count: 1 | ||
path: src/Utilities/Preg.php | ||
|
||
- | ||
message: ''' | ||
#^@dataProvider provideInvalidAtCharsetRuleWhichCausesException | ||
Invalid related method not found\.$# | ||
''' | ||
identifier: phpunit.dataProviderMethod | ||
count: 1 | ||
path: tests/Unit/Css/CssDocumentTest.php | ||
|
||
- | ||
message: ''' | ||
#^@dataProvider provideInvalidNonConditionalAtRuleWhichCausesException | ||
Invalid related method not found\.$# | ||
''' | ||
identifier: phpunit.dataProviderMethod | ||
count: 1 | ||
path: tests/Unit/Css/CssDocumentTest.php | ||
|
||
- | ||
message: '#^Offset 0 might not exist on array\<int, string\>\|null\.$#' | ||
identifier: offsetAccess.notFound | ||
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: "#^Parameter \\#1 \\$string of function strtolower expects string, string\\|false given\\.$#" | ||
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: "#^Parameter \\#2 \\$actual of static method Pelago\\\\Emogrifier\\\\Tests\\\\Unit\\\\HtmlProcessor\\\\AbstractHtmlProcessorTest\\:\\:assertEqualsHtml\\(\\) expects string, string\\|false given\\.$#" | ||
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 | ||
count: 1 | ||
path: tests/Unit/HtmlProcessor/AbstractHtmlProcessorTest.php | ||
|
||
- | ||
message: '#^Parameter \#2 \$actual of static method Pelago\\Emogrifier\\Tests\\Unit\\HtmlProcessor\\AbstractHtmlProcessorTest\:\:assertEqualsHtml\(\) expects string, string\|false given\.$#' | ||
identifier: argument.type | ||
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 | ||
count: 1 | ||
path: tests/Unit/Utilities/PregTest.php | ||
|
||
- | ||
message: '#^Parameter \#2 \$haystack of static method PHPUnit\\Framework\\Assert\:\:assertCount\(\) expects Countable\|iterable, array\<int, array\<int, string\>\>\|null given\.$#' | ||
identifier: argument.type | ||
count: 1 | ||
path: tests/Unit/Utilities/PregTest.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters