Skip to content

Commit a92817d

Browse files
committed
[TASK] Use native types for all constructor parameters
Also make one condition more strict (via Rector). Part of #811
1 parent 61971b8 commit a92817d

32 files changed

+33
-137
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Please also have a look at our
2323
### Changed
2424

2525
- Use more native type declarations and strict mode
26-
(#641, #772, #774, #778, #804)
26+
(#641, #772, #774, #778, #804, #818)
2727
- Mark parsing-internal classes and methods as `@internal` (#674)
2828
- Block installations on unsupported higher PHP versions (#691)
2929
- Improve performance of `Value::parseValue` with many delimiters by refactoring

src/CSSList/AtRuleBlockList.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,7 @@ class AtRuleBlockList extends CSSBlockList implements AtRule
2222
*/
2323
private $sArgs;
2424

25-
/**
26-
* @param string $type
27-
* @param string $arguments
28-
* @param int $lineNumber
29-
*/
30-
public function __construct($type, $arguments = '', $lineNumber = 0)
25+
public function __construct(string $type, string $arguments = '', int $lineNumber = 0)
3126
{
3227
parent::__construct($lineNumber);
3328
$this->type = $type;

src/CSSList/CSSBlockList.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@
2020
*/
2121
abstract class CSSBlockList extends CSSList
2222
{
23-
/**
24-
* @param int $lineNumber
25-
*/
26-
public function __construct($lineNumber = 0)
23+
public function __construct(int $lineNumber = 0)
2724
{
2825
parent::__construct($lineNumber);
2926
}

src/CSSList/CSSList.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ abstract class CSSList implements Renderable, Commentable
4848
*/
4949
protected $iLineNo;
5050

51-
/**
52-
* @param int $iLineNo
53-
*/
54-
public function __construct($iLineNo = 0)
51+
public function __construct(int $iLineNo = 0)
5552
{
5653
$this->comments = [];
5754
$this->aContents = [];

src/CSSList/Document.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818
*/
1919
class Document extends CSSBlockList
2020
{
21-
/**
22-
* @param int $iLineNo
23-
*/
24-
public function __construct($iLineNo = 0)
21+
public function __construct(int $iLineNo = 0)
2522
{
2623
parent::__construct($iLineNo);
2724
}

src/CSSList/KeyFrame.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ class KeyFrame extends CSSList implements AtRule
1919
*/
2020
private $animationName;
2121

22-
/**
23-
* @param int $iLineNo
24-
*/
25-
public function __construct($iLineNo = 0)
22+
public function __construct(int $iLineNo = 0)
2623
{
2724
parent::__construct($iLineNo);
2825
$this->vendorKeyFrame = null;

src/Comment/Comment.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@ class Comment implements Renderable
1919
*/
2020
protected $commentText;
2121

22-
/**
23-
* @param string $commentText
24-
* @param int $lineNumber
25-
*/
26-
public function __construct($commentText = '', $lineNumber = 0)
22+
public function __construct(string $commentText = '', int $lineNumber = 0)
2723
{
2824
$this->commentText = $commentText;
2925
$this->lineNumber = $lineNumber;

src/Parser.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@ class Parser
2020

2121
/**
2222
* @param string $sText the complete CSS as text (i.e., usually the contents of a CSS file)
23-
* @param Settings|null $oParserSettings
2423
* @param int $iLineNo the line number (starting from 1, not from 0)
2524
*/
26-
public function __construct($sText, ?Settings $oParserSettings = null, $iLineNo = 1)
25+
public function __construct(string $sText, ?Settings $oParserSettings = null, int $iLineNo = 1)
2726
{
2827
if ($oParserSettings === null) {
2928
$oParserSettings = 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 $oParserState;
2121

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

src/Parsing/OutputException.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@
99
*/
1010
final class OutputException extends SourceException
1111
{
12-
/**
13-
* @param string $sMessage
14-
* @param int $iLineNo
15-
*/
16-
public function __construct($sMessage, $iLineNo = 0)
12+
public function __construct(string $sMessage, int $iLineNo = 0)
1713
{
1814
parent::__construct($sMessage, $iLineNo);
1915
}

0 commit comments

Comments
 (0)