From ddb9a5b223e2e10735f2ce439bfcd44491489a8d Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Wed, 19 Mar 2025 22:29:43 +0100 Subject: [PATCH] [CLEANUP] And some more annotations for non-empty strings --- src/CSSList/AtRuleBlockList.php | 3 +++ src/CSSList/KeyFrame.php | 3 +++ src/Comment/Comment.php | 3 +++ src/OutputFormat.php | 6 +++++- src/Property/CSSNamespace.php | 3 +++ src/Property/Charset.php | 3 +++ src/Property/Import.php | 3 +++ src/RuleSet/AtRuleSet.php | 3 +++ src/RuleSet/DeclarationBlock.php | 2 ++ src/Value/CSSFunction.php | 3 +++ src/Value/CSSString.php | 3 +++ src/Value/Color.php | 3 +++ src/Value/LineName.php | 3 +++ src/Value/Size.php | 3 +++ src/Value/URL.php | 3 +++ 15 files changed, 46 insertions(+), 1 deletion(-) diff --git a/src/CSSList/AtRuleBlockList.php b/src/CSSList/AtRuleBlockList.php index 57c04ab8..8ee62ae4 100644 --- a/src/CSSList/AtRuleBlockList.php +++ b/src/CSSList/AtRuleBlockList.php @@ -46,6 +46,9 @@ public function atRuleArgs(): string return $this->arguments; } + /** + * @return non-empty-string + */ public function render(OutputFormat $outputFormat): string { $formatter = $outputFormat->getFormatter(); diff --git a/src/CSSList/KeyFrame.php b/src/CSSList/KeyFrame.php index f1f96cec..e632d088 100644 --- a/src/CSSList/KeyFrame.php +++ b/src/CSSList/KeyFrame.php @@ -51,6 +51,9 @@ public function getAnimationName(): string return $this->animationName; } + /** + * @return non-empty-string + */ public function render(OutputFormat $outputFormat): string { $formatter = $outputFormat->getFormatter(); diff --git a/src/Comment/Comment.php b/src/Comment/Comment.php index e96bd28e..cb19917c 100644 --- a/src/Comment/Comment.php +++ b/src/Comment/Comment.php @@ -50,6 +50,9 @@ public function setComment(string $commentText): void $this->commentText = $commentText; } + /** + * @return non-empty-string + */ public function render(OutputFormat $outputFormat): string { return '/*' . $this->commentText . '*/'; diff --git a/src/OutputFormat.php b/src/OutputFormat.php index a0e8b894..c7dc2133 100644 --- a/src/OutputFormat.php +++ b/src/OutputFormat.php @@ -9,7 +9,7 @@ final class OutputFormat /** * Value format: `"` means double-quote, `'` means single-quote * - * @var string + * @var non-empty-string */ private $stringQuotingType = '"'; @@ -181,6 +181,8 @@ final class OutputFormat private $indentationLevel = 0; /** + * @return non-empty-string + * * @internal */ public function getStringQuotingType(): string @@ -189,6 +191,8 @@ public function getStringQuotingType(): string } /** + * @param non-empty-string $quotingType + * * @return $this fluent interface */ public function setStringQuotingType(string $quotingType): self diff --git a/src/Property/CSSNamespace.php b/src/Property/CSSNamespace.php index 5b174861..d2274d18 100644 --- a/src/Property/CSSNamespace.php +++ b/src/Property/CSSNamespace.php @@ -55,6 +55,9 @@ public function getLineNo(): int return $this->lineNumber; } + /** + * @return non-empty-string + */ public function render(OutputFormat $outputFormat): string { return '@namespace ' . ($this->prefix === null ? '' : $this->prefix . ' ') diff --git a/src/Property/Charset.php b/src/Property/Charset.php index 14cb9321..6e81cd4e 100644 --- a/src/Property/Charset.php +++ b/src/Property/Charset.php @@ -68,6 +68,9 @@ public function getCharset(): string return $this->charset->getString(); } + /** + * @return non-empty-string + */ public function render(OutputFormat $outputFormat): string { return "{$outputFormat->getFormatter()->comments($this)}@charset {$this->charset->render($outputFormat)};"; diff --git a/src/Property/Import.php b/src/Property/Import.php index f889786b..e2c2f41f 100644 --- a/src/Property/Import.php +++ b/src/Property/Import.php @@ -65,6 +65,9 @@ public function getLocation(): URL return $this->location; } + /** + * @return non-empty-string + */ public function render(OutputFormat $outputFormat): string { return $outputFormat->getFormatter()->comments($this) . '@import ' . $this->location->render($outputFormat) diff --git a/src/RuleSet/AtRuleSet.php b/src/RuleSet/AtRuleSet.php index e2ae38a1..0fda9638 100644 --- a/src/RuleSet/AtRuleSet.php +++ b/src/RuleSet/AtRuleSet.php @@ -49,6 +49,9 @@ public function atRuleArgs(): string return $this->arguments; } + /** + * @return non-empty-string + */ public function render(OutputFormat $outputFormat): string { $formatter = $outputFormat->getFormatter(); diff --git a/src/RuleSet/DeclarationBlock.php b/src/RuleSet/DeclarationBlock.php index 938c05fe..9a1a0ca0 100644 --- a/src/RuleSet/DeclarationBlock.php +++ b/src/RuleSet/DeclarationBlock.php @@ -138,6 +138,8 @@ public function getSelectors(): array } /** + * @return non-empty-string + * * @throws OutputException */ public function render(OutputFormat $outputFormat): string diff --git a/src/Value/CSSFunction.php b/src/Value/CSSFunction.php index 306df768..8671fd3e 100644 --- a/src/Value/CSSFunction.php +++ b/src/Value/CSSFunction.php @@ -105,6 +105,9 @@ public function getArguments(): array return $this->components; } + /** + * @return non-empty-string + */ public function render(OutputFormat $outputFormat): string { $arguments = parent::render($outputFormat); diff --git a/src/Value/CSSString.php b/src/Value/CSSString.php index a71175ef..52b521e6 100644 --- a/src/Value/CSSString.php +++ b/src/Value/CSSString.php @@ -83,6 +83,9 @@ public function getString(): string return $this->string; } + /** + * @return non-empty-string + */ public function render(OutputFormat $outputFormat): string { $string = \addslashes($this->string); diff --git a/src/Value/Color.php b/src/Value/Color.php index 5f7829e8..4c59a0a3 100644 --- a/src/Value/Color.php +++ b/src/Value/Color.php @@ -224,6 +224,9 @@ public function getColorDescription(): string return $this->getName(); } + /** + * @return non-empty-string + */ public function render(OutputFormat $outputFormat): string { if ($this->shouldRenderAsHex($outputFormat)) { diff --git a/src/Value/LineName.php b/src/Value/LineName.php index 9afe6703..ed5ceeeb 100644 --- a/src/Value/LineName.php +++ b/src/Value/LineName.php @@ -49,6 +49,9 @@ public static function parse(ParserState $parserState): LineName return new LineName($names, $parserState->currentLine()); } + /** + * @return non-empty-string + */ public function render(OutputFormat $outputFormat): string { return '[' . parent::render(OutputFormat::createCompact()) . ']'; diff --git a/src/Value/Size.php b/src/Value/Size.php index e3cf6b89..a5e15497 100644 --- a/src/Value/Size.php +++ b/src/Value/Size.php @@ -195,6 +195,9 @@ public function isRelative(): bool return false; } + /** + * @return non-empty-string + */ public function render(OutputFormat $outputFormat): string { $locale = \localeconv(); diff --git a/src/Value/URL.php b/src/Value/URL.php index f1fe258b..4b4fb4c8 100644 --- a/src/Value/URL.php +++ b/src/Value/URL.php @@ -73,6 +73,9 @@ public function getURL(): CSSString return $this->url; } + /** + * @return non-empty-string + */ public function render(OutputFormat $outputFormat): string { return "url({$this->url->render($outputFormat)})";