File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed
tests/PHPStan/Rules/Properties Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -807,4 +807,9 @@ public function testBug7844b(): void
807
807
$ this ->analyse ([__DIR__ . '/data/bug-7844b.php ' ], []);
808
808
}
809
809
810
+ public function testBug12675 (): void
811
+ {
812
+ $ this ->analyse ([__DIR__ . '/data/bug-12675.php ' ], []);
813
+ }
814
+
810
815
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Bug12675 ;
4
+
5
+ class HelloWorld
6
+ {
7
+ private string $ username = "" ;
8
+ private string $ domain = "" ;
9
+
10
+ public function with_shift (string $ email ): void
11
+ {
12
+ $ pieces = explode ("@ " , $ email );
13
+ if (2 !== count ($ pieces )) {
14
+
15
+ throw new \Exception ("Bad, very bad... " );
16
+ }
17
+
18
+ $ this ->username = array_shift ($ pieces );
19
+ $ this ->domain = array_shift ($ pieces );
20
+
21
+ echo "{$ this ->username }@ {$ this ->domain }" ;
22
+ }
23
+
24
+ public function with_pop (string $ email ): void
25
+ {
26
+ $ pieces = explode ("@ " , $ email );
27
+ if (2 !== count ($ pieces )) {
28
+
29
+ throw new \Exception ("Bad, very bad... " );
30
+ }
31
+
32
+ $ this ->domain = array_pop ($ pieces );
33
+ $ this ->username = array_pop ($ pieces );
34
+
35
+ echo "{$ this ->username }@ {$ this ->domain }" ;
36
+ }
37
+ }
You can’t perform that action at this time.
0 commit comments