Skip to content

Commit 76410fc

Browse files
authored
Merge pull request #26 from hostep/fix-magic-methods-called-directly-on-dataobject-take-two
Fix Magic Method call on a DataObject instance
2 parents ebf0649 + d02c471 commit 76410fc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/bitExpert/PHPStan/Magento/Reflection/Framework/DataObjectMagicMethodReflectionExtension.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ class DataObjectMagicMethodReflectionExtension extends AbstractMagicMethodReflec
2626
public function hasMethod(ClassReflection $classReflection, string $methodName): bool
2727
{
2828
$parentClasses = $classReflection->getParentClassesNames();
29-
return in_array(DataObject::class, $parentClasses, true) &&
29+
30+
$isDataObject = $classReflection->getName() === DataObject::class ||
31+
in_array(DataObject::class, $parentClasses, true);
32+
33+
return $isDataObject &&
3034
in_array(substr($methodName, 0, 3), ['get', 'set', 'uns', 'has']);
3135
}
3236
}

0 commit comments

Comments
 (0)