Skip to content

Commit 00139f5

Browse files
committed
[TASK] Use native types for all constructor parameters
Part of #811
1 parent c22d738 commit 00139f5

21 files changed

+21
-39
lines changed

src/CSSList/CSSList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ abstract class CSSList implements Renderable, Commentable
5757
/**
5858
* @param int<0, max> $lineNumber
5959
*/
60-
public function __construct($lineNumber = 0)
60+
public function __construct(int $lineNumber = 0)
6161
{
6262
$this->lineNumber = $lineNumber;
6363
}

src/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Parser
2222
* @param string $text the complete CSS as text (i.e., usually the contents of a CSS file)
2323
* @param int<0, max> $lineNumber the line number (starting from 1, not from 0)
2424
*/
25-
public function __construct($text, ?Settings $parserSettings = null, $lineNumber = 1)
25+
public function __construct(string $text, ?Settings $parserSettings = null, int $lineNumber = 1)
2626
{
2727
if ($parserSettings === null) {
2828
$parserSettings = Settings::create();

src/Parsing/Anchor.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ class Anchor
1919
*/
2020
private $parserState;
2121

22-
/**
23-
* @param int $position
24-
*/
25-
public function __construct($position, ParserState $parserState)
22+
public function __construct(int $position, ParserState $parserState)
2623
{
2724
$this->position = $position;
2825
$this->parserState = $parserState;

src/Parsing/ParserState.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class ParserState
5353
* @param string $text the complete CSS as text (i.e., usually the contents of a CSS file)
5454
* @param int<0, max> $lineNumber
5555
*/
56-
public function __construct($text, Settings $parserSettings, $lineNumber = 1)
56+
public function __construct(string $text, Settings $parserSettings, int $lineNumber = 1)
5757
{
5858
$this->parserSettings = $parserSettings;
5959
$this->text = $text;

src/Property/CSSNamespace.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ class CSSNamespace implements AtRule
3535
protected $comments = [];
3636

3737
/**
38-
* @param string $url
39-
* @param string|null $prefix
4038
* @param int<0, max> $lineNumber
4139
*/
42-
public function __construct($url, $prefix = null, $lineNumber = 0)
40+
public function __construct(string $url, ?string $prefix = null, int $lineNumber = 0)
4341
{
4442
$this->url = $url;
4543
$this->prefix = $prefix;

src/Property/Charset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Charset implements AtRule
4040
/**
4141
* @param int<0, max> $lineNumber
4242
*/
43-
public function __construct(CSSString $charset, $lineNumber = 0)
43+
public function __construct(CSSString $charset, int $lineNumber = 0)
4444
{
4545
$this->charset = $charset;
4646
$this->lineNumber = $lineNumber;

src/Property/Import.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@ class Import implements AtRule
3838
protected $comments = [];
3939

4040
/**
41-
* @param string $mediaQuery
4241
* @param int<0, max> $lineNumber
4342
*/
44-
public function __construct(URL $location, $mediaQuery, $lineNumber = 0)
43+
public function __construct(URL $location, string $mediaQuery, int $lineNumber = 0)
4544
{
4645
$this->location = $location;
4746
$this->mediaQuery = $mediaQuery;

src/Property/Selector.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,9 @@ public static function isValid($selector)
8585
}
8686

8787
/**
88-
* @param string $selector
8988
* @param bool $calculateSpecificity @deprecated since V8.8.0, will be removed in V9.0.0
9089
*/
91-
public function __construct($selector, $calculateSpecificity = false)
90+
public function __construct(string $selector, bool $calculateSpecificity = false)
9291
{
9392
$this->setSelector($selector);
9493
if ($calculateSpecificity) {

src/Rule/Rule.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,9 @@ class Rule implements Renderable, Commentable
6161
protected $comments = [];
6262

6363
/**
64-
* @param string $rule
6564
* @param int<0, max> $lineNumber
66-
* @param int $columnNumber
6765
*/
68-
public function __construct($rule, $lineNumber = 0, $columnNumber = 0)
66+
public function __construct(string $rule, int $lineNumber = 0, int $columnNumber = 0)
6967
{
7068
$this->rule = $rule;
7169
$this->lineNumber = $lineNumber;

src/RuleSet/AtRuleSet.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,9 @@ class AtRuleSet extends RuleSet implements AtRule
2626
private $arguments;
2727

2828
/**
29-
* @param string $type
30-
* @param string $arguments
3129
* @param int<0, max> $lineNumber
3230
*/
33-
public function __construct($type, $arguments = '', $lineNumber = 0)
31+
public function __construct(string $type, string $arguments = '', int $lineNumber = 0)
3432
{
3533
parent::__construct($lineNumber);
3634
$this->type = $type;

0 commit comments

Comments
 (0)