File tree 3 files changed +26
-20
lines changed
3 files changed +26
-20
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ parameters:
2
2
level : 8
3
3
paths :
4
4
- src
5
+ ignoreErrors :
6
+ - ' #Property .+::[\$a-zA-Z ]+ is never written , only read\. #'
5
7
includes :
6
8
- vendor/phpstan/phpstan-strict-rules/rules.neon
7
- - phpstan-baseline.neon
9
+ - phpstan-baseline.neon
Original file line number Diff line number Diff line change 9
9
*/
10
10
class ResourceInformation implements ResourceInformationInterface
11
11
{
12
- public function __construct (
13
- private readonly int $ id ,
14
- private readonly string $ name ,
15
- private readonly string $ url ,
16
- private readonly int $ typeId ,
17
- private readonly int $ folderId ,
18
- private readonly int $ mandatorId ,
19
- private readonly int $ lastModified ,
20
- ) {
21
- }
12
+ private int $ id ;
13
+ private string $ name ;
14
+ private string $ url ;
15
+ private int $ typeId ;
16
+ private int $ folderId ;
17
+ private int $ mandatorId ;
18
+ private int $ lastModified ;
22
19
23
20
public function getId (): int
24
21
{
Original file line number Diff line number Diff line change @@ -8,17 +8,24 @@ class ResourceInformationTest extends StructTestCase
8
8
{
9
9
private ResourceInformation $ subject ;
10
10
11
+ private array $ expectedValues = [
12
+ 'id ' => 123 ,
13
+ 'name ' => 'some name ' ,
14
+ 'url ' => 'some url ' ,
15
+ 'typeId ' => 5 ,
16
+ 'folderId ' => 9 ,
17
+ 'mandatorId ' => 989 ,
18
+ 'lastModified ' => 44455 ,
19
+ ];
20
+
11
21
public function setUp (): void
12
22
{
13
- $ this ->subject = new ResourceInformation (
14
- 123 ,
15
- 'some name ' ,
16
- 'some url ' ,
17
- 5 ,
18
- 9 ,
19
- 989 ,
20
- 44455
21
- );
23
+ $ this ->subject = new ResourceInformation ();
24
+ $ reflection = new \ReflectionClass ($ this ->subject );
25
+
26
+ foreach ($ reflection ->getProperties () as $ property ) {
27
+ $ property ->setValue ($ this ->subject , $ this ->expectedValues [$ property ->getName ()]);
28
+ }
22
29
}
23
30
24
31
public function testGetIdCanReturnInt (): void
You can’t perform that action at this time.
0 commit comments