Skip to content

Commit 39a7c72

Browse files
committed
[BUGFIX] Ensure PHP 8.4 compatibility for nullable parameters
Ensure that parameters that have a `null` default value also have `null` as part of their type annotations. Also remove native type declarations for nullable parameters (as nullable parameters are not possible with some of the PHP versions we currently support). https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated Fixes #634
1 parent 895f7ad commit 39a7c72

22 files changed

+60
-24
lines changed

src/CSSList/AtRuleBlockList.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,11 @@ public function __toString()
5757
}
5858

5959
/**
60+
* @param OutputFormat $oOutputFormat
61+
*
6062
* @return string
6163
*/
62-
public function render(OutputFormat $oOutputFormat)
64+
public function render($oOutputFormat)
6365
{
6466
$sResult = $oOutputFormat->comments($this);
6567
$sResult .= $oOutputFormat->sBeforeAtRuleBlock;

src/CSSList/CSSList.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ public function append($oItem)
286286
* Splices the list of contents.
287287
*
288288
* @param int $iOffset
289-
* @param int $iLength
290-
* @param array<int, RuleSet|CSSList|Import|Charset> $mReplacement
289+
* @param int|null $iLength
290+
* @param array<int, RuleSet|CSSList|Import|Charset>|null $mReplacement
291291
*
292292
* @return void
293293
*/

src/CSSList/Document.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function getAllRuleSets()
7878
/**
7979
* Returns all `Value` objects found recursively in `Rule`s in the tree.
8080
*
81-
* @param CSSList|RuleSet|string $mElement
81+
* @param CSSList|RuleSet|string|null $mElement
8282
* the `CSSList` or `RuleSet` to start the search from (defaults to the whole document).
8383
* If a string is given, it is used as rule name filter.
8484
* @param bool $bSearchInFunctionArguments whether to also return Value objects used as Function arguments.
@@ -155,7 +155,7 @@ public function createShorthands()
155155
*
156156
* @return string
157157
*/
158-
public function render(OutputFormat $oOutputFormat = null)
158+
public function render($oOutputFormat = null)
159159
{
160160
if ($oOutputFormat === null) {
161161
$oOutputFormat = new OutputFormat();

src/CSSList/KeyFrame.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,11 @@ public function __toString()
6868
}
6969

7070
/**
71+
* @param OutputFormat $oOutputFormat
72+
*
7173
* @return string
7274
*/
73-
public function render(OutputFormat $oOutputFormat)
75+
public function render($oOutputFormat)
7476
{
7577
$sResult = $oOutputFormat->comments($this);
7678
$sResult .= "@{$this->vendorKeyFrame} {$this->animationName}{$oOutputFormat->spaceBeforeOpeningBrace()}{";

src/Comment/Comment.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ public function __toString()
6262
}
6363

6464
/**
65+
* @param OutputFormat $oOutputFormat
66+
*
6567
* @return string
6668
*/
67-
public function render(OutputFormat $oOutputFormat)
69+
public function render($oOutputFormat)
6870
{
6971
return '/*' . $this->sComment . '*/';
7072
}

src/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Parser
2121
* @param Settings|null $oParserSettings
2222
* @param int $iLineNo the line number (starting from 1, not from 0)
2323
*/
24-
public function __construct($sText, Settings $oParserSettings = null, $iLineNo = 1)
24+
public function __construct($sText, $oParserSettings = null, $iLineNo = 1)
2525
{
2626
if ($oParserSettings === null) {
2727
$oParserSettings = Settings::create();

src/Property/CSSNamespace.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ public function __toString()
6060
}
6161

6262
/**
63+
* @param OutputFormat $oOutputFormat
64+
*
6365
* @return string
6466
*/
65-
public function render(OutputFormat $oOutputFormat)
67+
public function render($oOutputFormat)
6668
{
6769
return '@namespace ' . ($this->sPrefix === null ? '' : $this->sPrefix . ' ')
6870
. $this->mUrl->render($oOutputFormat) . ';';

src/Property/Charset.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,11 @@ public function __toString()
7878
}
7979

8080
/**
81+
* @param OutputFormat $oOutputFormat
82+
*
8183
* @return string
8284
*/
83-
public function render(OutputFormat $oOutputFormat)
85+
public function render($oOutputFormat)
8486
{
8587
return "{$oOutputFormat->comments($this)}@charset {$this->oCharset->render($oOutputFormat)};";
8688
}

src/Property/Import.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,11 @@ public function __toString()
7979
}
8080

8181
/**
82+
* @param OutputFormat $oOutputFormat
83+
*
8284
* @return string
8385
*/
84-
public function render(OutputFormat $oOutputFormat)
86+
public function render($oOutputFormat)
8587
{
8688
return $oOutputFormat->comments($this) . "@import " . $this->oLocation->render($oOutputFormat)
8789
. ($this->sMediaQuery === null ? '' : ' ' . $this->sMediaQuery) . ';';

src/Renderable.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ interface Renderable
1010
public function __toString();
1111

1212
/**
13+
* @param OutputFormat $oOutputFormat
14+
*
1315
* @return string
1416
*/
15-
public function render(OutputFormat $oOutputFormat);
17+
public function render($oOutputFormat);
1618

1719
/**
1820
* @return int

0 commit comments

Comments
 (0)