Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/target-repository/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
],
"require": {
"php": "^7.4|^8.0",
"phpstan/phpstan": "^2.1.31"
"phpstan/phpstan": "^2.1.32"
},
"autoload": {
"files": [
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"nikic/php-parser": "^5.6.2",
"ondram/ci-detector": "^4.2",
"phpstan/phpdoc-parser": "^2.3",
"phpstan/phpstan": "^2.1.31",
"phpstan/phpstan": "^2.1.32",
"react/event-loop": "^1.5",
"react/promise": "^3.3",
"react/socket": "^1.16",
Expand Down Expand Up @@ -55,7 +55,7 @@
"rector/swiss-knife": "^2.3",
"rector/type-perfect": "^2.1",
"shipmonk/composer-dependency-analyser": "^1.8",
"symplify/phpstan-extensions": "^12.0",
"symplify/phpstan-extensions": "^12.0.2",
"symplify/phpstan-rules": "^14.8",
"symplify/vendor-patches": "^11.5",
"tomasvotruba/class-leak": "^2.0",
Expand Down
8 changes: 8 additions & 0 deletions src/NodeAnalyzer/PropertyFetchAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use PhpParser\Node\Stmt\Trait_;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Type\ObjectType;
use PHPStan\Type\StaticType;
use PHPStan\Type\ThisType;
use Rector\Enum\ObjectReference;
use Rector\NodeNameResolver\NodeNameResolver;
Expand Down Expand Up @@ -61,6 +62,13 @@ public function isLocalPropertyFetch(Node $node): bool
? $this->nodeTypeResolver->getType($node->class)
: $this->nodeTypeResolver->getType($node->var);

// patch clone usage
// @see https://github.com/phpstan/phpstan-src/commit/020adb548011c098cdb2e061019346b0a838c6a4
// @see https://github.com/rectorphp/rector-src/pull/7622
if ($variableType instanceof StaticType && ! $variableType instanceof ThisType) {
$variableType = $variableType->getStaticObjectType();
}

if ($variableType instanceof ObjectType) {
$classReflection = $this->reflectionResolver->resolveClassReflection($node);
if ($classReflection instanceof ClassReflection) {
Expand Down