File tree Expand file tree Collapse file tree 2 files changed +32
-23
lines changed
tests/PHPStan/Rules/Exceptions Expand file tree Collapse file tree 2 files changed +32
-23
lines changed Original file line number Diff line number Diff line change @@ -276,15 +276,15 @@ public function testBug6791(): void
276276 $ this ->analyse ([__DIR__ . '/data/bug-6791.php ' ], [
277277 [
278278 'Dead catch - TypeError is never thrown in the try block. ' ,
279- 17 ,
279+ 22 ,
280280 ],
281281 [
282282 'Dead catch - TypeError is never thrown in the try block. ' ,
283- 29 ,
283+ 34 ,
284284 ],
285285 [
286286 'Dead catch - TypeError is never thrown in the try block. ' ,
287- 33 ,
287+ 38 ,
288288 ],
289289 ]);
290290 }
Original file line number Diff line number Diff line change @@ -11,24 +11,33 @@ class Foo {
1111 public $ array ;
1212}
1313
14- $ foo = new Foo ();
15- try {
16- $ foo ->intArray = ["a " ];
17- } catch (\TypeError $ e ) {}
18-
19- try {
20- $ foo ->set = ["a " ];
21- } catch (\TypeError $ e ) {}
22-
23- try {
24- $ foo ->set = new \Ds \Set ;
25- } catch (\TypeError $ e ) {}
26-
27- try {
28- $ foo ->array = ["a " ];
29- } catch (\TypeError $ e ) {}
30-
31- try {
32- $ foo ->array = "non-array " ;
33- } catch (\TypeError $ e ) {}
14+ class Bar
15+ {
16+
17+ public function doFoo ()
18+ {
19+ $ foo = new Foo ();
20+ try {
21+ $ foo ->intArray = ["a " ];
22+ } catch (\TypeError $ e ) {}
23+
24+ try {
25+ $ foo ->set = ["a " ];
26+ } catch (\TypeError $ e ) {}
27+
28+ try {
29+ $ foo ->set = new \Ds \Set ;
30+ } catch (\TypeError $ e ) {}
31+
32+ try {
33+ $ foo ->array = ["a " ];
34+ } catch (\TypeError $ e ) {}
35+
36+ try {
37+ $ foo ->array = "non-array " ;
38+ } catch (\TypeError $ e ) {}
39+ }
40+
41+ }
42+
3443
You can’t perform that action at this time.
0 commit comments