From 7d7b5da61670e80d7775729fd12a5457fd11bfa2 Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Tue, 11 Feb 2025 14:02:23 +0100 Subject: [PATCH] [TASK] Mark many parsing-related methods as `@internal` The only parsing method that is expected to be called from outside of this library is `Parser::parse()`. --- CHANGELOG.md | 1 + src/CSSList/CSSList.php | 2 ++ src/CSSList/Document.php | 2 ++ src/Parsing/ParserState.php | 4 ++++ src/Rule/Rule.php | 2 ++ src/RuleSet/DeclarationBlock.php | 2 ++ src/RuleSet/RuleSet.php | 2 ++ src/Value/CSSFunction.php | 2 ++ src/Value/CSSString.php | 2 ++ src/Value/CalcFunction.php | 2 ++ src/Value/Color.php | 2 ++ src/Value/LineName.php | 2 ++ src/Value/Size.php | 2 ++ src/Value/URL.php | 2 ++ src/Value/Value.php | 6 ++++++ 15 files changed, 35 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6182da3..ef216818 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ Please also have a look at our ### Changed +- Mark parsing-related methods of most CSS elements as `@internal` (#907) - Mark `OutputFormat::nextLevel()` as `@internal` (#901) - Only allow `string` for some `OutputFormat` properties (#885) - Make all non-private properties `@internal` (#886) diff --git a/src/CSSList/CSSList.php b/src/CSSList/CSSList.php index 35791089..9f1b9d0b 100644 --- a/src/CSSList/CSSList.php +++ b/src/CSSList/CSSList.php @@ -67,6 +67,8 @@ public function __construct($lineNumber = 0) /** * @throws UnexpectedTokenException * @throws SourceException + * + * @internal since V8.8.0 */ public static function parseList(ParserState $parserState, CSSList $list): void { diff --git a/src/CSSList/Document.php b/src/CSSList/Document.php index 51d87a4a..3177edfb 100644 --- a/src/CSSList/Document.php +++ b/src/CSSList/Document.php @@ -28,6 +28,8 @@ public function __construct($lineNumber = 0) /** * @throws SourceException + * + * @internal since V8.8.0 */ public static function parse(ParserState $parserState): Document { diff --git a/src/Parsing/ParserState.php b/src/Parsing/ParserState.php index cb28cdb0..651c6d64 100644 --- a/src/Parsing/ParserState.php +++ b/src/Parsing/ParserState.php @@ -136,6 +136,8 @@ public function setPosition($iPosition): void * @return string * * @throws UnexpectedTokenException + * + * @internal since V8.8.0 */ public function parseIdentifier($bIgnoreCase = true) { @@ -167,6 +169,8 @@ public function parseIdentifier($bIgnoreCase = true) * * @throws UnexpectedEOFException * @throws UnexpectedTokenException + * + * @internal since V8.8.0 */ public function parseCharacter($bIsForIdentifier) { diff --git a/src/Rule/Rule.php b/src/Rule/Rule.php index ee15059b..ad65ce89 100644 --- a/src/Rule/Rule.php +++ b/src/Rule/Rule.php @@ -79,6 +79,8 @@ public function __construct($sRule, $lineNumber = 0, $iColNo = 0) /** * @throws UnexpectedEOFException * @throws UnexpectedTokenException + * + * @internal since V8.8.0 */ public static function parse(ParserState $parserState): Rule { diff --git a/src/RuleSet/DeclarationBlock.php b/src/RuleSet/DeclarationBlock.php index 2ca5de28..446dbc28 100644 --- a/src/RuleSet/DeclarationBlock.php +++ b/src/RuleSet/DeclarationBlock.php @@ -45,6 +45,8 @@ public function __construct($lineNumber = 0) * * @throws UnexpectedTokenException * @throws UnexpectedEOFException + * + * @internal since V8.8.0 */ public static function parse(ParserState $parserState, $list = null) { diff --git a/src/RuleSet/RuleSet.php b/src/RuleSet/RuleSet.php index 66a9043c..ab0a5aca 100644 --- a/src/RuleSet/RuleSet.php +++ b/src/RuleSet/RuleSet.php @@ -56,6 +56,8 @@ public function __construct($lineNumber = 0) /** * @throws UnexpectedTokenException * @throws UnexpectedEOFException + * + * @internal since V8.8.0 */ public static function parseRuleSet(ParserState $parserState, RuleSet $ruleSet): void { diff --git a/src/Value/CSSFunction.php b/src/Value/CSSFunction.php index 110c9907..b2a7d7e3 100644 --- a/src/Value/CSSFunction.php +++ b/src/Value/CSSFunction.php @@ -44,6 +44,8 @@ public function __construct($sName, $aArguments, $sSeparator = ',', $lineNumber * @throws SourceException * @throws UnexpectedEOFException * @throws UnexpectedTokenException + * + * @internal since V8.8.0 */ public static function parse(ParserState $parserState, bool $bIgnoreCase = false): CSSFunction { diff --git a/src/Value/CSSString.php b/src/Value/CSSString.php index b0c92e4c..529e0f56 100644 --- a/src/Value/CSSString.php +++ b/src/Value/CSSString.php @@ -36,6 +36,8 @@ public function __construct($sString, $lineNumber = 0) * @throws SourceException * @throws UnexpectedEOFException * @throws UnexpectedTokenException + * + * @internal since V8.8.0 */ public static function parse(ParserState $parserState): CSSString { diff --git a/src/Value/CalcFunction.php b/src/Value/CalcFunction.php index 5d84a9a8..2cd9f663 100644 --- a/src/Value/CalcFunction.php +++ b/src/Value/CalcFunction.php @@ -23,6 +23,8 @@ class CalcFunction extends CSSFunction /** * @throws UnexpectedTokenException * @throws UnexpectedEOFException + * + * @internal since V8.8.0 */ public static function parse(ParserState $parserState, bool $bIgnoreCase = false): CSSFunction { diff --git a/src/Value/Color.php b/src/Value/Color.php index 16e7dbd8..76b81a04 100644 --- a/src/Value/Color.php +++ b/src/Value/Color.php @@ -27,6 +27,8 @@ public function __construct(array $colorValues, $lineNumber = 0) /** * @throws UnexpectedEOFException * @throws UnexpectedTokenException + * + * @internal since V8.8.0 */ public static function parse(ParserState $parserState, bool $ignoreCase = false): CSSFunction { diff --git a/src/Value/LineName.php b/src/Value/LineName.php index 6caa8617..d9874a81 100644 --- a/src/Value/LineName.php +++ b/src/Value/LineName.php @@ -23,6 +23,8 @@ public function __construct(array $aComponents = [], $lineNumber = 0) /** * @throws UnexpectedTokenException * @throws UnexpectedEOFException + * + * @internal since V8.8.0 */ public static function parse(ParserState $parserState): LineName { diff --git a/src/Value/Size.php b/src/Value/Size.php index ad38de1d..495c098a 100644 --- a/src/Value/Size.php +++ b/src/Value/Size.php @@ -86,6 +86,8 @@ public function __construct($fSize, $sUnit = null, $bIsColorComponent = false, $ * * @throws UnexpectedEOFException * @throws UnexpectedTokenException + * + * @internal since V8.8.0 */ public static function parse(ParserState $parserState, $bIsColorComponent = false): Size { diff --git a/src/Value/URL.php b/src/Value/URL.php index 1608d12d..5f80b3eb 100644 --- a/src/Value/URL.php +++ b/src/Value/URL.php @@ -33,6 +33,8 @@ public function __construct(CSSString $oURL, $lineNumber = 0) * @throws SourceException * @throws UnexpectedEOFException * @throws UnexpectedTokenException + * + * @internal since V8.8.0 */ public static function parse(ParserState $parserState): URL { diff --git a/src/Value/Value.php b/src/Value/Value.php index 4e27b668..4410551a 100644 --- a/src/Value/Value.php +++ b/src/Value/Value.php @@ -38,6 +38,8 @@ public function __construct($lineNumber = 0) * * @throws UnexpectedTokenException * @throws UnexpectedEOFException + * + * @internal since V8.8.0 */ public static function parseValue(ParserState $parserState, array $aListDelimiters = []) { @@ -114,6 +116,8 @@ public static function parseValue(ParserState $parserState, array $aListDelimite * * @throws UnexpectedEOFException * @throws UnexpectedTokenException + * + * @internal since V8.8.0 */ public static function parseIdentifierOrFunction(ParserState $parserState, $bIgnoreCase = false) { @@ -144,6 +148,8 @@ public static function parseIdentifierOrFunction(ParserState $parserState, $bIgn * @throws UnexpectedEOFException * @throws UnexpectedTokenException * @throws SourceException + * + * @internal since V8.8.0 */ public static function parsePrimitiveValue(ParserState $parserState) {