Skip to content

Commit 5aba21f

Browse files
authored
[Deps] Bump to PHPStan ^2.1.32 and fix test (#7622)
* [Deps] Bump to PHPStan ^2.1.32 and fix test * bump symplify/phpstan-extensions to ^12.0.2 * trigger CI * trigger CI * fix
1 parent 1a19a34 commit 5aba21f

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

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.1.31"
12+
"phpstan/phpstan": "^2.1.32"
1313
},
1414
"autoload": {
1515
"files": [

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"nikic/php-parser": "^5.6.2",
2424
"ondram/ci-detector": "^4.2",
2525
"phpstan/phpdoc-parser": "^2.3",
26-
"phpstan/phpstan": "^2.1.31",
26+
"phpstan/phpstan": "^2.1.32",
2727
"react/event-loop": "^1.5",
2828
"react/promise": "^3.3",
2929
"react/socket": "^1.16",
@@ -55,7 +55,7 @@
5555
"rector/swiss-knife": "^2.3",
5656
"rector/type-perfect": "^2.1",
5757
"shipmonk/composer-dependency-analyser": "^1.8",
58-
"symplify/phpstan-extensions": "^12.0",
58+
"symplify/phpstan-extensions": "^12.0.2",
5959
"symplify/phpstan-rules": "^14.8",
6060
"symplify/vendor-patches": "^11.5",
6161
"tomasvotruba/class-leak": "^2.0",

src/NodeAnalyzer/PropertyFetchAnalyzer.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use PhpParser\Node\Stmt\Trait_;
2121
use PHPStan\Reflection\ClassReflection;
2222
use PHPStan\Type\ObjectType;
23+
use PHPStan\Type\StaticType;
2324
use PHPStan\Type\ThisType;
2425
use Rector\Enum\ObjectReference;
2526
use Rector\NodeNameResolver\NodeNameResolver;
@@ -61,6 +62,13 @@ public function isLocalPropertyFetch(Node $node): bool
6162
? $this->nodeTypeResolver->getType($node->class)
6263
: $this->nodeTypeResolver->getType($node->var);
6364

65+
// patch clone usage
66+
// @see https://github.com/phpstan/phpstan-src/commit/020adb548011c098cdb2e061019346b0a838c6a4
67+
// @see https://github.com/rectorphp/rector-src/pull/7622
68+
if ($variableType instanceof StaticType && ! $variableType instanceof ThisType) {
69+
$variableType = $variableType->getStaticObjectType();
70+
}
71+
6472
if ($variableType instanceof ObjectType) {
6573
$classReflection = $this->reflectionResolver->resolveClassReflection($node);
6674
if ($classReflection instanceof ClassReflection) {

0 commit comments

Comments
 (0)