5 files changed +70
-3
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ public function processNode(Node $node, Scope $scope): array
53
53
$ referencedClasses = [];
54
54
55
55
if ($ node ->class instanceof Name) {
56
- $ referencedClasses [] = ( string ) $ node ->class ;
56
+ $ referencedClasses [] = $ scope -> resolveName ( $ node ->class ) ;
57
57
} else {
58
58
$ classTypeResult = $ this ->ruleLevelHelper ->findTypeToCheck (
59
59
$ scope ,
@@ -87,14 +87,14 @@ static function (Type $type) use ($propertyName): bool {
87
87
return [sprintf (
88
88
'Access to deprecated static property $%s of class %s. ' ,
89
89
$ propertyName ,
90
- $ referencedClass
90
+ $ property -> getDeclaringClass ()-> getName ()
91
91
)];
92
92
}
93
93
94
94
return [sprintf (
95
95
"Access to deprecated static property $%s of class %s: \n%s " ,
96
96
$ propertyName ,
97
- $ referencedClass ,
97
+ $ property -> getDeclaringClass ()-> getName () ,
98
98
$ description
99
99
)];
100
100
}
Original file line number Diff line number Diff line change @@ -59,6 +59,22 @@ public function testAccessDeprecatedStaticProperty(): void
59
59
"Access to deprecated static property \$deprecatedWithDescription of class AccessDeprecatedStaticProperty\Foo: \nThis is probably a singleton. " ,
60
60
33 ,
61
61
],
62
+ [
63
+ 'Access to deprecated static property $deprecatedFoo of class AccessDeprecatedStaticProperty\Foo. ' ,
64
+ 117 ,
65
+ ],
66
+ [
67
+ 'Access to deprecated static property $deprecatedOtherFoo of class AccessDeprecatedStaticProperty\Child. ' ,
68
+ 118 ,
69
+ ],
70
+ [
71
+ 'Access to deprecated static property $deprecatedFoo of class AccessDeprecatedStaticProperty\Foo. ' ,
72
+ 119 ,
73
+ ],
74
+ [
75
+ 'Access to deprecated static property $deprecatedOtherFoo of class AccessDeprecatedStaticProperty\Child. ' ,
76
+ 120 ,
77
+ ],
62
78
]
63
79
);
64
80
}
Original file line number Diff line number Diff line change @@ -67,6 +67,22 @@ public function testDeprecatedStaticMethodCall(): void
67
67
'Call to deprecated method deprecatedFoo() of class CheckDeprecatedStaticMethodCall\Foo. ' ,
68
68
33 ,
69
69
],
70
+ [
71
+ 'Call to deprecated method deprecatedFoo() of class CheckDeprecatedStaticMethodCall\Foo. ' ,
72
+ 74 ,
73
+ ],
74
+ [
75
+ 'Call to deprecated method deprecatedOtherFoo() of class CheckDeprecatedStaticMethodCall\Child. ' ,
76
+ 75 ,
77
+ ],
78
+ [
79
+ 'Call to deprecated method deprecatedFoo() of class CheckDeprecatedStaticMethodCall\Foo. ' ,
80
+ 76 ,
81
+ ],
82
+ [
83
+ 'Call to deprecated method deprecatedOtherFoo() of class CheckDeprecatedStaticMethodCall\Child. ' ,
84
+ 77 ,
85
+ ],
70
86
]
71
87
);
72
88
}
Original file line number Diff line number Diff line change @@ -104,3 +104,19 @@ public function foo()
104
104
}
105
105
106
106
}
107
+
108
+ class Child extends Foo
109
+ {
110
+ /**
111
+ * @deprecated
112
+ */
113
+ public static $ deprecatedOtherFoo ;
114
+
115
+ public static function foo ()
116
+ {
117
+ self ::$ deprecatedFoo ;
118
+ self ::$ deprecatedOtherFoo ;
119
+ static ::$ deprecatedFoo ;
120
+ static ::$ deprecatedOtherFoo ;
121
+ }
122
+ }
Original file line number Diff line number Diff line change @@ -58,3 +58,22 @@ public static function foo()
58
58
}
59
59
60
60
}
61
+
62
+ class Child extends Foo
63
+ {
64
+ /**
65
+ * @deprecated
66
+ */
67
+ public static function deprecatedOtherFoo ()
68
+ {
69
+
70
+ }
71
+
72
+ public static function foo ()
73
+ {
74
+ self ::deprecatedFoo ();
75
+ self ::deprecatedOtherFoo ();
76
+ static ::deprecatedFoo ();
77
+ static ::deprecatedOtherFoo ();
78
+ }
79
+ }
0 commit comments