Skip to content

Commit 33926fa

Browse files
Bump PHPStan to ^2.3.0 and fix compatible code (#8528)
Co-authored-by: GitHub Action <actions@github.com>
1 parent b4d80f4 commit 33926fa

6 files changed

Lines changed: 8 additions & 11 deletions

File tree

‎build/target-repository/composer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
],
1010
"require": {
1111
"php": "^7.4|^8.0",
12-
"phpstan/phpstan": "^2.2.14"
12+
"phpstan/phpstan": "^2.3.0"
1313
},
1414
"autoload": {
1515
"files": [

‎composer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"nikic/php-parser": "^5.9",
2525
"ondram/ci-detector": "^4.2",
2626
"phpstan/phpdoc-parser": "^2.3.3",
27-
"phpstan/phpstan": "^2.2.14",
27+
"phpstan/phpstan": "^2.3.0",
2828
"react/child-process": "^0.6.5",
2929
"react/event-loop": "^1.6",
3030
"react/socket": "^1.17",

‎phpstan.neon‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ parameters:
4848

4949
# see https://github.com/TomasVotruba/type-coverage
5050
type_coverage:
51-
declare: 99
5251
return_type: 99
5352
param_type: 99
5453
property_type: 99

‎rules/DeadCode/Rector/ClassMethod/RemoveUselessAssignFromPropertyPromotionRector.php‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,6 @@ public function refactor(Node $node): ?Node
121121
return null;
122122
}
123123

124-
// empty data? nothing to remove
125-
if ($removeStmtKeys === []) {
126-
return null;
127-
}
128-
129124
foreach ($removeStmtKeys as $removeStmtKey) {
130125
unset($node->stmts[$removeStmtKey]);
131126
}

‎rules/EarlyReturn/Rector/If_/ChangeIfElseValueAssignToEarlyReturnRector.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ public function refactor(Node $node): ?Node
108108
/** @var Assign $assign */
109109
$assign = $this->stmtsManipulator->getUnwrappedLastStmt($if->stmts);
110110

111-
$returnLastIf = new Return_($assign->expr);
112-
$this->mirrorComments($returnLastIf, $assign);
113-
$if->stmts[$lastIfStmtKey] = $returnLastIf;
111+
$return = new Return_($assign->expr);
112+
$this->mirrorComments($return, $assign);
113+
$if->stmts[$lastIfStmtKey] = $return;
114114

115115
/** @var Else_ $else */
116116
$else = $if->else;

‎src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,9 @@ private function processTrait(Trait_ $trait, MutatingScope $mutatingScope, calla
731731

732732
$this->privatesAccessor->setPrivateProperty($traitScope, self::CONTEXT, $traitContext);
733733

734+
// the cloned scope keeps node callback scope cached from former context, reset it to use the trait context
735+
$this->privatesAccessor->setPrivateProperty($traitScope, 'nodeCallbackScope', null);
736+
734737
$trait->setAttribute(AttributeKey::SCOPE, $traitScope);
735738
$this->nodeScopeResolverProcessNodes($trait->stmts, $traitScope, $nodeCallback);
736739
$this->decorateNodeAttrGroups($trait, $traitScope, $nodeCallback);

0 commit comments

Comments
 (0)