File tree Expand file tree Collapse file tree 2 files changed +46
-3
lines changed
Expand file tree Collapse file tree 2 files changed +46
-3
lines changed Original file line number Diff line number Diff line change @@ -1659,9 +1659,11 @@ public function testBug13945Two(): void
16591659 public function testBug12246 (): void
16601660 {
16611661 $ errors = $ this ->runAnalyse (__DIR__ . '/data/bug-12246.php ' );
1662- $ this ->assertCount (1 , $ errors );
1662+ $ this ->assertCount (4 , $ errors );
16631663 $ this ->assertSame ('Do-while loop condition is always true. ' , $ errors [0 ]->getMessage ());
1664- $ this ->assertSame (11 , $ errors [0 ]->getLine ());
1664+ $ this ->assertSame ('Do-while loop condition is always true. ' , $ errors [1 ]->getMessage ());
1665+ $ this ->assertSame ('Do-while loop condition is always true. ' , $ errors [2 ]->getMessage ());
1666+ $ this ->assertSame ('Cannot create callable from the new operator. ' , $ errors [3 ]->getMessage ());
16651667 }
16661668
16671669 public function testBigPhpdocArrayShape (): void
Original file line number Diff line number Diff line change 22
33namespace Bug12246 ;
44
5- final class SkipFirstClassCallableInDo
5+ final class FirstClassCallableInDo
66{
77 public function getSubscribedEvents (): void
88 {
@@ -16,3 +16,44 @@ public function textElement(): int
1616 return 1 ;
1717 }
1818}
19+
20+ final class StaticFirstClassCallableInDo
21+ {
22+ public function getSubscribedEvents (): void
23+ {
24+ do {
25+
26+ } while (self ::textElement (...));
27+ }
28+
29+ static public function textElement (): int
30+ {
31+ return 1 ;
32+ }
33+ }
34+
35+ final class FunctionFirstClassCallableInDo
36+ {
37+ public function getSubscribedEvents (): void
38+ {
39+ do {
40+
41+ } while (doFoo (...));
42+ }
43+ }
44+
45+ function doFoo ():int {
46+ return 1 ;
47+ }
48+
49+ final class InstationFirstClassCallableInDo
50+ {
51+ public function getSubscribedEvents (): void
52+ {
53+ do {
54+
55+ } while (new Foo (...));
56+ }
57+ }
58+
59+ class Foo {}
You can’t perform that action at this time.
0 commit comments