Skip to content

Commit 200c46c

Browse files
committed
Bump phpstan from 1.x to 2.x and remove unnecessary psalm annotations
1 parent 2047664 commit 200c46c

11 files changed

+6
-30
lines changed

composer.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
"friendsofphp/php-cs-fixer": "^3.53",
2424
"jetbrains/phpstorm-attributes": "^1.0",
2525
"phplrt/compiler": "^3.7",
26-
"phpstan/extension-installer": "^1.4",
27-
"phpstan/phpstan": "^1.11",
28-
"phpstan/phpstan-strict-rules": "^1.6",
26+
"phpstan/phpstan": "^2.0",
27+
"phpstan/phpstan-deprecation-rules": "^2.0",
28+
"phpstan/phpstan-strict-rules": "^2.0",
2929
"phpunit/phpunit": "^10.5|^11.0",
3030
"rector/rector": "^1.1"
3131
},
@@ -47,9 +47,6 @@
4747
"optimize-autoloader": true,
4848
"preferred-install": {
4949
"*": "dist"
50-
},
51-
"allow-plugins": {
52-
"phpstan/extension-installer": true
5350
}
5451
},
5552
"scripts": {

phpstan.neon

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
includes:
22
- phar://phpstan.phar/conf/bleedingEdge.neon
3+
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
4+
- vendor/phpstan/phpstan-strict-rules/rules.neon
35
parameters:
4-
level: 9
6+
level: max
57
strictRules:
68
allRules: true
79
fileExtensions:

src/Node/Literal/BoolLiteralNode.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
/**
88
* @template-extends LiteralNode<bool>
99
*
10-
* @psalm-consistent-constructor
11-
*
1210
* @phpstan-consistent-constructor
1311
*/
1412
class BoolLiteralNode extends LiteralNode implements ParsableLiteralNodeInterface

src/Node/Literal/FloatLiteralNode.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
/**
88
* @template-extends LiteralNode<float>
99
*
10-
* @psalm-consistent-constructor
11-
*
1210
* @phpstan-consistent-constructor
1311
*/
1412
class FloatLiteralNode extends LiteralNode implements ParsableLiteralNodeInterface

src/Node/Literal/IntLiteralNode.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
/**
88
* @template-extends LiteralNode<int>
99
*
10-
* @psalm-consistent-constructor
11-
*
1210
* @phpstan-consistent-constructor
1311
*/
1412
class IntLiteralNode extends LiteralNode implements ParsableLiteralNodeInterface

src/Node/Literal/StringLiteralNode.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
/**
88
* @template-extends LiteralNode<string>
99
*
10-
* @psalm-consistent-constructor
11-
*
1210
* @phpstan-consistent-constructor
1311
*/
1412
class StringLiteralNode extends LiteralNode implements ParsableLiteralNodeInterface
@@ -143,7 +141,6 @@ private static function renderHexadecimalSequences(string $body): string
143141
=> \chr((int) \hexdec((string) $matches[1]))
144142
;
145143

146-
/** @psalm-suppress InvalidArgument */
147144
return @\preg_replace_callback(self::HEX_SEQUENCE_PATTERN, $callee, $body) ?? $body;
148145
}
149146

@@ -184,7 +181,6 @@ private static function renderUtfSequences(string $body): string
184181
. \chr(0x80 | $code & 0x3F);
185182
};
186183

187-
/** @psalm-suppress InvalidArgument */
188184
return @\preg_replace_callback(self::UTF_SEQUENCE_PATTERN, $callee, $body) ?? $body;
189185
}
190186

src/Node/Literal/VariableLiteralNode.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
/**
88
* @template-extends LiteralNode<non-empty-string>
99
*
10-
* @psalm-consistent-constructor
11-
*
1210
* @phpstan-consistent-constructor
1311
*/
1412
class VariableLiteralNode extends LiteralNode implements ParsableLiteralNodeInterface

src/Parser.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ final class Parser implements ParserInterface
7676

7777
/**
7878
* @var int<0, max>
79-
*
80-
* @psalm-readonly-allow-private-mutation
8179
*/
8280
public int $lastProcessedTokenOffset = 0;
8381

src/ParserInterface.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ interface ParserInterface
1818
*
1919
* @throws ParserExceptionInterface in case of parsing exception occurs
2020
* @throws \Throwable in case of internal error occurs
21-
*
22-
* @psalm-suppress UndefinedAttributeClass : Optional (builtin) attribute usage
2321
*/
2422
public function parse(#[Language('PHP')] mixed $source): TypeStatement;
2523
}

src/Traverser.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ public static function new(iterable $visitors = []): self
5050
return new self($visitors);
5151
}
5252

53-
/**
54-
* @psalm-immutable
55-
*/
5653
public function with(VisitorInterface $visitor, bool $prepend = false): self
5754
{
5855
$self = clone $this;
@@ -101,7 +98,6 @@ private function applyToNode(Node $node): void
10198
$command = $visitor->enter($node);
10299

103100
if ($command === null) {
104-
/** @psalm-suppress MixedAssignment */
105101
foreach ($this->getProperties($node) as $property) {
106102
if ($property instanceof Node) {
107103
$this->applyToNode($property);

src/TraverserInterface.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99

1010
interface TraverserInterface
1111
{
12-
/**
13-
* @psalm-immutable
14-
*/
1512
public function with(VisitorInterface $visitor, bool $prepend = false): self;
1613

1714
/**

0 commit comments

Comments
 (0)