Skip to content

Commit 01c6f86

Browse files
committed
[TASK] Upgrade to PHPStan 2.x and Rector 2.x
Also add some more return type declarations as added by the new Rector version.
1 parent 428a2eb commit 01c6f86

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
"require-dev": {
3030
"php-parallel-lint/php-parallel-lint": "1.4.0",
3131
"phpstan/extension-installer": "1.4.3",
32-
"phpstan/phpstan": "1.12.9",
33-
"phpstan/phpstan-phpunit": "1.4.0",
32+
"phpstan/phpstan": "2.0.3",
33+
"phpstan/phpstan-phpunit": "2.0.1",
3434
"phpunit/phpunit": "8.5.40",
35-
"rector/rector": "1.2.10"
35+
"rector/rector": "2.0.0"
3636
},
3737
"suggest": {
3838
"ext-mbstring": "for parsing UTF-8 CSS"

config/phpstan-baseline.neon

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
parameters:
22
ignoreErrors:
33
-
4-
message: "#^Call to an undefined method Sabberworm\\\\CSS\\\\OutputFormat\\:\\:setIndentation\\(\\)\\.$#"
4+
message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:setIndentation\(\)\.$#'
5+
identifier: method.notFound
56
count: 2
67
path: ../src/OutputFormat.php
78

89
-
9-
message: "#^Class Sabberworm\\\\CSS\\\\Value\\\\Size constructor invoked with 5 parameters, 1\\-4 required\\.$#"
10+
message: '#^Class Sabberworm\\CSS\\Value\\Size constructor invoked with 5 parameters, 1\-4 required\.$#'
11+
identifier: arguments.count
1012
count: 2
1113
path: ../src/RuleSet/DeclarationBlock.php
1214

15+
-
16+
message: '#^@covers value \\Sabberworm\\CSS\\Value\\Value\:\:parseValue\(\) references an invalid method\.$#'
17+
identifier: phpunit.coversMethod
18+
count: 2
19+
path: ../tests/ParserTest.php
20+

src/CSSList/Document.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static function parse(ParserState $oParserState): Document
4242
*
4343
* @return array<int, DeclarationBlock>
4444
*/
45-
public function getAllDeclarationBlocks()
45+
public function getAllDeclarationBlocks(): array
4646
{
4747
/** @var array<int, DeclarationBlock> $aResult */
4848
$aResult = [];
@@ -55,7 +55,7 @@ public function getAllDeclarationBlocks()
5555
*
5656
* @return array<int, RuleSet>
5757
*/
58-
public function getAllRuleSets()
58+
public function getAllRuleSets(): array
5959
{
6060
/** @var array<int, RuleSet> $aResult */
6161
$aResult = [];
@@ -75,7 +75,7 @@ public function getAllRuleSets()
7575
*
7676
* @see RuleSet->getRules()
7777
*/
78-
public function getAllValues($mElement = null, $bSearchInFunctionArguments = false)
78+
public function getAllValues($mElement = null, $bSearchInFunctionArguments = false): array
7979
{
8080
$sSearchString = null;
8181
if ($mElement === null) {
@@ -103,7 +103,7 @@ public function getAllValues($mElement = null, $bSearchInFunctionArguments = fal
103103
* @return array<int, Selector>
104104
* @example `getSelectorsBySpecificity('>= 100')`
105105
*/
106-
public function getSelectorsBySpecificity($sSpecificitySearch = null)
106+
public function getSelectorsBySpecificity($sSpecificitySearch = null): array
107107
{
108108
/** @var array<int, Selector> $aResult */
109109
$aResult = [];

0 commit comments

Comments
 (0)