File tree Expand file tree Collapse file tree 3 files changed +6
-33
lines changed
tests/PHPStan/Rules/Properties Expand file tree Collapse file tree 3 files changed +6
-33
lines changed Original file line number Diff line number Diff line change @@ -234,14 +234,7 @@ public function isAbstract(): TrinaryLogic
234
234
235
235
public function isFinal (): TrinaryLogic
236
236
{
237
- if ($ this ->reflection ->isFinal ()) {
238
- return TrinaryLogic::createYes ();
239
- }
240
- if ($ this ->reflection ->isPrivate ()) {
241
- return TrinaryLogic::createNo ();
242
- }
243
-
244
- return TrinaryLogic::createFromBoolean ($ this ->isPrivateSet ());
237
+ return TrinaryLogic::createFromBoolean ($ this ->reflection ->isFinal ());
245
238
}
246
239
247
240
public function isVirtual (): TrinaryLogic
@@ -277,32 +270,12 @@ public function getHook(string $hookType): ExtendedMethodReflection
277
270
278
271
public function isProtectedSet (): bool
279
272
{
280
- if ($ this ->reflection ->isProtectedSet ()) {
281
- return true ;
282
- }
283
-
284
- if ($ this ->isReadOnly ()) {
285
- return !$ this ->isPrivate () && !$ this ->reflection ->isPrivateSet ();
286
- }
287
-
288
- return false ;
273
+ return $ this ->reflection ->isProtectedSet ();
289
274
}
290
275
291
276
public function isPrivateSet (): bool
292
277
{
293
- if ($ this ->reflection ->isPrivateSet ()) {
294
- return true ;
295
- }
296
-
297
- if ($ this ->reflection ->isProtectedSet ()) {
298
- return false ;
299
- }
300
-
301
- if ($ this ->isReadOnly ()) {
302
- return $ this ->isPrivate ();
303
- }
304
-
305
- return false ;
278
+ return $ this ->reflection ->isPrivateSet ();
306
279
}
307
280
308
281
}
Original file line number Diff line number Diff line change @@ -150,11 +150,11 @@ public function testAsymmetricVisibility(): void
150
150
70 ,
151
151
],
152
152
[
153
- 'Assign to protected(set) property WriteAsymmetricVisibility\ReadonlyProps::$b. ' ,
153
+ 'Access to protected property WriteAsymmetricVisibility\ReadonlyProps::$b. ' ,
154
154
71 ,
155
155
],
156
156
[
157
- 'Assign to private(set) property WriteAsymmetricVisibility\ReadonlyProps::$c. ' ,
157
+ 'Access to private property WriteAsymmetricVisibility\ReadonlyProps::$c. ' ,
158
158
72 ,
159
159
],
160
160
[
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ public function testRule(): void
26
26
27
27
$ this ->analyse ([__DIR__ . '/data/property-assign-ref.php ' ], [
28
28
[
29
- 'Property PropertyAssignRef\Foo::$foo with private(set) visibility is assigned by reference. ' ,
29
+ 'Property PropertyAssignRef\Foo::$foo with private visibility is assigned by reference. ' ,
30
30
25 ,
31
31
],
32
32
[
You can’t perform that action at this time.
0 commit comments