diff --git a/config/phpstan-baseline.neon b/config/phpstan-baseline.neon index 17b94e84..c10c9c9d 100644 --- a/config/phpstan-baseline.neon +++ b/config/phpstan-baseline.neon @@ -395,16 +395,3 @@ parameters: identifier: method.notFound count: 1 path: ../src/Value/ValueList.php - - - - message: '#^Dynamic call to static method Sabberworm\\CSS\\Tests\\ParserTest\:\:parsedStructureForFile\(\)\.$#' - identifier: staticMethod.dynamicCall - count: 2 - path: ../tests/ParserTest.php - - - - message: '#^Loose comparison via "\=\=" is not allowed\.$#' - identifier: equal.notAllowed - count: 11 - path: ../tests/ParserTest.php - diff --git a/tests/ParserTest.php b/tests/ParserTest.php index 15d152a4..9ff7b283 100644 --- a/tests/ParserTest.php +++ b/tests/ParserTest.php @@ -21,6 +21,7 @@ use Sabberworm\CSS\RuleSet\DeclarationBlock; use Sabberworm\CSS\RuleSet\RuleSet; use Sabberworm\CSS\Settings; +use Sabberworm\CSS\Value\CalcFunction; use Sabberworm\CSS\Value\Color; use Sabberworm\CSS\Value\Size; use Sabberworm\CSS\Value\URL; @@ -193,37 +194,37 @@ public function unicodeParsing(): void } $contentRules = $ruleSet->getRules('content'); $firstContentRuleAsString = $contentRules[0]->getValue()->__toString(); - if ($selector == '.test-1') { + if ($selector === '.test-1') { self::assertSame('" "', $firstContentRuleAsString); } - if ($selector == '.test-2') { + if ($selector === '.test-2') { self::assertSame('"é"', $firstContentRuleAsString); } - if ($selector == '.test-3') { + if ($selector === '.test-3') { self::assertSame('" "', $firstContentRuleAsString); } - if ($selector == '.test-4') { + if ($selector === '.test-4') { self::assertSame('"𝄞"', $firstContentRuleAsString); } - if ($selector == '.test-5') { + if ($selector === '.test-5') { self::assertSame('"水"', $firstContentRuleAsString); } - if ($selector == '.test-6') { + if ($selector === '.test-6') { self::assertSame('"¥"', $firstContentRuleAsString); } - if ($selector == '.test-7') { + if ($selector === '.test-7') { self::assertSame('"\\A"', $firstContentRuleAsString); } - if ($selector == '.test-8') { + if ($selector === '.test-8') { self::assertSame('"\\"\\""', $firstContentRuleAsString); } - if ($selector == '.test-9') { + if ($selector === '.test-9') { self::assertSame('"\\"\\\'"', $firstContentRuleAsString); } - if ($selector == '.test-10') { + if ($selector === '.test-10') { self::assertSame('"\\\'\\\\"', $firstContentRuleAsString); } - if ($selector == '.test-11') { + if ($selector === '.test-11') { self::assertSame('"test"', $firstContentRuleAsString); } } @@ -1158,8 +1159,8 @@ public function flatCommentExtractingTwoComments(): void $rule2Comments = $divRules[1]->getComments(); self::assertCount(1, $rule1Comments); self::assertCount(1, $rule2Comments); - self::assertEquals('Find Me!', $rule1Comments[0]->getComment()); - self::assertEquals('Find Me Too!', $rule2Comments[0]->getComment()); + self::assertSame('Find Me!', $rule1Comments[0]->getComment()); + self::assertSame('Find Me Too!', $rule2Comments[0]->getComment()); } /** @@ -1211,7 +1212,7 @@ public function largeSizeValuesInFile(): void */ public function scientificNotationSizeValuesInFile(): void { - $document = $this->parsedStructureForFile( + $document = self::parsedStructureForFile( 'scientific-notation-numbers', Settings::create()->withMultibyteSupport(false) ); @@ -1233,12 +1234,12 @@ public function lonelyImport(): void public function escapedSpecialCaseTokens(): void { - $document = $this->parsedStructureForFile('escaped-tokens'); + $document = self::parsedStructureForFile('escaped-tokens'); $contents = $document->getContents(); $rules = $contents[0]->getRules(); $urlRule = $rules[0]; $calcRule = $rules[1]; - self::assertTrue(\is_a($urlRule->getValue(), '\\Sabberworm\\CSS\\Value\\URL')); - self::assertTrue(\is_a($calcRule->getValue(), '\\Sabberworm\\CSS\\Value\\CalcFunction')); + self::assertInstanceOf(URL::class, $urlRule->getValue()); + self::assertInstanceOf(CalcFunction::class, $calcRule->getValue()); } }