Skip to content

Commit daa8cc6

Browse files
committed
Test - private property with allowed property tag is public
1 parent 41a5ec6 commit daa8cc6

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

tests/PHPStan/Rules/Properties/AccessPropertiesRuleTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,4 +1203,12 @@ public function testBug8668(): void
12031203
]);
12041204
}
12051205

1206+
public function testPrivatePropertyWithAllowedPropertyTagIsPublic(): void
1207+
{
1208+
$this->checkThisOnly = false;
1209+
$this->checkUnionTypes = true;
1210+
$this->checkDynamicProperties = true;
1211+
$this->analyse([__DIR__ . '/data/private-property-with-allowed-property-tag-is-public.php'], []);
1212+
}
1213+
12061214
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace PrivatePropertyWithAllowedPropertyTagIsPublic;
4+
5+
use AllowDynamicProperties;
6+
7+
/**
8+
* @property int $foo
9+
*/
10+
#[AllowDynamicProperties]
11+
class Foo
12+
{
13+
14+
private int $foo;
15+
16+
}
17+
18+
function (Foo $foo): void {
19+
echo $foo->foo;
20+
};

0 commit comments

Comments
 (0)