diff --git a/config/phpstan-baseline.neon b/config/phpstan-baseline.neon index 89348ca3..a9dcb0ba 100644 --- a/config/phpstan-baseline.neon +++ b/config/phpstan-baseline.neon @@ -43,8 +43,8 @@ parameters: path: ../src/CSSList/Document.php - - message: '#^Cannot call method render\(\) on string\.$#' - identifier: method.nonObject + message: '#^Method Sabberworm\\CSS\\Property\\CSSNamespace\:\:atRuleArgs\(\) should return array\ but returns list\\.$#' + identifier: return.type count: 1 path: ../src/Property/CSSNamespace.php diff --git a/src/Property/CSSNamespace.php b/src/Property/CSSNamespace.php index 78989d8a..155387ca 100644 --- a/src/Property/CSSNamespace.php +++ b/src/Property/CSSNamespace.php @@ -6,6 +6,8 @@ use Sabberworm\CSS\Comment\Comment; use Sabberworm\CSS\OutputFormat; +use Sabberworm\CSS\Value\CSSString; +use Sabberworm\CSS\Value\URL; /** * `CSSNamespace` represents an `@namespace` rule. @@ -13,7 +15,7 @@ class CSSNamespace implements AtRule { /** - * @var string + * @var CSSString|URL */ private $url; @@ -35,11 +37,10 @@ class CSSNamespace implements AtRule protected $comments = []; /** - * @param string $url - * @param string|null $prefix + * @param CSSString|URL $url * @param int<0, max> $lineNumber */ - public function __construct($url, $prefix = null, int $lineNumber = 0) + public function __construct($url, ?string $prefix = null, int $lineNumber = 0) { $this->url = $url; $this->prefix = $prefix; @@ -69,7 +70,7 @@ public function render(OutputFormat $outputFormat): string } /** - * @return string + * @return CSSString|URL */ public function getUrl() { @@ -85,7 +86,7 @@ public function getPrefix() } /** - * @param string $url + * @param CSSString|URL $url */ public function setUrl($url): void { diff --git a/src/Rule/Rule.php b/src/Rule/Rule.php index a20e864d..bbb7c713 100644 --- a/src/Rule/Rule.php +++ b/src/Rule/Rule.php @@ -56,11 +56,9 @@ class Rule implements Renderable, Commentable protected $comments = []; /** - * @param string $rule * @param int<0, max> $lineNumber - * @param int $columnNumber */ - public function __construct($rule, int $lineNumber = 0, $columnNumber = 0) + public function __construct(string $rule, int $lineNumber = 0, int $columnNumber = 0) { $this->rule = $rule; $this->lineNumber = $lineNumber; diff --git a/src/RuleSet/AtRuleSet.php b/src/RuleSet/AtRuleSet.php index a896246b..46562eb1 100644 --- a/src/RuleSet/AtRuleSet.php +++ b/src/RuleSet/AtRuleSet.php @@ -27,10 +27,9 @@ class AtRuleSet extends RuleSet implements AtRule /** * @param non-empty-string $type - * @param string $arguments * @param int<0, max> $lineNumber */ - public function __construct($type, $arguments = '', int $lineNumber = 0) + public function __construct(string $type, string $arguments = '', int $lineNumber = 0) { parent::__construct($lineNumber); $this->type = $type; diff --git a/src/Value/CSSFunction.php b/src/Value/CSSFunction.php index 3c10900e..aa5e66e7 100644 --- a/src/Value/CSSFunction.php +++ b/src/Value/CSSFunction.php @@ -24,12 +24,10 @@ class CSSFunction extends ValueList protected $name; /** - * @param string $name * @param RuleValueList|array $arguments - * @param string $separator * @param int<0, max> $lineNumber */ - public function __construct($name, $arguments, $separator = ',', int $lineNumber = 0) + public function __construct(string $name, $arguments, string $separator = ',', int $lineNumber = 0) { if ($arguments instanceof RuleValueList) { $separator = $arguments->getListSeparator(); diff --git a/src/Value/RuleValueList.php b/src/Value/RuleValueList.php index 9e505979..2cbc1fcc 100644 --- a/src/Value/RuleValueList.php +++ b/src/Value/RuleValueList.php @@ -12,10 +12,9 @@ class RuleValueList extends ValueList { /** - * @param string $separator * @param int<0, max> $lineNumber */ - public function __construct($separator = ',', int $lineNumber = 0) + public function __construct(string $separator = ',', int $lineNumber = 0) { parent::__construct([], $separator, $lineNumber); } diff --git a/src/Value/ValueList.php b/src/Value/ValueList.php index 8a50809d..aed4ec60 100644 --- a/src/Value/ValueList.php +++ b/src/Value/ValueList.php @@ -30,10 +30,9 @@ abstract class ValueList extends Value /** * @param array|Value|string $components - * @param string $separator * @param int<0, max> $lineNumber */ - public function __construct($components = [], $separator = ',', int $lineNumber = 0) + public function __construct($components = [], string $separator = ',', int $lineNumber = 0) { parent::__construct($lineNumber); if (!\is_array($components)) {