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.18"
"phpstan/phpstan": "^2.1.26"
},
"autoload": {
"files": [
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"ocramius/package-versions": "^2.10",
"ondram/ci-detector": "^4.2",
"phpstan/phpdoc-parser": "^2.2",
"phpstan/phpstan": "^2.1.18",
"phpstan/phpstan": "^2.1.26",
"react/event-loop": "^1.5",
"react/promise": "^3.2",
"react/socket": "^1.16",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function resolve(Class_ $class, ClassReflection $classReflection, array $
}

// 2. is part of class docblock or another magic, skip it
if ($classReflection->hasProperty($definedPropertyWithType->getName())) {
if ($classReflection->hasInstanceProperty($definedPropertyWithType->getName())) {
continue;
}

Expand Down
4 changes: 2 additions & 2 deletions rules/CodeQuality/Rector/Class_/ConvertStaticToSelfRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ private function shouldSkip(
// native members.
$hasMember = match (true) {
$node instanceof StaticPropertyFetch => $isFinal
? $classReflection->hasProperty($name)
? $classReflection->hasStaticProperty($name)
: $classReflection->hasNativeProperty($name),
$node instanceof StaticCall => $isFinal
? $classReflection->hasMethod($name)
Expand All @@ -157,7 +157,7 @@ private function shouldSkip(

$reflection = match (true) {
$node instanceof StaticPropertyFetch => $isFinal
? $classReflection->getProperty($name, $scope)
? $classReflection->getStaticProperty($name)
: $classReflection->getNativeProperty($name),
$node instanceof StaticCall => $isFinal
? $classReflection->getMethod($name, $scope)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function refactor(Node $node): ?Node
continue;
}

if (! $classReflection->hasProperty($propertyFetchName) || $classReflection->isBuiltin()) {
if (! $classReflection->hasInstanceProperty($propertyFetchName) || $classReflection->isBuiltin()) {
$newNodes[] = $this->replaceToPropertyExistsWithNullCheck(
$issetExpr->var,
$propertyFetchName,
Expand Down
2 changes: 1 addition & 1 deletion rules/Privatization/Guard/ParentPropertyLookupGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private function isFoundInMethodStmts(array $stmts, string $propertyName, string
private function isGuardedByParents(array $parentClassReflections, string $propertyName, string $className): bool
{
foreach ($parentClassReflections as $parentClassReflection) {
if ($parentClassReflection->hasProperty($propertyName)) {
if ($parentClassReflection->hasInstanceProperty($propertyName) || $parentClassReflection->hasStaticProperty($propertyName)) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/NodeManipulator/PropertyManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public function isUsedByTrait(ClassReflection $classReflection, string $property
public function hasTraitWithSamePropertyOrWritten(ClassReflection $classReflection, string $propertyName): bool
{
foreach ($classReflection->getTraits() as $traitUse) {
if ($traitUse->hasProperty($propertyName)) {
if ($traitUse->hasInstanceProperty($propertyName) || $traitUse->hasStaticProperty($propertyName)) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private function getVendorPropertyFetchType(PropertyFetch $propertyFetch): Type
}

$classReflection = $this->reflectionProvider->getClass($varType->getClassName());
if (! $classReflection->hasProperty($propertyName)) {
if (! $classReflection->hasInstanceProperty($propertyName)) {
return new MixedType();
}

Expand All @@ -91,7 +91,7 @@ private function getVendorPropertyFetchType(PropertyFetch $propertyFetch): Type
return new MixedType();
}

$extendedPropertyReflection = $classReflection->getProperty($propertyName, $propertyFetchScope);
$extendedPropertyReflection = $classReflection->getInstanceProperty($propertyName, $propertyFetchScope);

return $extendedPropertyReflection->getReadableType();
}
Expand Down
Loading