From d02e20764f0d672c888faee82b08f963d214d206 Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Sat, 19 Jun 2021 11:37:14 +0200 Subject: [PATCH] Simplify FQCN This makes the code more concise. --- src/CSSList/AtRuleBlockList.php | 5 +++-- src/CSSList/CSSList.php | 5 +++-- src/CSSList/Document.php | 10 ++++++---- src/CSSList/KeyFrame.php | 7 ++++--- src/Comment/Comment.php | 5 +++-- src/OutputFormatter.php | 2 +- src/Property/CSSNamespace.php | 8 +++++--- src/Property/Charset.php | 8 +++++--- src/Property/Import.php | 7 ++++--- src/Renderable.php | 2 +- src/Rule/Rule.php | 7 ++++--- src/RuleSet/AtRuleSet.php | 7 ++++--- src/RuleSet/DeclarationBlock.php | 7 ++++--- src/RuleSet/RuleSet.php | 7 ++++--- src/Value/CSSFunction.php | 8 +++++--- src/Value/CSSString.php | 7 ++++--- src/Value/CalcRuleValueList.php | 6 ++++-- src/Value/Color.php | 7 ++++--- src/Value/LineName.php | 9 +++++---- src/Value/Size.php | 7 ++++--- src/Value/URL.php | 7 ++++--- src/Value/Value.php | 2 +- src/Value/ValueList.php | 8 +++++--- tests/CSSList/AtRuleBlockListTest.php | 3 ++- tests/CSSList/DocumentTest.php | 3 ++- tests/OutputFormatTest.php | 3 ++- tests/ParserTest.php | 6 ++++-- tests/RuleSet/DeclarationBlockTest.php | 3 ++- tests/RuleSet/LenientParsingTest.php | 3 ++- 29 files changed, 101 insertions(+), 68 deletions(-) diff --git a/src/CSSList/AtRuleBlockList.php b/src/CSSList/AtRuleBlockList.php index be233f84..ecf3762d 100644 --- a/src/CSSList/AtRuleBlockList.php +++ b/src/CSSList/AtRuleBlockList.php @@ -2,6 +2,7 @@ namespace Sabberworm\CSS\CSSList; +use Sabberworm\CSS\OutputFormat; use Sabberworm\CSS\Property\AtRule; /** @@ -49,13 +50,13 @@ public function atRuleArgs() public function __toString() { - return $this->render(new \Sabberworm\CSS\OutputFormat()); + return $this->render(new OutputFormat()); } /** * @return string */ - public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) + public function render(OutputFormat $oOutputFormat) { $sArgs = $this->sArgs; if ($sArgs) { diff --git a/src/CSSList/CSSList.php b/src/CSSList/CSSList.php index 8ad7300a..0ec08886 100644 --- a/src/CSSList/CSSList.php +++ b/src/CSSList/CSSList.php @@ -3,6 +3,7 @@ namespace Sabberworm\CSS\CSSList; use Sabberworm\CSS\Comment\Commentable; +use Sabberworm\CSS\OutputFormat; use Sabberworm\CSS\Parsing\ParserState; use Sabberworm\CSS\Parsing\SourceException; use Sabberworm\CSS\Parsing\UnexpectedTokenException; @@ -353,13 +354,13 @@ public function removeDeclarationBlockBySelector($mSelector, $bRemoveAll = false public function __toString() { - return $this->render(new \Sabberworm\CSS\OutputFormat()); + return $this->render(new OutputFormat()); } /** * @return string */ - public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) + public function render(OutputFormat $oOutputFormat) { $sResult = ''; $bIsFirst = true; diff --git a/src/CSSList/Document.php b/src/CSSList/Document.php index ee30d9af..53490133 100644 --- a/src/CSSList/Document.php +++ b/src/CSSList/Document.php @@ -2,7 +2,9 @@ namespace Sabberworm\CSS\CSSList; +use Sabberworm\CSS\OutputFormat; use Sabberworm\CSS\Parsing\ParserState; +use Sabberworm\CSS\Parsing\SourceException; /** * The root CSSList of a parsed file. Contains all top-level css contents, mostly declaration blocks, @@ -25,7 +27,7 @@ public function __construct($iLineNo = 0) * * @return Document * - * @throws \Sabberworm\CSS\Parsing\SourceException + * @throws SourceException */ public static function parse(ParserState $oParserState) { @@ -127,14 +129,14 @@ public function createShorthands() /** * Override render() to make format argument optional * - * @param \Sabberworm\CSS\OutputFormat|null $oOutputFormat + * @param OutputFormat|null $oOutputFormat * * @return string */ - public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat = null) + public function render(OutputFormat $oOutputFormat = null) { if ($oOutputFormat === null) { - $oOutputFormat = new \Sabberworm\CSS\OutputFormat(); + $oOutputFormat = new OutputFormat(); } return parent::render($oOutputFormat); } diff --git a/src/CSSList/KeyFrame.php b/src/CSSList/KeyFrame.php index 3a81bf86..4550cf6b 100644 --- a/src/CSSList/KeyFrame.php +++ b/src/CSSList/KeyFrame.php @@ -2,6 +2,7 @@ namespace Sabberworm\CSS\CSSList; +use Sabberworm\CSS\OutputFormat; use Sabberworm\CSS\Property\AtRule; class KeyFrame extends CSSList implements AtRule @@ -45,15 +46,15 @@ public function getAnimationName() public function __toString() { - return $this->render(new \Sabberworm\CSS\OutputFormat()); + return $this->render(new OutputFormat()); } /** - * @param \Sabberworm\CSS\OutputFormat $oOutputFormat + * @param OutputFormat $oOutputFormat * * @return string */ - public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) + public function render(OutputFormat $oOutputFormat) { $sResult = "@{$this->vendorKeyFrame} {$this->animationName}{$oOutputFormat->spaceBeforeOpeningBrace()}{"; $sResult .= parent::render($oOutputFormat); diff --git a/src/Comment/Comment.php b/src/Comment/Comment.php index 56606f48..555130e2 100644 --- a/src/Comment/Comment.php +++ b/src/Comment/Comment.php @@ -2,6 +2,7 @@ namespace Sabberworm\CSS\Comment; +use Sabberworm\CSS\OutputFormat; use Sabberworm\CSS\Renderable; class Comment implements Renderable @@ -45,13 +46,13 @@ public function setComment($sComment) */ public function __toString() { - return $this->render(new \Sabberworm\CSS\OutputFormat()); + return $this->render(new OutputFormat()); } /** * @return string */ - public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) + public function render(OutputFormat $oOutputFormat) { return '/*' . $this->sComment . '*/'; } diff --git a/src/OutputFormatter.php b/src/OutputFormatter.php index 562d2a84..50a2fe22 100644 --- a/src/OutputFormatter.php +++ b/src/OutputFormatter.php @@ -123,7 +123,7 @@ public function implode($sSeparator, array $aValues, $bIncreaseLevel = false) } else { $sResult .= $sSeparator; } - if ($mValue instanceof \Sabberworm\CSS\Renderable) { + if ($mValue instanceof Renderable) { $sResult .= $mValue->render($oFormat); } else { $sResult .= $mValue; diff --git a/src/Property/CSSNamespace.php b/src/Property/CSSNamespace.php index 24ab27f7..30957970 100644 --- a/src/Property/CSSNamespace.php +++ b/src/Property/CSSNamespace.php @@ -2,6 +2,8 @@ namespace Sabberworm\CSS\Property; +use Sabberworm\CSS\OutputFormat; + /** * CSSNamespace represents an @namespace rule. */ @@ -33,15 +35,15 @@ public function getLineNo() public function __toString() { - return $this->render(new \Sabberworm\CSS\OutputFormat()); + return $this->render(new OutputFormat()); } /** - * @param \Sabberworm\CSS\OutputFormat $oOutputFormat + * @param OutputFormat $oOutputFormat * * @return string */ - public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) + public function render(OutputFormat $oOutputFormat) { return '@namespace ' . ($this->sPrefix === null ? '' : $this->sPrefix . ' ') . $this->mUrl->render($oOutputFormat) . ';'; diff --git a/src/Property/Charset.php b/src/Property/Charset.php index 45dfc671..ea6be495 100644 --- a/src/Property/Charset.php +++ b/src/Property/Charset.php @@ -2,6 +2,8 @@ namespace Sabberworm\CSS\Property; +use Sabberworm\CSS\OutputFormat; + /** * Class representing an @charset rule. * The following restrictions apply: @@ -57,15 +59,15 @@ public function getCharset() public function __toString() { - return $this->render(new \Sabberworm\CSS\OutputFormat()); + return $this->render(new OutputFormat()); } /** - * @param \Sabberworm\CSS\OutputFormat $oOutputFormat + * @param OutputFormat $oOutputFormat * * @return string */ - public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) + public function render(OutputFormat $oOutputFormat) { return "@charset {$this->sCharset->render($oOutputFormat)};"; } diff --git a/src/Property/Import.php b/src/Property/Import.php index 995d8c7c..72d1396b 100644 --- a/src/Property/Import.php +++ b/src/Property/Import.php @@ -2,6 +2,7 @@ namespace Sabberworm\CSS\Property; +use Sabberworm\CSS\OutputFormat; use Sabberworm\CSS\Value\URL; /** @@ -62,15 +63,15 @@ public function getLocation() public function __toString() { - return $this->render(new \Sabberworm\CSS\OutputFormat()); + return $this->render(new OutputFormat()); } /** - * @param \Sabberworm\CSS\OutputFormat $oOutputFormat + * @param OutputFormat $oOutputFormat * * @return string */ - public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) + public function render(OutputFormat $oOutputFormat) { return "@import " . $this->oLocation->render($oOutputFormat) . ($this->sMediaQuery === null ? '' : ' ' . $this->sMediaQuery) . ';'; diff --git a/src/Renderable.php b/src/Renderable.php index b2cc3467..e1ed4b20 100644 --- a/src/Renderable.php +++ b/src/Renderable.php @@ -11,7 +11,7 @@ public function __toString(); * * @return string */ - public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat); + public function render(OutputFormat $oOutputFormat); public function getLineNo(); } diff --git a/src/Rule/Rule.php b/src/Rule/Rule.php index 3d20c18b..c4f53b92 100644 --- a/src/Rule/Rule.php +++ b/src/Rule/Rule.php @@ -3,6 +3,7 @@ namespace Sabberworm\CSS\Rule; use Sabberworm\CSS\Comment\Commentable; +use Sabberworm\CSS\OutputFormat; use Sabberworm\CSS\Parsing\ParserState; use Sabberworm\CSS\Renderable; use Sabberworm\CSS\Value\RuleValueList; @@ -239,15 +240,15 @@ public function getIsImportant() public function __toString() { - return $this->render(new \Sabberworm\CSS\OutputFormat()); + return $this->render(new OutputFormat()); } /** - * @param \Sabberworm\CSS\OutputFormat $oOutputFormat + * @param OutputFormat $oOutputFormat * * @return string */ - public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) + public function render(OutputFormat $oOutputFormat) { $sResult = "{$this->sRule}:{$oOutputFormat->spaceAfterRuleName()}"; if ($this->mValue instanceof Value) { //Can also be a ValueList diff --git a/src/RuleSet/AtRuleSet.php b/src/RuleSet/AtRuleSet.php index 20c906b5..80370053 100644 --- a/src/RuleSet/AtRuleSet.php +++ b/src/RuleSet/AtRuleSet.php @@ -2,6 +2,7 @@ namespace Sabberworm\CSS\RuleSet; +use Sabberworm\CSS\OutputFormat; use Sabberworm\CSS\Property\AtRule; /** @@ -49,15 +50,15 @@ public function atRuleArgs() public function __toString() { - return $this->render(new \Sabberworm\CSS\OutputFormat()); + return $this->render(new OutputFormat()); } /** - * @param \Sabberworm\CSS\OutputFormat $oOutputFormat + * @param OutputFormat $oOutputFormat * * @return string */ - public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) + public function render(OutputFormat $oOutputFormat) { $sArgs = $this->sArgs; if ($sArgs) { diff --git a/src/RuleSet/DeclarationBlock.php b/src/RuleSet/DeclarationBlock.php index 0c1cbe0c..33af1050 100644 --- a/src/RuleSet/DeclarationBlock.php +++ b/src/RuleSet/DeclarationBlock.php @@ -3,6 +3,7 @@ namespace Sabberworm\CSS\RuleSet; use Sabberworm\CSS\CSSList\KeyFrame; +use Sabberworm\CSS\OutputFormat; use Sabberworm\CSS\Parsing\OutputException; use Sabberworm\CSS\Parsing\ParserState; use Sabberworm\CSS\Parsing\UnexpectedTokenException; @@ -728,17 +729,17 @@ public function createFontShorthand() public function __toString() { - return $this->render(new \Sabberworm\CSS\OutputFormat()); + return $this->render(new OutputFormat()); } /** - * @param \Sabberworm\CSS\OutputFormat $oOutputFormat + * @param OutputFormat $oOutputFormat * * @return string * * @throws OutputException */ - public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) + public function render(OutputFormat $oOutputFormat) { if (count($this->aSelectors) === 0) { // If all the selectors have been removed, this declaration block becomes invalid diff --git a/src/RuleSet/RuleSet.php b/src/RuleSet/RuleSet.php index 70b3e8da..82b05aa9 100644 --- a/src/RuleSet/RuleSet.php +++ b/src/RuleSet/RuleSet.php @@ -3,6 +3,7 @@ namespace Sabberworm\CSS\RuleSet; use Sabberworm\CSS\Comment\Commentable; +use Sabberworm\CSS\OutputFormat; use Sabberworm\CSS\Parsing\ParserState; use Sabberworm\CSS\Parsing\UnexpectedTokenException; use Sabberworm\CSS\Renderable; @@ -225,15 +226,15 @@ public function removeRule($mRule) public function __toString() { - return $this->render(new \Sabberworm\CSS\OutputFormat()); + return $this->render(new OutputFormat()); } /** - * @param \Sabberworm\CSS\OutputFormat $oOutputFormat + * @param OutputFormat $oOutputFormat * * @return string */ - public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) + public function render(OutputFormat $oOutputFormat) { $sResult = ''; $bIsFirst = true; diff --git a/src/Value/CSSFunction.php b/src/Value/CSSFunction.php index 041c555b..b9f625a7 100644 --- a/src/Value/CSSFunction.php +++ b/src/Value/CSSFunction.php @@ -2,6 +2,8 @@ namespace Sabberworm\CSS\Value; +use Sabberworm\CSS\OutputFormat; + class CSSFunction extends ValueList { @@ -38,15 +40,15 @@ public function getArguments() public function __toString() { - return $this->render(new \Sabberworm\CSS\OutputFormat()); + return $this->render(new OutputFormat()); } /** - * @param \Sabberworm\CSS\OutputFormat $oOutputFormat + * @param OutputFormat $oOutputFormat * * @return string */ - public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) + public function render(OutputFormat $oOutputFormat) { $aArguments = parent::render($oOutputFormat); return "{$this->sName}({$aArguments})"; diff --git a/src/Value/CSSString.php b/src/Value/CSSString.php index 6aedf2b0..926bf96c 100644 --- a/src/Value/CSSString.php +++ b/src/Value/CSSString.php @@ -2,6 +2,7 @@ namespace Sabberworm\CSS\Value; +use Sabberworm\CSS\OutputFormat; use Sabberworm\CSS\Parsing\ParserState; use Sabberworm\CSS\Parsing\SourceException; @@ -63,15 +64,15 @@ public function getString() public function __toString() { - return $this->render(new \Sabberworm\CSS\OutputFormat()); + return $this->render(new OutputFormat()); } /** - * @param \Sabberworm\CSS\OutputFormat $oOutputFormat + * @param OutputFormat $oOutputFormat * * @return string */ - public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) + public function render(OutputFormat $oOutputFormat) { $sString = addslashes($this->sString); $sString = str_replace("\n", '\A', $sString); diff --git a/src/Value/CalcRuleValueList.php b/src/Value/CalcRuleValueList.php index 79e0cbcf..d44f0acb 100644 --- a/src/Value/CalcRuleValueList.php +++ b/src/Value/CalcRuleValueList.php @@ -2,6 +2,8 @@ namespace Sabberworm\CSS\Value; +use Sabberworm\CSS\OutputFormat; + class CalcRuleValueList extends RuleValueList { public function __construct($iLineNo = 0) @@ -10,11 +12,11 @@ public function __construct($iLineNo = 0) } /** - * @param \Sabberworm\CSS\OutputFormat $oOutputFormat + * @param OutputFormat $oOutputFormat * * @return string */ - public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) + public function render(OutputFormat $oOutputFormat) { return $oOutputFormat->implode(' ', $this->aComponents); } diff --git a/src/Value/Color.php b/src/Value/Color.php index f93983c3..d7450e32 100644 --- a/src/Value/Color.php +++ b/src/Value/Color.php @@ -2,6 +2,7 @@ namespace Sabberworm\CSS\Value; +use Sabberworm\CSS\OutputFormat; use Sabberworm\CSS\Parsing\ParserState; class Color extends CSSFunction @@ -107,15 +108,15 @@ public function getColorDescription() public function __toString() { - return $this->render(new \Sabberworm\CSS\OutputFormat()); + return $this->render(new OutputFormat()); } /** - * @param \Sabberworm\CSS\OutputFormat $oOutputFormat + * @param OutputFormat $oOutputFormat * * @return string */ - public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) + public function render(OutputFormat $oOutputFormat) { // Shorthand RGB color values if ($oOutputFormat->getRGBHashNotation() && implode('', array_keys($this->aComponents)) === 'rgb') { diff --git a/src/Value/LineName.php b/src/Value/LineName.php index 8bd991b9..1fdd9507 100644 --- a/src/Value/LineName.php +++ b/src/Value/LineName.php @@ -2,6 +2,7 @@ namespace Sabberworm\CSS\Value; +use Sabberworm\CSS\OutputFormat; use Sabberworm\CSS\Parsing\ParserState; use Sabberworm\CSS\Parsing\UnexpectedTokenException; @@ -37,16 +38,16 @@ public static function parse(ParserState $oParserState) public function __toString() { - return $this->render(new \Sabberworm\CSS\OutputFormat()); + return $this->render(new OutputFormat()); } /** - * @param \Sabberworm\CSS\OutputFormat $oOutputFormat + * @param OutputFormat $oOutputFormat * * @return string */ - public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) + public function render(OutputFormat $oOutputFormat) { - return '[' . parent::render(\Sabberworm\CSS\OutputFormat::createCompact()) . ']'; + return '[' . parent::render(OutputFormat::createCompact()) . ']'; } } diff --git a/src/Value/Size.php b/src/Value/Size.php index 0afe2a71..c11f7ded 100644 --- a/src/Value/Size.php +++ b/src/Value/Size.php @@ -2,6 +2,7 @@ namespace Sabberworm\CSS\Value; +use Sabberworm\CSS\OutputFormat; use Sabberworm\CSS\Parsing\ParserState; class Size extends PrimitiveValue @@ -143,15 +144,15 @@ public function isRelative() public function __toString() { - return $this->render(new \Sabberworm\CSS\OutputFormat()); + return $this->render(new OutputFormat()); } /** - * @param \Sabberworm\CSS\OutputFormat $oOutputFormat + * @param OutputFormat $oOutputFormat * * @return string */ - public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) + public function render(OutputFormat $oOutputFormat) { $l = localeconv(); $sPoint = preg_quote($l['decimal_point'], '/'); diff --git a/src/Value/URL.php b/src/Value/URL.php index aed5e274..db92888d 100644 --- a/src/Value/URL.php +++ b/src/Value/URL.php @@ -2,6 +2,7 @@ namespace Sabberworm\CSS\Value; +use Sabberworm\CSS\OutputFormat; use Sabberworm\CSS\Parsing\ParserState; class URL extends PrimitiveValue @@ -44,15 +45,15 @@ public function getURL() public function __toString() { - return $this->render(new \Sabberworm\CSS\OutputFormat()); + return $this->render(new OutputFormat()); } /** - * @param \Sabberworm\CSS\OutputFormat $oOutputFormat + * @param OutputFormat $oOutputFormat * * @return string */ - public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) + public function render(OutputFormat $oOutputFormat) { return "url({$this->oURL->render($oOutputFormat)})"; } diff --git a/src/Value/Value.php b/src/Value/Value.php index 80a6893a..4ac6141b 100644 --- a/src/Value/Value.php +++ b/src/Value/Value.php @@ -154,5 +154,5 @@ public function getLineNo() //Methods are commented out because re-declaring them here is a fatal error in PHP < 5.3.9 //public abstract function __toString(); - //public abstract function render(\Sabberworm\CSS\OutputFormat $oOutputFormat); + //public abstract function render(OutputFormat $oOutputFormat); } diff --git a/src/Value/ValueList.php b/src/Value/ValueList.php index 124b3a68..25803881 100644 --- a/src/Value/ValueList.php +++ b/src/Value/ValueList.php @@ -2,6 +2,8 @@ namespace Sabberworm\CSS\Value; +use Sabberworm\CSS\OutputFormat; + abstract class ValueList extends Value { @@ -49,15 +51,15 @@ public function setListSeparator($sSeparator) public function __toString() { - return $this->render(new \Sabberworm\CSS\OutputFormat()); + return $this->render(new OutputFormat()); } /** - * @param \Sabberworm\CSS\OutputFormat $oOutputFormat + * @param OutputFormat $oOutputFormat * * @return string */ - public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) + public function render(OutputFormat $oOutputFormat) { return $oOutputFormat->implode( $oOutputFormat->spaceBeforeListArgumentSeparator($this->sSeparator) . $this->sSeparator diff --git a/tests/CSSList/AtRuleBlockListTest.php b/tests/CSSList/AtRuleBlockListTest.php index 673e4c61..baad6769 100644 --- a/tests/CSSList/AtRuleBlockListTest.php +++ b/tests/CSSList/AtRuleBlockListTest.php @@ -2,9 +2,10 @@ namespace Sabberworm\CSS\Tests\CSSList; +use PHPUnit\Framework\TestCase; use Sabberworm\CSS\Parser; -class AtRuleBlockListTest extends \PHPUnit\Framework\TestCase +class AtRuleBlockListTest extends TestCase { public function testMediaQueries() diff --git a/tests/CSSList/DocumentTest.php b/tests/CSSList/DocumentTest.php index 425aa1f1..e77213f6 100644 --- a/tests/CSSList/DocumentTest.php +++ b/tests/CSSList/DocumentTest.php @@ -2,9 +2,10 @@ namespace Sabberworm\CSS\Tests\CSSList; +use PHPUnit\Framework\TestCase; use Sabberworm\CSS\Parser; -class DocumentTest extends \PHPUnit\Framework\TestCase +class DocumentTest extends TestCase { public function testOverrideContents() diff --git a/tests/OutputFormatTest.php b/tests/OutputFormatTest.php index 13ccd704..b447235f 100644 --- a/tests/OutputFormatTest.php +++ b/tests/OutputFormatTest.php @@ -2,10 +2,11 @@ namespace Sabberworm\CSS\Tests; +use PHPUnit\Framework\TestCase; use Sabberworm\CSS\OutputFormat; use Sabberworm\CSS\Parser; -class OutputFormatTest extends \PHPUnit\Framework\TestCase +class OutputFormatTest extends TestCase { /** * @var string diff --git a/tests/ParserTest.php b/tests/ParserTest.php index bf40f410..9e0ab67b 100644 --- a/tests/ParserTest.php +++ b/tests/ParserTest.php @@ -2,6 +2,7 @@ namespace Sabberworm\CSS\Tests; +use PHPUnit\Framework\TestCase; use Sabberworm\CSS\CSSList\Document; use Sabberworm\CSS\CSSList\KeyFrame; use Sabberworm\CSS\Parser; @@ -14,10 +15,11 @@ use Sabberworm\CSS\RuleSet\AtRuleSet; use Sabberworm\CSS\RuleSet\DeclarationBlock; use Sabberworm\CSS\Settings; +use Sabberworm\CSS\Value\Color; use Sabberworm\CSS\Value\Size; use Sabberworm\CSS\Value\URL; -class ParserTest extends \PHPUnit\Framework\TestCase +class ParserTest extends TestCase { public function testFiles() @@ -347,7 +349,7 @@ public function testRuleGetters() $this->assertSame('background-color', $aHeaderRules[1]->getRule()); $aHeaderRules = $oHeaderBlock->getRulesAssoc('background-'); $this->assertCount(1, $aHeaderRules); - $this->assertTrue($aHeaderRules['background-color']->getValue() instanceof \Sabberworm\CSS\Value\Color); + $this->assertTrue($aHeaderRules['background-color']->getValue() instanceof Color); $this->assertSame('rgba', $aHeaderRules['background-color']->getValue()->getColorDescription()); $oHeaderBlock->removeRule($aHeaderRules['background-color']); $aHeaderRules = $oHeaderBlock->getRules('background-'); diff --git a/tests/RuleSet/DeclarationBlockTest.php b/tests/RuleSet/DeclarationBlockTest.php index 32a0af32..9987797d 100644 --- a/tests/RuleSet/DeclarationBlockTest.php +++ b/tests/RuleSet/DeclarationBlockTest.php @@ -2,11 +2,12 @@ namespace Sabberworm\CSS\Tests\RuleSet; +use PHPUnit\Framework\TestCase; use Sabberworm\CSS\Parser; use Sabberworm\CSS\Rule\Rule; use Sabberworm\CSS\Value\Size; -class DeclarationBlockTest extends \PHPUnit\Framework\TestCase +class DeclarationBlockTest extends TestCase { /** diff --git a/tests/RuleSet/LenientParsingTest.php b/tests/RuleSet/LenientParsingTest.php index 01f204f8..6c8d8de0 100644 --- a/tests/RuleSet/LenientParsingTest.php +++ b/tests/RuleSet/LenientParsingTest.php @@ -2,10 +2,11 @@ namespace Sabberworm\CSS\Tests\RuleSet; +use PHPUnit\Framework\TestCase; use Sabberworm\CSS\Parser; use Sabberworm\CSS\Settings; -class LenientParsingTest extends \PHPUnit\Framework\TestCase +class LenientParsingTest extends TestCase { /**