Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b25e1e7

Browse files
phpstan-botclaude
andcommitted
Move readonly checks into hasRestrictedWriteAccess method
Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent 23a0cf7 commit b25e1e7

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/Rules/Generics/PropertyVarianceRule.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function processNode(Node $node, Scope $scope): array
4545
return [];
4646
}
4747

48-
$variance = $node->isReadOnly() || $node->isReadOnlyByPhpDoc() || $this->hasRestrictedWriteAccess($node)
48+
$variance = $this->hasRestrictedWriteAccess($node)
4949
? TemplateTypeVariance::createCovariant()
5050
: TemplateTypeVariance::createInvariant();
5151

@@ -58,6 +58,10 @@ public function processNode(Node $node, Scope $scope): array
5858

5959
private function hasRestrictedWriteAccess(ClassPropertyNode $node): bool
6060
{
61+
if ($node->isReadOnly() || $node->isReadOnlyByPhpDoc()) {
62+
return true;
63+
}
64+
6165
if ($node->isPrivateSet()) {
6266
return true;
6367
}

0 commit comments

Comments
 (0)