/** * @param \PhpParser\Node\Expr\PropertyFetch|\PhpParser\Node\Expr\StaticPropertyFetch $propertyFetch * @param \PHPStan\Analyser\Scope $scope * @return string|null */ private function describeProperty($propertyFetch, Scope $scope) { if ($propertyFetch instanceof Node\Expr\PropertyFetch) { if (!is_string($propertyFetch->name)) { return null; } $propertyHolderType = $scope->getType($propertyFetch->var); if ($propertyHolderType->getClass() === null) { return null; } return sprintf('Property %s::$%s', $propertyHolderType->getClass(), $propertyFetch->name); } elseif ($propertyFetch instanceof Node\Expr\StaticPropertyFetch) { if (!$propertyFetch->class instanceof Node\Name || !is_string($propertyFetch->name)) { return null; } return sprintf('Static property %s::$%s', $scope->resolveName($propertyFetch->class), $propertyFetch->name); } return null; }