Skip to content

Commit 5b4cd94

Browse files
committed
Fix build
1 parent d391c8e commit 5b4cd94

File tree

3 files changed

+36
-26
lines changed

3 files changed

+36
-26
lines changed

tests/PHPStan/Rules/DeadCode/UnusedPrivatePropertyRuleTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,11 @@ public function testAlwaysUsedTags(): void
131131
]);
132132
}
133133

134+
public function testTrait(): void
135+
{
136+
$this->alwaysWrittenTags = [];
137+
$this->alwaysReadTags = [];
138+
$this->analyse([__DIR__ . '/data/private-property-trait.php'], []);
139+
}
140+
134141
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace UnusedPropertyTrait;
4+
5+
trait FooTrait
6+
{
7+
8+
private $prop1;
9+
10+
private $prop2;
11+
12+
public function doFoo()
13+
{
14+
echo $this->prop1;
15+
}
16+
17+
public function setFoo($prop1)
18+
{
19+
$this->prop1 = $prop1;
20+
}
21+
22+
}
23+
24+
class ClassUsingTrait
25+
{
26+
27+
use FooTrait;
28+
29+
}

tests/PHPStan/Rules/DeadCode/data/unused-private-property.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -154,29 +154,3 @@ class TextExtension
154154
private $used;
155155

156156
}
157-
158-
trait FooTrait
159-
{
160-
161-
private $prop1;
162-
163-
private $prop2;
164-
165-
public function doFoo()
166-
{
167-
echo $this->prop1;
168-
}
169-
170-
public function setFoo($prop1)
171-
{
172-
$this->prop1 = $prop1;
173-
}
174-
175-
}
176-
177-
class ClassUsingTrait
178-
{
179-
180-
use FooTrait;
181-
182-
}

0 commit comments

Comments
 (0)