2121 *
2222 * @implements Rule<Expression>
2323 */
24- final class NoJustPropertyAssignRule implements Rule
24+ final readonly class NoJustPropertyAssignRule implements Rule
2525{
2626 /**
2727 * @var string
2828 */
2929 public const ERROR_MESSAGE = 'Instead of assigning service property to a variable, use the property directly ' ;
3030
3131 public function __construct (
32- private readonly PhpDocResolver $ phpDocResolver
32+ private PhpDocResolver $ phpDocResolver
3333 ) {
3434
3535 }
@@ -68,9 +68,9 @@ public function processNode(Node $node, Scope $scope): array
6868 ->build ()];
6969 }
7070
71- private function shoulSkipMoreSpecificTypeByDocblock (Scope $ scope , Expression $ node , Assign $ assign ): bool
71+ private function shoulSkipMoreSpecificTypeByDocblock (Scope $ scope , Expression $ expression , Assign $ assign ): bool
7272 {
73- $ docComment = $ node ->getDocComment ();
73+ $ docComment = $ expression ->getDocComment ();
7474 if (! $ docComment instanceof Doc) {
7575 return false ;
7676 }
@@ -83,10 +83,10 @@ private function shoulSkipMoreSpecificTypeByDocblock(Scope $scope, Expression $n
8383 return false ;
8484 }
8585
86- $ r = $ this ->phpDocResolver ->resolve ($ scope , $ scope ->getClassReflection (), $ docComment );
86+ $ resolvedPhpDocBlock = $ this ->phpDocResolver ->resolve ($ scope , $ scope ->getClassReflection (), $ docComment );
8787 $ exprType = $ scope ->getType ($ assign ->expr );
8888
89- foreach ($ r ->getVarTags () as $ key => $ varTag ) {
89+ foreach ($ resolvedPhpDocBlock ->getVarTags () as $ key => $ varTag ) {
9090 if ($ key !== $ varName ) {
9191 continue ;
9292 }
0 commit comments